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 4ce1e1fca5
.
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
Ryan Dahl
6abdf051d3
Unhandled 'error' events kill program
...
By default 'error' throws. addListener to prevent this.
2010-04-22 17:22:06 -07:00
Ryan Dahl
3934cb5485
Force no body on http 204 and 304
...
Thanks to tjholowayhuk@gmail.com for the test case.
2010-04-21 15:15:21 -07:00
Rhys Jones
8efab857d0
Merge branch 'master' into openssl
2010-04-15 19:57:35 +01:00
Micheil Smith
6ad18a27a0
Fix upgradeHead bounds.
2010-04-15 11:19:54 -07:00
Rhys Jones
d27d6dcc6f
Merge branch 'master' into openssl
2010-04-15 06:21:15 +01:00
Ryan Dahl
760bba5518
Support Upgrade in HTTP messages
...
This allows for web servers to be "hijacked" and used as Web Socket servers
(or other). You simply listen for requests as normal, but check if
req.upgrade === true
If so, this will be the last request of the connection. It's your job now to
hijack req.connection and start reading from it. req.upgradeHead is a buffer
containing the first part of the new protocol communication (in the case it
arrived on the same packet).
This needs tests and documentation. API subject to change.
2010-04-14 03:52:15 -07:00
Rhys Jones
144200435f
Merge branch 'master' into openssl
...
Conflicts:
lib/net.js
wscript
2010-04-14 07:31:33 +01:00
Micheil Smith
57ea07ac91
Moving the http.js, net.js FreeList to being standalone.
2010-04-12 16:57:45 -07:00
Ryan Dahl
b7947e45c0
Recycle http client parsers
2010-04-12 16:34:39 -07:00
Rhys Jones
80174392bb
Moved Credentials into crypto module. Added node_crypto into crypto module
2010-04-12 21:25:16 +01:00
Rhys Jones
45b8d24ea6
Added https server support
2010-04-12 20:36:46 +01:00
Rhys Jones
c9f71a807c
Added https support
2010-04-12 18:57:22 +01:00
Tim Caswell
62d9852c3d
Replace slow and broken for..in loops with faster for loops over the keys.
2010-04-12 10:34:35 -07:00
Ryan Dahl
8553e8a15d
Add incoming.httpVersion
2010-04-11 15:15:36 -07:00
Ryan Dahl
08a09bb50a
Use some more Binary/F methods for Buffer
2010-04-08 16:31:02 -07:00
Ryan Dahl
50c70ac714
Update stream API: forceClose() -> destroy(), close() -> end()
2010-04-08 12:24:29 -07:00
Ryan Dahl
1b758ef268
Allow stream to write on close
2010-04-05 16:50:05 -07:00
Ryan Dahl
53530e981a
Fix test-http-chunked. Need to check for \0 at end of utf8 strings
2010-04-02 14:55:28 -07:00
Ryan Dahl
3546106c43
Add req.connection and res.connection
2010-03-24 07:21:00 -07:00
Ryan Dahl
6f21ac1282
Don't free http parser for the client!
...
Fixes test-http-client-race.js, test-http.js
2010-03-23 21:41:42 -07:00
Ryan Dahl
5c6f063ef2
snake to camel in HTTP
2010-03-23 21:31:44 -07:00
Ryan Dahl
70ffdf5db9
Fix HTTP keep-alive
2010-03-23 21:10:01 -07:00
isaacs
6e603ccbe2
Fix debug statement that was using puts instead of debug()
2010-03-23 08:54:05 -07:00
Ryan Dahl
ebe2721cbf
Don't use sys.debug, it gets preprocessed out
...
Problem introduced in b29f78772e
2010-03-19 21:50:11 -07:00
Ryan Dahl
ac684f3583
Add legacy 'binary' encoding/decoding methods to Buffer
2010-03-19 20:33:09 -07:00
Ryan Dahl
b80f6e9ed1
http2 now default
2010-03-19 19:52:09 -07:00
Ryan Dahl
627fb5adbb
Load c++ modules on demand
2010-03-15 14:24:15 -07:00
Ryan Dahl
4ccdc501d4
Include lib/ directory in node executable. Compile on demand.
...
Instead of installing the files in /usr/lib/node/libraries and loading them
from the file system, the files are built-in to the node executable.
However, they are only compiled on demand.
The reasoning is:
1. Allow for more complex internal javascript. In particular,
process.stdout and process.stdin can be js implemented streams.
2. Ease system installs. Loading from disk each time is unnecessary
overhead. Note that there is no "system" path for modules anymore. Only
$HOME/.node_libraries.
2010-03-15 08:04:35 -07:00
Jed Schmidt
004faf3846
Added check to make sure writeHead() is called before write(), to prevent silent failure.
2010-03-13 22:27:51 -08:00
Ryan Dahl
d1500cee6e
Store connection in OutgoingMessage
2010-03-03 13:06:19 -08:00
Ryan Dahl
9d4d232eaa
Factor out a http.Client._reconnect() function
2010-03-03 12:49:06 -08:00
Ryan Dahl
64d0e328e8
Remove unused EventEmitter object
2010-03-03 12:41:31 -08:00
Ryan Dahl
b021a845f7
Move process.inherits to sys
2010-03-01 11:39:35 -08:00
Benjamin Thomas
b1b84960ce
Rename writeHeader to writeHead
2010-02-25 13:01:21 -08:00
Ryan Dahl
12d78cd1df
Rename sendHeader to writeHeader; allow reasonPhrase
2010-02-21 16:53:49 -08:00
Ryan Dahl
c094dda53c
Move errors for readPause and readResume
2010-02-21 16:01:12 -08:00
Ryan Dahl
d0f2d465aa
http.cat no longer uses Promise
2010-02-19 16:26:48 -08:00
Ryan Dahl
5013bf1781
API: OutgoingMessage.prototype.finish() renamed to close()
2010-02-17 11:10:10 -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
Ryan Dahl
23cf502db7
API: connection.send() renamed to connection.write()
2010-02-16 13:18:42 -08:00
Ryan Dahl
bc17d94a0a
API: tcp events 'receive' to 'data', 'eof' to 'end'
...
No deprecation messages. Not sure how...
2010-02-12 00:25:19 -08:00
Ryan Dahl
1bb52947e0
Forgot to include fix from HTTP client bug ( 30b0522
)
2010-01-27 10:00:46 -08:00
Michaeljohn Clement
4e16e386fe
set default encoding in sendBody
2010-01-19 12:43:19 -08:00
Ryan Dahl
70293a43c9
API: Move Promise and EventEmitter into 'events' module
2010-01-15 12:46:08 -08:00
isaacs
2b3d9e4ad0
Use "url" module instead of "uri" module in http.js.
...
Deprecate the URI module and remove tests for it.
- Rename "uri" to "url".
- Use the "url" module instead of the "uri" module.
- Remove the url parsing from http.js
- Update http.cat with the changed field names.
- Update tests for changes to http.js
- Update documentation for changes in http.js
2010-01-04 21:22:46 -08:00
Michaeljohn Clement
3d24e119e0
don't chunk responses to HTTP/1.0 clients, even if they send Connection: Keep-Alive (e.g. wget)
2009-12-23 22:24:29 +01:00
isaacs
f65b36eec1
Use the new uri parser.
2009-12-18 19:02:16 +01:00
visionmedia
501b4a54be
Export STATUS_CODES
...
Express (my framework) uses them as a default
response body when non is present. Others
might use them for something as well.
Beats duplicating the list :D
2009-12-08 05:35:56 +01:00
Christopher Lenz
f8ba9c3bc9
Add http.Client.prototype.request()
...
Change the http.Client API so that it provides a single request() method
taking an optional parameter to specify the HTTP method (defaulting to
"GET"), instead of the five methods get(), head(), post(), del() and put().
2009-12-06 18:36:32 +01:00
Ryan Dahl
c5d82380f4
Bugfix: Don't use chunked encoding for 1.0 requests.
...
http://groups.google.com/group/nodejs/browse_thread/thread/b2edb76691b1848c
2009-12-05 08:37:46 +01:00
Ryan Dahl
7538e70767
Expose versionMajor versionMinor to http messages
2009-12-05 07:55:24 +01:00
Michaeljohn Clement
485823f3e4
fixed HTTP duplicated header bug
...
added test case for HTTP duplicated header bug on keepalive
2009-12-05 00:56:22 +01:00
Rhys Jones
5b1a535cd8
Add HTTP client TLS support
2009-11-30 16:51:20 +01:00
jed
a9ea21feb4
fixed check on header type, to check member instead of object.
2009-11-30 10:14:09 +01:00
Ryan Dahl
7719ce33db
New http-parser
...
No longer based on Ragel, but hand-written.
Had to add HTTPConnection.resetParser() because the parser is stricter and
will error out when you try to give it a message after the previous had
"Connection: close". The HTTP client was doing that. Thus we reset the
parser manually after each new connection.
2009-11-21 16:27:02 +01:00
Ryan Dahl
1eba0cadc1
Revert "Normalize HTTP headers."
...
This reverts commit f623fd7658
.
But only the changes made in lib/ they were falsely detecting outgoing
headers.
2009-11-21 15:52:12 +01:00
Felix Geisendörfer
bffee5eda4
Bugfix for sendBody() and chunked utf8 strings
...
Http expects chunked byte offsets and ignores the encoding specified in the
header. This patch makes node behave accordingly.
Bug report:
http://groups.google.com/group/nodejs/browse_thread/thread/ab701d49cb059317
2009-11-11 18:53:05 +01:00
Ryan Dahl
43121c15be
API: rename process.inherits to sys.inherits
2009-11-07 14:45:39 +01:00
Ryan Dahl
51c1526b6a
Revert "Upgrade http parser, change node as needed."
...
Something is broken in how keep-alive is working. Reverting until I can fix
it.
This reverts commit b893859c34
.
2009-11-06 12:44:20 +01:00
Ryan Dahl
8ad47c8de7
Expose http.IncomingMessage and http.OutgoingMessage
2009-11-05 00:02:15 +01:00
Ryan Dahl
60131fc88c
Expose http.ClientRequest and http.ServerResponse
2009-11-04 12:37:52 +01:00
Ryan Dahl
7a2e784ad7
Module refactor - almost CommonJS compatible now
...
API change summary:
* require("/sys.js") becomes require("sys")
* require("circle.js") becomes require("./circle")
* process.path.join() becomes require("path").join()
2009-10-31 19:10:30 +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
Ryan Dahl
910c627fc6
Revert "Change HTTP back to a 1.1 client."
...
This reverts commit 9a70abbf13
.
2009-10-28 15:37:58 +01:00
Ryan Dahl
9a70abbf13
Change HTTP back to a 1.1 client.
...
This was modified in b893859c34
even though it
wasn't really required. Some users are experiencing problems after changing
to 1.0 - once those are identified the client will returned to 1.0.
2009-10-26 23:07:37 +01:00
Ryan Dahl
b893859c34
Upgrade http parser, change node as needed.
...
The latest version of http-parser is a bit more stringent EOF semantics.
2009-10-15 19:18:18 +02:00
Ryan Dahl
2b8ab7e24f
utils.js links to sys.js instead of other way around
2009-10-13 19:55:28 +02:00
Ryan Dahl
f623fd7658
Normalize HTTP headers.
...
"Content-Length" becomes "content-length".
2009-10-07 16:56:19 +02:00
Ryan Dahl
522909bcbf
Parse queryString into req.uri.params
2009-10-05 14:52:26 +02:00
Ryan Dahl
e2b7902469
Don't use parseUri for HTTP server
...
The big parseUri RE was showing up often in profiles - this is simpler and
yields better performance by taking advantage of the C http parser.
2009-10-04 12:19:01 +02:00
Ryan Dahl
7b337096c9
Add a third argument to http.cat to specify req headers.
2009-09-30 11:55:03 +02:00
isaacs
45f5402446
Pass the Host header in http.cat calls, if it was specified in the URL passed to http.cat.
2009-09-29 16:38:07 -07:00
Ryan Dahl
cda659a8c8
Camel-case all http events
2009-09-29 18:06:14 +02:00
Ryan Dahl
f6657c3c9d
Move http library to /http.js
2009-09-28 12:36:36 +02:00