Commit Graph

250 Commits

Author SHA1 Message Date
Ryan Dahl
85bc8d02fa Merge branch 'v0.4'
Conflicts:
	src/node_crypto.cc
2011-05-16 19:29:02 -07:00
Felix Geisendörfer
e7ac6d8fcd Error argument for http.ServerRequest 'close'
Problem: It was not possible to detect the reason for a premature
connection termination in http requests.

This patch provides a new `err` argument to the 'close' event which
can be inspected to differentiate between a timeout and a client
actively terminating the connection.

Also contains tests for this new behavior for http and https.
2011-05-14 14:15:31 -07:00
isaacs
205b9beb6b Merge branch 'v0.4'
Conflicts:
	lib/tls.js
	lib/url.js
	src/node_version.h
	test/simple/test-buffer.js
	test/simple/test-url.js
2011-05-07 20:38:32 -07:00
Ryan Dahl
110f06578d Agent socket errors bubble up to req only if req exists
Fixes #836.
2011-05-07 12:30:58 -07:00
Mark Cavage
a2328dc73c Add support for Unix Domain Sockets to HTTP
fixes #979.
2011-04-25 16:52:31 -07:00
Ryan Dahl
598792ba91 Merge branch 'v0.4'
Conflicts:
	src/platform_sunos.cc
	test/simple/test-os.js
2011-04-14 01:11:21 +00:00
Abe Fettig
83727a4c86 Fix bug where http response.readable was never set to false
Closes GH-867.
2011-04-12 14:55:18 -07:00
Ryan Dahl
9ccf0e527f Don't error on ENOTCONN from shutdown() 2011-04-11 15:33:24 -07:00
Ryan Dahl
bfa9db9dd6 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
	test/simple/test-buffer.js
2011-04-03 23:42:56 -07:00
isaacs
6d85da185c Closes GH-721 Set default host header properly
However, this test is failing for some quite unrelated issue.
Getting some odd "socket hangup" crashes, and only the first request
ever makes it to the server.
2011-04-01 17:40:41 -07:00
Ryan Dahl
602a4637bf Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-18 11:11:43 -07:00
Ryan Dahl
66570c1964 Fix double free of parser on error in http.Agent.
Thanks to Stéphan Kochen for the fix and Maurice Fonk for reproducing the
bug.

Closes GH-784.
Closes GH-803.
2011-03-18 10:42:43 -07:00
Ryan Dahl
247d880113 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-14 17:45:15 -07:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
36e75b7351 Fix HTTP agent disconnection problem
https://groups.google.com/forum/#!topic/nodejs-dev/V5fB69hFa9o

Closes GH-787.
2011-03-14 14:47:41 -07:00
Ryan Dahl
8838e14ac0 Merge branch 'v0.4' 2011-02-25 16:48:48 -08:00
Russell Haering
7276ff9822 http: fix missing 'drain' events 2011-02-24 17:39:59 -08:00
Ryan Dahl
ea9f5b110a Add 'close' and 'aborted' events to Agent responses
Closes GH-722.
2011-02-24 17:16:13 -08:00
Ryan Dahl
360885a7e9 deprecate http.cat 2011-02-24 17:06:46 -08:00
Felix Geisendörfer
f423ec90fc In addition to 'aborted' emit 'close' from incoming requests
Closes GH-160.
2011-02-24 12:41:51 -08:00
Ryan Dahl
5287703cce Pragma HTTP header comma separation
Closes GH-715, GH-716.
2011-02-24 12:02:22 -08:00
Ryan Dahl
c2a62951f6 TLS sockets should not be writable after 'end'
Closes GH-694.
2011-02-19 18:25:15 -08:00
Ryan Dahl
aac5cbe025 HTTP Agent sockets should not reconnect on error
Closes GH-684.
2011-02-18 10:40:09 -08:00
Ryan Dahl
9b0c7618c5 HTTP Agent should not die on evil server
Closes GH-680.
2011-02-18 00:42:07 -08:00
Ryan Dahl
c365f56061 https was missing 'end' event sometimes
Closes GH-671.
2011-02-15 17:13:53 -08:00
Ryan Dahl
77ae87d367 default to port 80 for http.request 2011-02-15 12:08:26 -08:00
Richard Rodger
b11d78b386 Fix for DNS fail in HTTP request
Closes GH-653.
2011-02-14 16:36:23 -08:00
Tj Holowaychuk
fe838611f6 Fixed field merging with progressive fields on writeHead() 2011-02-14 13:40:31 -08:00
Tim Caswell
b09c5889be Add support for mutable/implicit headers for http.
This works for both ServerResponse and ClientRequest.
Adds three new methods as a couple properties to to OutgoingMessage objects.
Tests by Charlie Robbins.

