summaryrefslogtreecommitdiff
path: root/lib/_http_common.js
AgeCommit message (Collapse)Author
2016-02-09http: strictly forbid invalid characters from headersJames M Snell
PR-URL: https://github.com/nodejs/node-private/pull/26 Reviewed-By: Rod Vagg <r@va.gg> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-22http: remove reference to onParserExecuteTom Atkinson
Parsers hold a reference to the socket associated with the request through onParserExecute. This must be removed when the parser is freed so that the socket can be garbage collected when destroyed. Regression introduced in commit 59b91f1 ("http_parser: consume StreamBase instance"). PR-URL: https://github.com/nodejs/node/pull/4773 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-12-17http: do not emit `upgrade` on advertisementFedor Indutny
Do not emit `upgrade` if the server is just advertising its protocols support as per RFC 7230 Section 6.7. A server MAY send an Upgrade header field in any other response to advertise that it implements support for upgrading to the listed protocols, in order of descending preference, when appropriate for a future request. Fix: https://github.com/nodejs/node/issues/4334 PR-URL: https://github.com/nodejs/node/pull/4337 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-14http: fix stalled pipeline bugFedor Indutny
This is a two-part fix: - Fix pending data notification in `OutgoingMessage` to notify server about flushed data too - Fix pause/resume behavior for the consumed socket. `resume` event is emitted on a next tick, and `socket._paused` can already be `true` at this time. Pause the socket again to avoid PAUSED error on parser. Fix: https://github.com/nodejs/node/issues/3332 PR-URL: https://github.com/nodejs/node/pull/3342 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-09-25http: add checkIsHttpToken check for header fieldsJames M Snell
Ref: https://github.com/nodejs/node-convergence-archive/issues/13 This adds a new check for header and trailer fields names and method names to ensure that they conform to the HTTP token rule. If they do not, a `TypeError` is thrown. Previously this had an additional `strictMode` option that has been removed in favor of making the strict check the default (and only) behavior. Doc and test case are included. On the client-side ```javascript var http = require('http'); var url = require('url'); var p = url.parse('http://localhost:8888'); p.headers = {'testing 123': 123}; http.client(p, function(res) { }); // throws ``` On the server-side ```javascript var http = require('http'); var server = http.createServer(function(req,res) { res.setHeader('testing 123', 123); // throws res.end('...'); }); ``` Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trevor Norris <trevnorris@nodejs.org> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> PR-URL: https://github.com/nodejs/node/pull/2526
2015-05-25http: simplify code and remove unused propertiesBrian White
PR-URL: https://github.com/nodejs/io.js/pull/1572 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-03-25iojs: introduce internal modulesVladimir Kurchatkin
Internal modules can be used to share private code between public modules without risk to expose private APIs to the user. PR-URL: https://github.com/iojs/io.js/pull/848 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-31lib: reduce util.is*() usagecjihrig
Many of the util.is*() methods used to check data types simply compare against a single value or the result of typeof. This commit replaces calls to these methods with equivalent checks. This commit does not touch calls to the more complex methods (isRegExp(), isDate(), etc.). Fixes: https://github.com/iojs/io.js/issues/607 PR-URL: https://github.com/iojs/io.js/pull/647 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-21lib: use const to define constantscjihrig
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: https://github.com/iojs/io.js/pull/541 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-13http: optimize on_headers_completeBert Belder
Use an array instead of an object to pass a parsed header chunk from c++ to javascript. This offers a 5-10% speedup on the http_simple benchmark, as evidenced by running: ab -k -t 100 -c 100 http://127.0.0.1:8000/bytes/100 PR: https://github.com/iojs/io.js/pull/292 Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-11-22lib: turn on strict modeBen Noordhuis
Turn on strict mode for the files in the lib/ directory. It helps catch bugs and can have a positive effect on performance. PR-URL: https://github.com/node-forward/node/pull/64 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-05lib: http: poison parser references after freeingBen Noordhuis
Make it a little harder to slip in use-after-free bugs by nulling out references to the parser object after handing it off to freeParser(). Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-09-05lib, src: don't make http parser handles weakBen Noordhuis
Weak handles put strain on the garbage collector and the parser handle doesn't need to be weak in the first place. This change should improve GC times on busy servers a little. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2013-12-20http: parse the status message in a http response.Cam Swords
2013-11-04http: make DELETE requests set `req.method`Nathan Rajlich
Fixes #6461.
2013-10-28http: remove MethodToString()Ben Noordhuis
The list of supported HTTP methods is available in JS land now so there is no longer any need to pass a stringified version of the method to the parser callback, it can look up the method name for itself. Saves a call to v8::Eternal::Get() in the common case and a costly v8::String::NewFromOneByte() in the uncommon case.
2013-10-28http: expose supported methodsBen Noordhuis
Expose the list of supported HTTP methods as a property on the 'http' module object. Fixes #6422.
2013-10-16http: provide backpressure for pipeline floodisaacs
If a client sends a lot more pipelined requests than we can handle, then we need to provide backpressure so that the client knows to back off. Do this by pausing both the stream and the parser itself when the responses are not being read by the downstream client. Fix GH-6214
2013-08-15http: provide access to raw headers/trailersisaacs
The format is [key,value,key,value,...] because that seems to have the lowest overhead. Close #4844
2013-08-14http: speed up callbacks, use array indicesBen Noordhuis
Use array indices rather than named properties to store callbacks on the HTTPParser object. Speeds up the http benchmarks by a few percent.
2013-08-08http: Use streams3 directly, not .ondata/endisaacs
2013-05-21util: Add debuglog, deprecate console lookalikesisaacs
2013-04-17http: move Server and ServerResponse outTimothy J Fontaine
2013-04-17http: move OutgoingMessage into it's own fileTimothy J Fontaine
2013-04-17http: move parsers into _http_common.jsTimothy J Fontaine