Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: felixge/node-formidable
base: v1.0.1
...
head fork: felixge/node-formidable
compare: v1.0.2
Checking mergeability… Don't worry, you can still create the pull request.
  • 11 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 27, 2011
@felixge 1.0.1 Changelog
3f11f39
@felixge Use console.log, not ancient node methods
37b33fc
Commits on May 03, 2011
@felixge Use gitignore instead of npmignore and gitignore
5848319
@felixge Ignore node modules folder
0db3a1f
Commits on May 13, 2011
@felixge Bubble up 'aborted' events from request
Right now those can either mean that the socket had a 'timeout', or 'close'
event before finishing the request. I'll propose a node patch that will allow
seperating the two issues in the future.
4a752bb
@felixge Document 'aborted' event
211cdb9
Commits on May 23, 2011
@felixge Make gently a dev dependency
a169691
@felixge Add 1.0.2 changelog
40c475d
@felixge Fix benchmark
3579467
@felixge Fix package.json
8b8da9d
@felixge version 1.0.2
a01d5b4
View
5 .gitignore
@@ -1 +1,4 @@
-/test/tmp/*
+/test/tmp/*
+*.upload
+*.un~
+/node_modules
View
3  .npmignore
@@ -1,3 +0,0 @@
-test/tmp/
-*.upload
-*.un~
View
18 Readme.md
@@ -20,6 +20,20 @@ a big variety of clients and is considered production-ready.
## Changelog
+### v1.0.2
+
+* Exclude node\_modules folder from git
+* Implement new `'aborted'` event
+* Fix files in example folder to work with recent node versions
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
+
+### v1.0.1
+
+* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
+
### v1.0.0
* Add support for multipart boundaries that are quoted strings. (Jeff Craig)
@@ -198,6 +212,10 @@ Emitted whenever a field / file pair has been received. `file` is an instance of
Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.
+#### Event: 'aborted'
+
+Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a seperate 'timeout' event (needs a change in the node core).
+
#### Event: 'end' ()
Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
View
4 benchmark/bench-multipart-parser.js
@@ -1,5 +1,5 @@
require('../test/common');
-var multipartParser = require('formidable/multipart_parser'),
+var multipartParser = require('../lib/multipart_parser'),
MultipartParser = multipartParser.MultipartParser,
parser = new MultipartParser(),
Buffer = require('buffer').Buffer,
@@ -46,7 +46,7 @@ var start = +new Date(),
duration = +new Date - start,
mbPerSec = (mb / (duration / 1000)).toFixed(2);
-p(mbPerSec+' mb/sec');
+console.log(mbPerSec+' mb/sec');
assert.equal(nparsed, buffer.length);
View
6 example/post.js
@@ -24,11 +24,11 @@ server = http.createServer(function(req, res) {
res.end('error:\n\n'+util.inspect(err));
})
.on('field', function(field, value) {
- p([field, value]);
+ console.log(field, value);
fields.push([field, value]);
})
.on('end', function() {
- puts('-> post done');
+ console.log('-> post done');
res.writeHead(200, {'content-type': 'text/plain'});
res.end('received fields:\n\n '+util.inspect(fields));
});
@@ -40,4 +40,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);
-util.puts('listening on http://localhost:'+TEST_PORT+'/');
+console.log('listening on http://localhost:'+TEST_PORT+'/');
View
8 example/upload.js
@@ -23,15 +23,15 @@ server = http.createServer(function(req, res) {
form
.on('field', function(field, value) {
- p([field, value]);
+ console.log(field, value);
fields.push([field, value]);
})
.on('file', function(field, file) {
- p([field, file]);
+ console.log(field, file);
files.push([field, file]);
})
.on('end', function() {
- puts('-> upload done');
+ console.log('-> upload done');
res.writeHead(200, {'content-type': 'text/plain'});
res.write('received fields:\n\n '+util.inspect(fields));
res.write('\n\n');
@@ -45,4 +45,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);
-util.puts('listening on http://localhost:'+TEST_PORT+'/');
+console.log('listening on http://localhost:'+TEST_PORT+'/');
View
3  lib/incoming_form.js
@@ -69,6 +69,9 @@ IncomingForm.prototype.parse = function(req, cb) {
.on('error', function(err) {
self._error(err);
})
+ .on('aborted', function() {
+ self.emit('aborted');
+ })
.on('data', function(buffer) {
self.write(buffer);
})
View
8 package.json
@@ -1,7 +1,8 @@
{
"name": "formidable",
- "version": "1.0.1",
- "dependencies": {
+ "version": "1.0.2",
+ "dependencies": {},
+ "devDependencies": {
"gently": ">=0.7.0"
},
"directories": {
@@ -10,6 +11,5 @@
"main": "./lib/index",
"engines": {
"node": "*"
- },
- "devDependencies": {}
+ }
}
View
15 test/simple/test-incoming-form.js
@@ -60,7 +60,7 @@ test(function parse() {
assert.strictEqual(headers, REQ.headers);
});
- var events = ['error', 'data', 'end'];
+ var events = ['error', 'aborted', 'data', 'end'];
gently.expect(REQ, 'on', events.length, function(event, fn) {
assert.equal(event, events.shift());
emit[event] = fn;
@@ -139,6 +139,15 @@ test(function parse() {
emit.error(ERR);
})();
+ (function testEmitAborted() {
+ gently.expect(form, 'emit',function(event) {
+ assert.equal(event, 'aborted');
+ });
+
+ emit.aborted();
+ })();
+
+
(function testEmitData() {
var BUFFER = [1, 2, 3];
gently.expect(form, 'write', function(buffer) {
@@ -181,7 +190,7 @@ test(function parse() {
parseCalled = 0;
gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 3, function() {
+ gently.expect(REQ, 'on', 4, function() {
return this;
});
@@ -210,7 +219,7 @@ test(function parse() {
}));
gently.expect(form, 'writeHeaders');
- gently.expect(REQ, 'on', 3, function() {
+ gently.expect(REQ, 'on', 4, function() {
return this;
});

No commit comments for this range

Something went wrong with that request. Please try again.