Change-Id: Ib6f3829798e8f11dd2b6136e61df254f1564807e
2011-02-10 02:31:41 -08:00
Ryan Dahl
e9257b859d New DTrace probes from CA team 2011-02-09 18:50:26 -08:00
Russell Haering
e6ede31554 http: fix buffer writes to outgoing messages 2011-02-07 12:59:25 -08:00
Mikeal Rogers
2b03ba5917 http: agent takes options instead of host, port pair 2011-02-05 02:35:44 -08:00
Ryan Dahl
4733d0b1f0 http: handle aborts 2011-02-04 18:07:00 -08:00
Ryan Dahl
bfb6a67d60 Another fix for process.assert 2011-01-27 16:59:28 -08:00
Ali Farhadi
36ef5643c3 Fixing bug in http request default encoding. 2011-01-26 12:18:25 -08:00
Ryan Dahl
39ff40e5a2 Use old http.Client
This is meant as a path for upgrading to the new http.request() API.
http.Client will be disappearing in the future.
2011-01-25 12:13:20 -08:00
Ryan Dahl
068b733583 Land Cantrill's DTrace patch
only works on solaris
2011-01-24 18:59:06 -08:00
Ryan Dahl
9e976abad9 lint 2011-01-24 10:55:30 -08:00
Ali Farhadi
d81afcb3a6 Fixing bug in http request's end method. 2011-01-23 15:22:42 -08:00
Mikeal Rogers
8d37f80f4b Expose agent in http and https client. 2011-01-23 12:02:43 -08:00
Ryan Dahl
76afea90cf Fix test-http-exceptions
Agent: Each time an http req is sent to a socket, _cycle to try to dispatch
another. Problem became apparent in 4612b0 when we wait for connecting
sockets.
2011-01-21 17:49:01 -08:00
Ryan Dahl
4612b07604 Fix test-http-allow-req-after-204-res
Agent queue waits for connecting sockets.
2011-01-21 17:39:48 -08:00
Ryan Dahl
68f2aa2715 http: agent should cycle on close 2011-01-21 14:55:29 -08:00
Ryan Dahl
b9574b995f Expose http.getAgent 2011-01-21 13:47:27 -08:00
Ryan Dahl
e65f6b4ce1 Initial pass at https client 2011-01-21 13:13:02 -08:00
Ryan Dahl
0866ecaf3f ... 2011-01-20 18:10:15 -08:00
Ryan Dahl
f465949516 hacky work around socket hangups on http requests 2011-01-20 18:10:15 -08:00
Ryan Dahl
d89454e5d4 Backport client 'upgrade' events 2011-01-20 18:10:15 -08:00
Ryan Dahl
4125822bed all errors go to req object 2011-01-20 18:10:15 -08:00
Ryan Dahl
105c35b9fd http.Client shims 2011-01-20 18:10:15 -08:00
Ryan Dahl
e576d4ec79 Add parser to agent 2011-01-20 18:10:15 -08:00
Ryan Dahl
60aea96f84 first pass at http refactor for TLS 2011-01-20 18:10:15 -08:00
Ryan Dahl
2957382991 Implement new stream method, destroySoon
Still missing on fs.WriteStream
2011-01-04 11:22:19 -08:00
Ryan Dahl
73f4ec51fd hack for ending https connections 2011-01-04 10:36:05 -08:00
Ryan Dahl
94f8368cf9 First pass at new https server 2011-01-03 15:51:05 -08:00
Ryan Dahl
e4dd5cd6fd NODE_DEBUG uses strings instead of bitflags 2011-01-03 15:41:58 -08:00
Ryan Dahl
a0159b4b29 Fix global leaks 2010-12-04 15:58:50 -08:00
Ryan Dahl
e232f6e735 more lint 2010-12-01 20:28:28 -08:00
Ryan Dahl
735b9d50a3 Simplify state transitions in http.Client
Fixes new bug shown in test-http-allow-req-after-204-res.js pointed out by
Tom Carden <tom.carden@gmail.com>.
2010-11-29 14:21:51 -08:00
Ryan Dahl
6057747e9e Improve HTTP debug messages 2010-11-29 13:53:35 -08:00
Ryan Dahl
1db59afb75 style 2010-11-29 08:57:40 -08:00
Ryan Dahl
2320497992 Revert "Merge branch 'writev'"
This reverts commit cd9515efd9, reversing
changes made to df46c8e698.

Too slow. Needs more work.
2010-11-20 20:55:15 -08:00
Ryan Dahl
e1250a3333 Reset _eof on socket reuse 2010-11-18 16:47:37 -08:00
Ryan Dahl
dcc547d798 Dumper net.js integration 2010-11-18 16:47:37 -08:00
Ryan Dahl
df46c8e698 Rip out the old TLS implementation 2010-11-18 16:46:37 -08:00
Ryan Dahl
72aee8216c Fix permissions on http.js 2010-10-26 11:31:01 -07:00
Ryan Dahl
2470d2ee92 allowHalfOpen disabled by default
Users too often would forget to add

  socket.on('end', function () {
    socket.end();
  });

Which is a mistake. Therefore we default to this behavior and
only optionally let people handle the 'end' case themselves.
2010-10-26 01:10:18 -07:00
Mark Nottingham
b14eeb3c1e Fix expect/continue keepalive 2010-10-18 15:38:46 -07:00
Ryan Dahl
8139bb24c1 Add destroy methods to HTTP messages
needs tests (particularly for pipeline situations)
2010-10-11 16:36:14 -07:00
Micheil Smith
0e1a581916 Removed deprecated methods from lib/http.js 2010-10-11 16:20:08 -07:00
Ryan Dahl
7e24a05cba Fix test-http-buffer-sanity 2010-10-11 16:00:36 -07:00
Micheil Smith
e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Ryan Dahl
2944e03a03 Closer to a working pipe 2010-10-11 01:22:38 -07:00
Micheil Smith
1af52d28ca Changing http.js to use the same stream.Stream creation as net.js 2010-10-10 19:43:21 -07:00
Ryan Dahl
bc695475b9 Add Stream base class with stream.pipe 2010-10-10 17:27:03 -07:00
Ryan Dahl
0003c701bc expose parsers freelist 2010-10-07 16:17:06 -07:00
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