424 Commits

Author SHA1 Message Date
Joshaven Potter
3d4e4d8909 syntax fixes to pass jslint 2010-10-06 20:40:57 -07:00
Ryan Dahl
38f8665f3a lib/http.js - nested loop stepping on variables of outer loop
Fixes #318.
2010-10-04 10:50:37 -07:00
Mark Nottingham
d59512f6f4 Add support for handling Expect: 100-continue
HTTP/1.1 requests, either with an event (check_continue) or automatically, if no event handler is present.

Add client-side expect/continue support, tests.

Expound upon client requirements for expect/continue.
2010-10-01 15:30:53 -07:00
Ryan Dahl
265cda97d7 Fix zero length buffer bug for http res.end()
Reported by Kadir Pekel <kadirpekel@gmail.com>
2010-09-30 17:13:01 -07:00
Mark Nottingham
1b24fc6678 Consume HTTP trailing headers 2010-09-30 16:30:40 -07:00
Ryan Dahl
c3bc48d451 Move the http client's initParser() into prototype 2010-09-30 11:41:50 -07:00
Ryan Dahl
069d973d74 Remove require('buffer') in built-in libraries. 2010-09-28 02:31:31 -07:00
Fedor Indutny
5535aa3d51 Fixed 'upgrade' event for httpclient
onend and ondata was cleaning on parser end
2010-09-23 10:29:20 -07:00
Mikeal Rogers
cc1d61cbb3 HTTP: close connection on connection:close header.
rnewson found a good bug in keep-alive. we were only using the request
headers we send to enable/disable keep-alive but when the server sends
Connection: close we need to close down the connection regardless.

I wrote up a patch the Robert verified makes all his test client code work
now and I also added a new unittest for it.
2010-09-22 10:17:07 -07:00
Ryan Dahl
db73c71280 Pass correct message in HTTP client upgrade
Simplify and correct test.

Fix by Fedor Indutny.
2010-09-19 11:55:18 -07:00
Ryan Dahl
a63fd0fe56 Remove deprecation warnings in http module 2010-09-16 14:49:12 -07:00
Sam Stephenson
6560ab9073 Send multiple header lines in ServerResponse#writeHead when header values are arrays 2010-09-15 15:55:30 -07:00
Mark Nottingham
4fe3007a1a Support for outgoing HTTP trailing headers 2010-09-14 15:20:45 -07:00
Ryan Dahl
44a287987e Safe constructors: http.Server and http.Client 2010-08-27 13:58:52 -07:00
Ryan Dahl
2982e75a0b set-cookies header is an array of values. always 2010-08-21 16:34:38 -07:00
Ryan Dahl
9acd76ed6e Don't throw on HEAD requests 2010-08-12 10:06:52 -07:00
Ryan Dahl
1c5d5e0b72 uppercase request methods 2010-08-09 21:23:52 -07:00
Ben Noordhuis
4b19bd2896 Client.onend: Anticipate that the HTTP parser object is uninitialized when the client setup failed. 2010-08-02 11:25:53 -07:00
Mikeal Rogers
3214116be6 Implement keep-alive for http.Client
Send the 'Connection: keep-alive' header in your request to enable.
2010-08-01 22:34:17 -07:00
Ryan Dahl
02729d4af7 instanceof Buffer to Buffer.isBuffer() 2010-07-15 15:58:35 -07:00
Ryan Dahl
6a57a42109 Use Array.isArray instead of instanceof 2010-07-15 10:35:29 -07:00
Dmitriy Shalashov
70a8fb3763 Fix headers with empty value. 2010-07-07 18:46:24 +02:00
Peter Griess
51bd1b4483 Only concatenate some incoming HTTP headers.
- Concatenate 'accept', 'accept-charset', 'accept-encoding',
  'accept-language', 'connection', 'cookie', and 'x-*' headers.
