Skip to content

Commit

Permalink
Compatibility with node HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
felixge committed Oct 18, 2010
1 parent 7b60942 commit 720f4a3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
8 changes: 4 additions & 4 deletions example/post.js
@@ -1,6 +1,6 @@
require('../test/common');
var http = require('http')
, sys = require('sys')
, util = require('util')
, formidable = require('formidable')
, server;

Expand All @@ -21,7 +21,7 @@ server = http.createServer(function(req, res) {
form
.addListener('error', function(err) {
res.writeHead(200, {'content-type': 'text/plain'});
res.end('error:\n\n'+sys.inspect(err));
res.end('error:\n\n'+util.inspect(err));
})
.addListener('field', function(field, value) {
p([field, value]);
Expand All @@ -30,7 +30,7 @@ server = http.createServer(function(req, res) {
.addListener('end', function() {
puts('-> post done');
res.writeHead(200, {'content-type': 'text/plain'});
res.end('received fields:\n\n '+sys.inspect(fields));
res.end('received fields:\n\n '+util.inspect(fields));
});
form.parse(req);
} else {
Expand All @@ -40,4 +40,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);

sys.puts('listening on http://localhost:'+TEST_PORT+'/');
util.puts('listening on http://localhost:'+TEST_PORT+'/');
8 changes: 4 additions & 4 deletions example/upload.js
@@ -1,6 +1,6 @@
require('../test/common');
var http = require('http')
, sys = require('sys')
, util = require('util')
, formidable = require('formidable')
, server;

Expand Down Expand Up @@ -33,9 +33,9 @@ server = http.createServer(function(req, res) {
.addListener('end', function() {
puts('-> upload done');
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received fields:\n\n '+sys.inspect(fields));
res.write('received fields:\n\n '+util.inspect(fields));
res.write('\n\n');
res.end('received files:\n\n '+sys.inspect(files));
res.end('received files:\n\n '+util.inspect(files));
});
form.parse(req);
} else {
Expand All @@ -45,4 +45,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);

sys.puts('listening on http://localhost:'+TEST_PORT+'/');
util.puts('listening on http://localhost:'+TEST_PORT+'/');
4 changes: 2 additions & 2 deletions lib/formidable/incoming_form.js
@@ -1,6 +1,6 @@
if (global.GENTLY) require = GENTLY.hijack(require);

var sys = require('sys')
var util = require('./util')
, path = require('path')
, WriteStream = require('fs').WriteStream
, MultipartParser = require('./multipart_parser').MultipartParser
Expand Down Expand Up @@ -29,7 +29,7 @@ function IncomingForm() {
this._flushing = 0;
this._fieldsSize = 0;
};
sys.inherits(IncomingForm, EventEmitter);
util.inherits(IncomingForm, EventEmitter);
exports.IncomingForm = IncomingForm;

IncomingForm.prototype.parse = function(req, cb) {
Expand Down
8 changes: 4 additions & 4 deletions test/common.js
@@ -1,9 +1,9 @@
var path = require('path')
, fs = require('fs')
, sys = require('sys')
, timeout;

require.paths.unshift(path.dirname(__dirname)+'/lib');
var util = require('formidable/util');

try {
global.Gently = require('gently');
Expand All @@ -13,9 +13,9 @@ try {

global.GENTLY = new Gently();

global.puts = sys.puts;
global.puts = util.puts;
global.p = function() {
sys.error(sys.inspect.apply(null, arguments));
util.error(util.inspect.apply(null, arguments));
};
global.assert = require('assert');
global.TEST_PORT = 13532;
Expand Down Expand Up @@ -58,4 +58,4 @@ assert.properties = function(obj, properties) {
'does not have property: '+property
);
}
};
};
5 changes: 1 addition & 4 deletions test/fixture/multipart.js
@@ -1,6 +1,3 @@
var puts = require('sys').puts;
var p = require('sys').p;

exports['rfc1867'] =
{ boundary: 'AaB03x'
, raw:
Expand Down Expand Up @@ -44,4 +41,4 @@ exports['emptyHeader'] =
'... contents of file1.txt ...\r\r\n'+
'--AaB03x--\r\n'
, expectError: true
};
};
4 changes: 2 additions & 2 deletions test/integration/test-multipart-parser.js
Expand Up @@ -43,7 +43,7 @@ Object.keys(fixtures).forEach(function(name) {

parser.onPartData = function(b, start, end) {
var str = b.toString('ascii', start, end);
part.data += b.binarySlice(start, end);
part.data += b.slice(start, end);
}

parser.onEnd = function() {
Expand Down Expand Up @@ -77,4 +77,4 @@ Object.keys(fixtures).forEach(function(name) {

assert.ok(endCalled);
assert.deepEqual(parts, fixture.parts);
});
});
4 changes: 2 additions & 2 deletions test/system/test-multi-video-upload.js
Expand Up @@ -2,7 +2,7 @@ require('../common');
var BOUNDARY = '---------------------------10102754414578508781458777923'
, FIXTURE = TEST_FIXTURES+'/multi_video.upload'
, fs = require('fs')
, sys = require('sys')
, util = require('formidable/util')
, http = require('http')
, formidable = require('formidable')
, server = http.createServer();
Expand Down Expand Up @@ -53,4 +53,4 @@ server.listen(TEST_PORT, function() {
.addListener('end', function() {
request.end();
});
});
});

0 comments on commit 720f4a3

Please sign in to comment.