summaryrefslogtreecommitdiff
path: root/lib/http.js
AgeCommit message (Collapse)Author
2013-02-28Merge remote-tracking branch 'origin/v0.8'Ben Noordhuis
Conflicts: AUTHORS ChangeLog deps/uv/src/unix/pipe.c lib/http.js src/node_version.h
2013-02-26http: fix case in 505 response status lineBen Noordhuis
Fixes #4850.
2013-02-25http: Do not free the wrong parser on socket closeisaacs
This appears to fix #4673. That bug is very hard to reproduce, so it's hard to tell for certain, but this approach is more correct anyway. Hat-tip: @dougwilson
2013-02-22http: Handle hangup writes more gentlyisaacs
2013-02-18http: Add fixme comment about ECONNRESET handlingisaacs
2013-02-18Merge remote-tracking branch 'ry/v0.8' into masterisaacs
Conflicts: AUTHORS ChangeLog lib/http.js src/node_version.h test/simple/test-http-header-response-splitting.js
2013-02-14http: Do not let Agent hand out destroyed socketsisaacs
Fix #4373
2013-02-14http: Raise hangup error on destroyed socket writeisaacs
Prior to v0.10, Node ignored ECONNRESET errors in many situations. There *are* valid cases in which ECONNRESET should be ignored as a normal part of the TCP dance, but in many others, it's a very relevant signal that must be heeded with care. Exacerbating this problem, if the OutgoingMessage does not have a req.connection._handle, it assumes that it is in the process of connecting, and thus buffers writes up in an array. The problem happens when you reuse a socket between two requests, and it is destroyed abruptly in between them. The writes will be buffered, because the socket has no handle, but it's not ever going to GET a handle, because it's not connecting, it's destroyed. The proper fix is to treat ECONNRESET correctly. However, this is a behavior/semantics change, and cannot land in a stable branch. Fix #4775
2013-02-07http: protect against response splitting attacksBert Belder
This patch is a back-port of 3c293ba. Closes #4696
2013-01-28http: Don't dump twiceisaacs
2013-01-24http: close connection on 204 and chunked encodingBen Noordhuis
This is similar to commit 2cbf458 but this time for 204 No Content instead of 304 Not Modified responses. When the user sends a 204 response with a Transfer-Encoding: chunked header, suppress sending the zero chunk and force the connection to close.
2013-01-23http: close connection on 304 and chunked encodingBen Noordhuis
Force the connection to close when the response is a 304 Not Modified and the user has set a "Transfer-Encoding: chunked" header. RFC 2616 mandates that 304 responses MUST NOT have a body but node.js used to send out a zero chunk anyway to accommodate clients that don't have special handling for 304 responses. It was pointed out that this might confuse reverse proxies to the point of creating security liabilities, so suppress the zero chunk and force the connection to close.
2013-01-18Merge remote-tracking branch 'ry/v0.8' into masterisaacs
Conflicts: AUTHORS ChangeLog src/node_version.h test/simple/test-buffer.js
2013-01-16http: fix duplicate var initializationAlexandr Emelin
IncomingMessage function contained duplicate initialization of this._pendings. Line with one of those expressions has been removed.
2013-01-14http: fix "Cannot call method 'emit' of null"Ben Noordhuis
Fix the following exception: http.js:974 this._httpMessage.emit('close'); ^ TypeError: Cannot call method 'emit' of null at Socket.onServerResponseClose (http.js:974:21) at Socket.EventEmitter.emit (events.js:124:20) at net.js:421:10 at process._tickCallback (node.js:386:13) at process._makeCallback (node.js:304:15) Fixes #4586.
2013-01-10http: Set _dumped=false initiallyisaacs
The better to keep the IncomingMessage class isomorphic and avoid creating additional hidden classes.
2013-01-10http: Don't switch the socket into old-modeisaacs
2013-01-10http: Use stream.push() instead of touching _readableStateisaacs
2012-12-29http: Separate out the storeHeader closureisaacs
2012-12-29http: Replace "in" usage with "=== undefined"isaacs
Speeds up http benchmarks.
2012-12-27http: remove unused variableRyunosuke SATO
The module variable `END_OF_FILE` was no longer needed from 1d369317.
2012-12-26http: Handle end only when stream is not dumpedisaacs
This fixes regression introduced in some cases by 8bf0c15
2012-12-26lintisaacs
2012-12-26stream2: fix to emit end event on http.ClientResponseShigeki Ohtsu
2012-12-21lintisaacs
2012-12-21http: Trivial fix for comments and 'this.read'isaacs
2012-12-21http: use IncomingMessage._dump() instead of resume()isaacs
2012-12-20Merge remote-tracking branch 'origin/v0.8'Ben Noordhuis
2012-12-20http: pack response body buffer in first tcp packetBen Noordhuis
Apply the same optimization to res.end(buf) that is applied to res.end(str). Speeds up `node benchmark/http_simple_auto -k -c 1 -n 25000 buffer/1` (non-chunked response body) by about 750x. That's not a typo. Chunked responses: $ cat tmp/http-chunked-client.js // Run `node benchmark/http_simple` in another terminal. var http = require('http'), url = require('url'); var options = url.parse('http://127.0.0.1:8000/buffer/1/1'); options.agent = new http.Agent({ maxSockets: 1 }); for (var i = 0; i < 25000; ++i) http.get(options); Before: $ time out/Release/node tmp/http-chunked-client.js real 16m40.411s user 0m9.184s sys 0m0.604s After: $ time out/Release/node tmp/http-chunked-client.js real 0m5.386s user 0m2.768s sys 0m0.728s That's still a 185x speed-up. Fixes #4415.
2012-12-16http: bubble up parser errors to ClientRequestBrian White
Make parser errors bubble up to the ClientRequest instead of the underlying net.Socket object. This is a back-port of commit c78678b from the master branch. Fixes #3776.
2012-12-14http: Refactor for streams2isaacs
Because of some of the peculiarities of http, this has a bit of special magic to handle cases where the IncomingMessage would wait forever in a paused state. In the server, if you do not begin consuming the request body by the time the response emits 'finish', then it will be flushed out. In the client, if you do not add a 'response' handler onto the request, then the response stream will be flushed out.
2012-12-07http: protect against response splitting attacksBert Belder
2012-11-21windows: add tracing with performance countersScott Blomquist
Patch by Henry Rawas and Scott Blomquist.
2012-10-12lintisaacs
2012-10-11string_decoder: Add 'end' method, do base64 properlyisaacs
2012-10-09https: fix renegotation attack protectionBen Noordhuis
Listen for the 'clientError' event that is emitted when a renegotation attack is detected and close the connection. Fixes test/pummel/test-https-ci-reneg-attack.js
2012-10-03Revert "http: make http.ServerResponse emit 'end'"isaacs
This reverts commit 790d651f0dfae13f1e2b799820ab18ac09f251b7. This makes Duplex streams unworkable, and would only ever be a special case for HTTP responses, which is not ideal. Intead, we're going to just bless the 'finish' event for all Writable streams in 0.10
2012-09-28Merge remote-tracking branch 'ry/v0.8' into v0.8-mergeisaacs
Conflicts: AUTHORS ChangeLog deps/openssl/openssl.gyp deps/uv/src/unix/linux/linux-core.c deps/uv/src/unix/process.c deps/uv/src/unix/stream.c deps/v8/src/arm/builtins-arm.cc deps/v8/src/arm/code-stubs-arm.cc deps/v8/src/arm/full-codegen-arm.cc lib/tls.js src/node_version.h test/simple/test-http-client-timeout-agent.js
2012-09-28http: add response.headersSent propertyPavel Lang
Boolean property getter. True if headers was sent, false otherwise.
2012-09-27http: handle multiple Proxy-Authenticate valuesthewilli
Just as the 'WWW-Authenticate' HTTP header the 'Proxy-Authenticate' header might be received several times as well. Currently only one value is preserved. This change allows to receive multiple values concatenated by space and comma.
2012-09-27http: handle multiple Proxy-Authenticate valuesthewilli
Just as the 'WWW-Authenticate' HTTP header the 'Proxy-Authenticate' header might be received several times as well. Currently only one value is preserved. This change allows to receive multiple values concatenated by space and comma.
2012-09-24http: make the client "res" object gets the same domain as "req"Nathan Rajlich
Fixes #4046.
2012-09-12Merge remote-tracking branch 'ry/v0.8' into masterisaacs
Conflicts: ChangeLog src/node_version.h test/simple/test-util-inspect.js
2012-09-12http: Remove timeout handler when data arrivesFrédéric Germain
2012-09-08http: respect HTTP/1.0 TE headerBen Noordhuis
A HTTP/1.0 client does not support 'Transfer-Encoding: chunked' unless it explicitly requests it by sending a 'TE: chunked' header. Before this commit, node.js always disabled chunked encoding for HTTP/1.0 clients. Now it will scan for the TE header and turn on chunked encoding if requested and applicable. Fixes #940.
2012-09-04http: make http.ServerResponse emit 'end'Ben Noordhuis
This used to be the internal 'finish' event. Make it public so API users will know when the response has been sent completely. Fixes #3855.
2012-08-24http: bubble up parser errors to ClientRequestBrian White
Make parser errors bubble up to the ClientRequest instead of the underlying net.Socket object. Fixes #3776.
2012-07-25https: Use host header as effective servernameisaacs
2012-07-23http: remove duplicate assignmentsBrian White
Closes GH-3754
2012-07-20Revert "http/https: pass request to .createConnection()"Fedor Indutny
This reverts commit 53716eb0b5338999761d115fad9d392077836e63.