- For all others, drop duplicates.
2010-06-21 12:01:50 -07:00
Peter Griess
187f191558 Support 'upgrade' event in HTTP client.
- Add a unit test for client HTTP upgrade.
- Move around unit tests for server HTTP upgrade.
2010-06-16 11:27:56 -07:00
Ryan Dahl
6bed15e074 Refactor: Utf8Decoder -> StringDecoder
Instead of just decoding Utf8, this will proxy requests to buffer.toString()
for other encodings. This makes for a simpler interface.
2010-06-15 18:19:27 -07:00
Ryan Dahl
55a6f01732 Server responses should have a body if HEAD request 2010-06-02 15:07:15 -07:00
Ryan Dahl
80a8e71fe0 Insert some hot paths into HTTP 2010-05-27 20:43:56 -07:00
Ryan Dahl
74b7fa29a1 Refactor HTTP
Allow throttling from outgoing messages.
2010-05-27 20:41:57 -07:00
Ryan Dahl
29e867aaa0 Simplify a few internal HTTP events. 2010-05-26 13:37:33 -07:00
Sam Hughes
895f89d62a Avoided sending empty chunkedEncoding chunks in the middle of http responses 2010-05-25 22:58:17 -07:00
Ryan Dahl
15ec99ec59 Fix issue 89, parsing responses to HEAD requests
Test from Mark Hansen (mark at markhansen.co.nz)
2010-05-25 19:25:40 -07:00
Ryan Dahl
35c14f637e In HTTP parser, proxy return value of onHeadersComplete 2010-05-25 19:25:38 -07:00
Ben Noordhuis
b58db3cd73 Added reason phrases for a bunch of HTTP status codes. 2010-05-23 17:02:35 -07:00
Ryan Dahl
cbd2c3945b Throwing in a callback should kill the process
There is a difference between errors which happen to a socket - like
receiving EPIPE - an exceptional situation but ultimately okay and the
situation where code throws in a callback - which is not okay.

Fixes test/simple/test-http-exceptions.js

TODO: explain this in docs.
2010-05-20 15:23:36 -07:00
Ryan Dahl
2663c69f8d Fix utf8stream references 2010-05-18 09:32:28 -07:00
Felix Geisendörfer
f987ecf45b Use Utf8Stream for http Streams with utf8 encoding 2010-05-18 01:04:39 -07:00
Ryan Dahl
d0128787e7 Deprecate sendHeader() and writeHeader(), ppl should use writeHead() 2010-05-12 12:15:58 -07:00
Ryan Dahl
7a2e6d674a Default to 2 second timeout for http servers
Taking a performance hit on 'hello world' benchmark by enabling this by
default, but I think it's worth it. Hopefully we can improve performance by
resetting the timeout less often - ideally a 'hello world' benchmark would
only touch the one timer once - if it runs in less than 2 seconds. The rest
should be just link list manipulations.
2010-05-12 11:49:28 -07:00
Ryan Dahl
8ab238e7de Revert "destroy instead of end http connection at end of pipeline"
This reverts commit 4ce1e1fca59bc6ad6e2d19643db2ed3159ccb7dc.

To fix test-http-full-response.js. Clearly this is not the correct solution.
Probably need idle timeouts.
2010-05-09 21:29:51 -07:00
Ryan Dahl
4ce1e1fca5 destroy instead of end http connection at end of pipeline 2010-05-06 09:15:44 -07:00
Thomas Lee
3674563dd5 Fix a bug in http.Client where parsers may be prematurely released back to the free pool. 2010-05-06 00:44:07 -07:00
Ryan Dahl
453c9e6411 Fix whitespace 2010-05-04 21:35:46 -07:00
isaacs
3892628657 Emit a better error message when something strange is sent to OutgoingMessage#write 2010-05-04 18:37:00 -07:00
Ryan Dahl
b5bdf9434b Add another http upgrade test 2010-05-03 11:23:36 -07:00
Ryan Dahl
f0fec7352a Don't emit error twice from http.Client 2010-05-03 10:53:52 -07:00
Micheil Smith
aee226b243 Fixing the 1 byte off error in http.Server's upgradeHead
(And fix up some style issues)
2010-05-01 18:05:53 -07:00
Ryan Dahl
67fb0ece6b Fix deprecation message 2010-05-01 14:45:14 -07:00
Micheil Smith
d6110fbd11 Making requestListener for the construction of a http.Server optional, as it is for net.Server 2010-05-01 11:56:00 -07:00
Micheil Smith
f990f24ad3 Implementing the event emit for Upgrade requests, with tests. 2010-05-01 11:52:40 -07:00
Ryan Dahl
3b323027be http server emits 'clientError' 2010-04-30 10:29:35 -07:00