Граф коммитов

19 Коммитов

Автор SHA1 Сообщение Дата
Ryan Dahl 5fbc750db7 multipart no longer depends on Promise 2010-02-20 19:17:58 -08:00
Ryan Dahl ae85d9af97 API: Make request/response object closer to stream interface
- sendBody() renamed to write()
- 'body' event renamed to 'data'
- 'complete' event renamed to 'end'
2010-02-16 22:16:29 -08:00
isaacs 3adcdfc2e1 A rewrite of multipart library.
1. Support streaming in the simple case.  Put huge warnings around the
buffering API.
2. Support nested multipart messages.
3. Support various kinds of multipart messages, including all the various
absurdities of multipart email messages.
4. Error out on various invalid types of data that might come through.
5. Gracefully several edge cases that occur when the chunk size is smaller
than the boundary length, or cuts into the \r\n, etc.
6. Provide both positive and negative tests.
2010-02-08 14:03:06 -08:00
Aaron Heckmann 8f52142116 look for -1 instead of false returned from string.indexOf 2010-02-03 10:13:15 -08:00
Felix Geisendörfer ac2abe5b1e Bugfix: Handle Content-Type headers with charset
Some HTTP clients include a charset parameter in the Content-Type, e.g:

multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY

This patch makes the multipart parser more forgiving towards unexpected
information included in the Content-Type header.
2010-01-29 18:04:48 -08:00
Ryan Dahl 8abeffa9ea Add process.nextTick()
This is a replacement for the common hack:

  setTimeout(cb, 0);

It's much more efficient.
2010-01-18 10:32:36 -08:00
Ryan Dahl 70293a43c9 API: Move Promise and EventEmitter into 'events' module 2010-01-15 12:46:08 -08:00
Felix Geisendörfer f86c1783b7 Handle bad requests in simplified parser API 2010-01-05 22:37:51 +01:00
Felix Geisendörfer d9a81374b2 Throw exception for invalid multipart streams
When using the multipart parser with an regular http request, the
parser did not complain and just never finished.
2010-01-05 22:23:56 +01:00
Felix Geisendörfer 5de04dafc6 Do not pause request for multipart parsing
This is actually undesireable as it takes away control from the user who
may want to pause/resume to throttle the upload stream, or synchronize
it with disk flushing.

I actually ran into memory issues when trying to stream huge files to
disc as the file module was building up a huge action buffer. This can
now easily be avoided like this:

part.addListener('body', function(chunk) {
  req.pause();
  file.write(chunk).addCallback(function() {
    req.resume();
  });
}
2009-12-22 19:28:30 +01:00
Felix Geisendörfer 27fcae738a Reduce multipart memory footprint
Multipart parts kept the first chunk of data after their headers in
memory, even so that was no longer needed.
2009-11-22 15:09:55 +01:00
Felix Geisendörfer 528c449901 Multipart improvements
Multipart parts now have a name and filename property. Those are the
same as:

part.headers['content-disposition'].name
part.headers['content-disposition'].filename

This patch also updates and improves the docs for the multipart module.
2009-11-21 17:16:06 +01:00
Ryan Dahl 43121c15be API: rename process.inherits to sys.inherits 2009-11-07 14:45:39 +01:00
Ryan Dahl ad0a4cefb8 Namespace EVERYTHING under process; introduce GLOBAL
http://groups.google.com/group/nodejs/browse_thread/thread/1034fd2ad2cd93e8
2009-10-29 23:36:41 +01:00
Felix Geisendörfer 6219f2a2be Removed getHeader() function thanks to f623f 2009-10-07 17:30:30 +02:00
Felix Geisendörfer abbc624f52 Multipart test now uses a fixture instead of CURL 2009-10-07 02:03:24 +02:00
Felix Geisendörfer 3fd1cba073 Fixed bad indention in multipart.js 2009-10-07 02:03:24 +02:00
Felix Geisendörfer eeaa267cbe Documentation for Multipart parser
Also added multipart.parse as a convenience function
2009-10-03 18:06:24 +02:00
Felix Geisendörfer 27c750154e Multipart stream parser 2009-09-27 16:58:56 +02:00