Skip to content
This repository
  • 11 commits
  • 9 files changed
  • 0 comments
  • 1 contributor
5  .gitignore
... ...
@@ -1 +1,4 @@
1  
-/test/tmp/*
  1
+/test/tmp/*
  2
+*.upload
  3
+*.un~
  4
+/node_modules
3  .npmignore
... ...
@@ -1,3 +0,0 @@
1  
-test/tmp/
2  
-*.upload
3  
-*.un~
18  Readme.md
Source Rendered
@@ -20,6 +20,20 @@ a big variety of clients and is considered production-ready.
20 20
 
21 21
 ## Changelog
22 22
 
  23
+### v1.0.2
  24
+
  25
+* Exclude node\_modules folder from git
  26
+* Implement new `'aborted'` event
  27
+* Fix files in example folder to work with recent node versions
  28
+
  29
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
  30
+
  31
+### v1.0.1
  32
+
  33
+* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
  34
+
  35
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
  36
+
23 37
 ### v1.0.0
24 38
 
25 39
 * 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
198 212
 
199 213
 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.
200 214
 
  215
+#### Event: 'aborted'
  216
+
  217
+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).
  218
+
201 219
 #### Event: 'end' ()
202 220
 
203 221
 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.
4  benchmark/bench-multipart-parser.js
... ...
@@ -1,5 +1,5 @@
1 1
 require('../test/common');
2  
-var multipartParser = require('formidable/multipart_parser'),
  2
+var multipartParser = require('../lib/multipart_parser'),
3 3
     MultipartParser = multipartParser.MultipartParser,
4 4
     parser = new MultipartParser(),
5 5
     Buffer = require('buffer').Buffer,
@@ -46,7 +46,7 @@ var start = +new Date(),
46 46
     duration = +new Date - start,
47 47
     mbPerSec = (mb / (duration / 1000)).toFixed(2);
48 48
 
49  
-p(mbPerSec+' mb/sec');
  49
+console.log(mbPerSec+' mb/sec');
50 50
 
51 51
 assert.equal(nparsed, buffer.length);
52 52
 
6  example/post.js
@@ -24,11 +24,11 @@ server = http.createServer(function(req, res) {
24 24
         res.end('error:\n\n'+util.inspect(err));
25 25
       })
26 26
       .on('field', function(field, value) {
27  
-        p([field, value]);
  27
+        console.log(field, value);
28 28
         fields.push([field, value]);
29 29
       })
30 30
       .on('end', function() {
31  
-        puts('-> post done');
  31
+        console.log('-> post done');
32 32
         res.writeHead(200, {'content-type': 'text/plain'});
33 33
         res.end('received fields:\n\n '+util.inspect(fields));
34 34
       });
@@ -40,4 +40,4 @@ server = http.createServer(function(req, res) {
40 40
 });
41 41
 server.listen(TEST_PORT);
42 42
 
43  
-util.puts('listening on http://localhost:'+TEST_PORT+'/');
  43
+console.log('listening on http://localhost:'+TEST_PORT+'/');
8  example/upload.js
@@ -23,15 +23,15 @@ server = http.createServer(function(req, res) {
23 23
 
24 24
     form
25 25
       .on('field', function(field, value) {
26  
-        p([field, value]);
  26
+        console.log(field, value);
27 27
         fields.push([field, value]);
28 28
       })
29 29
       .on('file', function(field, file) {
30  
-        p([field, file]);
  30
+        console.log(field, file);
31 31
         files.push([field, file]);
32 32
       })
33 33
       .on('end', function() {
34  
-        puts('-> upload done');
  34
+        console.log('-> upload done');
35 35
         res.writeHead(200, {'content-type': 'text/plain'});
36 36
         res.write('received fields:\n\n '+util.inspect(fields));
37 37
         res.write('\n\n');
@@ -45,4 +45,4 @@ server = http.createServer(function(req, res) {
45 45
 });
46 46
 server.listen(TEST_PORT);
47 47
 
48  
-util.puts('listening on http://localhost:'+TEST_PORT+'/');
  48
+console.log('listening on http://localhost:'+TEST_PORT+'/');
3  lib/incoming_form.js
@@ -69,6 +69,9 @@ IncomingForm.prototype.parse = function(req, cb) {
69 69
     .on('error', function(err) {
70 70
       self._error(err);
71 71
     })
  72
+    .on('aborted', function() {
  73
+      self.emit('aborted');
  74
+    })
72 75
     .on('data', function(buffer) {
73 76
       self.write(buffer);
74 77
     })
8  package.json
... ...
@@ -1,7 +1,8 @@
1 1
 {
2 2
   "name": "formidable",
3  
-  "version": "1.0.1",
4  
-  "dependencies": {
  3
+  "version": "1.0.2",
  4
+  "dependencies": {},
  5
+  "devDependencies": {
5 6
     "gently": ">=0.7.0"
6 7
   },
7 8
   "directories": {
@@ -10,6 +11,5 @@
10 11
   "main": "./lib/index",
11 12
   "engines": {
12 13
     "node": "*"
13  
-  },
14  
-  "devDependencies": {}
  14
+  }
15 15
 }
15  test/simple/test-incoming-form.js
@@ -60,7 +60,7 @@ test(function parse() {
60 60
     assert.strictEqual(headers, REQ.headers);
61 61
   });
62 62
 
63  
-  var events = ['error', 'data', 'end'];
  63
+  var events = ['error', 'aborted', 'data', 'end'];
64 64
   gently.expect(REQ, 'on', events.length, function(event, fn) {
65 65
     assert.equal(event, events.shift());
66 66
     emit[event] = fn;
@@ -139,6 +139,15 @@ test(function parse() {
139 139
     emit.error(ERR);
140 140
   })();
141 141
 
  142
+  (function testEmitAborted() {
  143
+    gently.expect(form, 'emit',function(event) {
  144
+      assert.equal(event, 'aborted');
  145
+    });
  146
+
  147
+    emit.aborted();
  148
+  })();
  149
+
  150
+
142 151
   (function testEmitData() {
143 152
     var BUFFER = [1, 2, 3];
144 153
     gently.expect(form, 'write', function(buffer) {
@@ -181,7 +190,7 @@ test(function parse() {
181 190
         parseCalled = 0;
182 191
 
183 192
     gently.expect(form, 'writeHeaders');
184  
-    gently.expect(REQ, 'on', 3, function() {
  193
+    gently.expect(REQ, 'on', 4, function() {
185 194
       return this;
186 195
     });
187 196
 
@@ -210,7 +219,7 @@ test(function parse() {
210 219
     }));
211 220
 
212 221
     gently.expect(form, 'writeHeaders');
213  
-    gently.expect(REQ, 'on', 3, function() {
  222
+    gently.expect(REQ, 'on', 4, function() {
214 223
       return this;
215 224
     });
216 225
 

No commit comments for this range

Something went wrong with that request. Please try again.