0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

29 Commits

Author SHA1 Message Date
Qasim Zaidi
cf3e908b70 http: more descriptive setHeader errors
PR-URL: https://github.com/iojs/io.js/pull/480
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2015-01-29 16:58:36 -08:00
cjihrig
804e7aa9ab lib: use const to define constants
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-21 16:21:31 -05:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
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.
2015-01-12 15:30:28 -08:00
Ben Noordhuis
21130c7d6f lib: turn on strict mode
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-11-22 17:23:30 +01:00
Trevor Norris
979d0ca874 http: cleanup setHeader()
Several fields on OutgoingMessage were set after instantiation. These
have been included in the constructor to prevent mutation of the object
map after instantiation.

"name" is now explicitly checked to be a string. Where before if a
non-string was passed the following cryptic error was thrown:

    _http_outgoing.js:334
      var key = name.toLowerCase();
                     ^
    TypeError: undefined is not a function

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-09-29 12:32:42 -07:00
Julien Gilli
64d6de9f34 http: write() after end() emits an error.
When calling write() after end() has been called on an OutgoingMessage,
an error is emitted and the write's callback is called with an instance
of Error.

Fix #7477.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-23 11:54:26 +04:00
Timothy J Fontaine
7ca5af87a0 Merge remote-tracking branch 'upstream/v0.10' into v0.12
Conflicts:
	ChangeLog
	deps/v8/src/hydrogen.cc
	lib/http.js
	lib/querystring.js
	src/node_crypto.cc
	src/node_version.h
	test/simple/test-querystring.js
2014-09-16 17:48:09 -07:00
Ben Noordhuis
bd24ab2bd7 http: add request.flush() method
Forcibly flushes the request headers.  You need this with long-lived
HTTP connections where the first data isn't written until the connection
has been established (think: tunneling requests over HTTP CONNECT.)

Fixes #7296.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 10:43:51 +04:00
Yuki KAN
006d42786e lib: use triple equals
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-02 02:12:18 -07:00
Trevor Norris
2eddd74112 http: use writev on chunked encoding
Now will process all write() that were done on a single tick in a single
writev().
2014-01-09 15:07:14 -08:00
James Halliday
5555318bf3 http: removed headers stay removed
This allows automatically-inserted headers to be removed permanently by
calling OutgoingMessage.removeHeader() on them, as if they were normal
headers.
2013-08-19 16:05:44 -07:00
Brian White
6d842897c5 lib: remove unused variables and functions 2013-08-15 17:19:17 -07:00
isaacs
1f9f863494 http: Prefer 'binary' over 'ascii'
It's faster, because it doesn't have to check that each char is in the
ASCII plane.
2013-08-15 15:05:41 -07:00
isaacs
7c9b607048 http: Consistent 'finish' event semantics
In other Writable streams, the 'finish' event means that all of the data
was written, and flushed to the underlying system.

The 'prefinish' event means that end() was called, and all of the data
was processed, but not necessarily completely flushed.

This change brings the http OutgoingMessage classes more in sync with
the other Writable classes throughout Node.

Unfortunately, this change highlights an issue with http
IncomingMessages, where the _dump() method will not actually pull the
data off the wire.  This is a minor issue that is typically only
relevant in test cases, and will be addressed in the next commit.
2013-08-15 15:05:41 -07:00
isaacs
e3157972e1 http: make OutgoingMessage._flush inline-able 2013-08-15 15:05:41 -07:00
isaacs
da93d6adfb http: Add write()/end() callbacks 2013-08-15 15:05:41 -07:00
isaacs
ce3d18412c http: Write hex/base64 chunks properly
This removes a dubious performance "optimization" where strings body
chunks were concatenated to one another (and to the headers) without any
regard for their encoding.
2013-08-15 15:05:40 -07:00
isaacs
22c68fdc1d src: Replace macros with util functions 2013-08-01 15:08:01 -07:00
Ben Noordhuis
0330bdf519 lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
2013-07-24 21:49:35 +02:00
isaacs
831de7cbb9 http: Use OOP for OutgoingMessage._finish
Sniffing instanceof a child class in the parent class's method
is Doing It Wrong.
2013-07-09 22:31:11 -07:00
Peter Rust
82ff891e22 http: use an unref'd timer to fix delay in exit
There was previously up to a second exit delay when exiting node
right after an http request/response, due to the utcDate() function
doing a setTimeout to update the cached date/time.

Fixing this should increase the performance of our http tests.
2013-07-07 21:12:07 -07:00
isaacs
ba048e72b0 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	configure
	deps/uv/ChangeLog
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/v8/src/isolate.cc
	deps/v8/src/version.cc
	lib/http.js
	src/node_version.h
2013-05-27 14:46:52 -07:00
isaacs
ec576235f1 http: Use writev instead of the hacky hot end 2013-05-09 09:35:32 -07:00
Ben Noordhuis
d3ddee61c2 http: forward-port missing bits from 01e2920
Forward-port the comments from commit 01e2920 (v0.10) to the master
branch. Everything else from that patch already exists in master.

It didn't merge cleanly because lib/http.js has been split up in
several files.
2013-04-29 14:12:25 +02:00
Fedor Indutny
df8a4f8f07 http: write buffers when chunked to embrace writev 2013-04-27 21:03:40 +04:00
isaacs
025f9133bb http: Don't try to destroy nonexistent sockets
Fixes #3740

In the case of pipelined requests, you can have a situation where
the socket gets destroyed via one req/res object, but then trying
to destroy *another* req/res on the same socket will cause it to
call undefined.destroy(), since it was already removed from that
message.

Add a guard to OutgoingMessage.destroy and IncomingMessage.destroy
to prevent this error.
2013-04-22 10:38:14 -07:00
Timothy J Fontaine
951e0b69fa http: split Client into _http_client.js 2013-04-17 00:08:28 +02:00
Timothy J Fontaine
6717fdccb4 http: move Server and ServerResponse out 2013-04-17 00:08:28 +02:00
Timothy J Fontaine
dc9f97b7b9 http: move OutgoingMessage into it's own file 2013-04-17 00:08:28 +02:00