0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

22 Commits

Author SHA1 Message Date
Nathan Rajlich
d6bbb19f1d http, https: don't depend on globalAgent
For the `request()` and `get()` functions. I could never
really understand why these two functions go through agent
first... Especially since the user could be passing `agent: false`
or a different Agent instance completely, in which `globalAgent`
will be completely bypassed.

Moved the relevant logic from `Agent#request()` into the
`ClientRequest` constructor.

Incidentally, this commit fixes #7012 (which was the original
intent of this commit).
2014-02-26 13:18:54 -08:00
Trevor Norris
828f14556e src: revert domain using AsyncListeners
This is a slightly modified revert of bc39bdd.

Getting domains to use AsyncListeners became too much of a challenge
with many edge cases. While this is still a goal, it will have to be
deferred for now until more test coverage can be provided.
2014-01-09 13:25:20 -08:00
Lalit Kapoor
aef09601b4 http: DELETE shouldn't default to chunked encoding 2013-12-06 16:25:42 -08:00
Fedor Indutny
5ce4eed54d http: fix parser double-free in _http_client.js
HTTP Parser instance was freed twice, leading to the reusal of it
in several different requests simultaneously.

The flow:

`socketCloseListener` is firing, which calls `socket.read()` to flush
any queued data, `socket.buffer` has data which emits and fires
`socketOnData` in sync, this triggers a parser error which frees the
parser, `socketCloseListener` resumes execution only to have the wrong
parser associated with the socket.

The fix is to only cache the parser after the flushing from the socket,
and to assert in `socketOnData` that `socket === parser.socket`

fix #6451
2013-11-27 15:37:56 -08:00
Trevor Norris
bc39bdd995 domain: use AsyncListener API
The domain module has been switched over to use the domain module API as
much as currently possible. There are still some hooks in the
EventEmitter, but hopefully we can remove those in the future.
2013-10-31 16:34:35 -07:00
isaacs
f153d6da45 http client: pull last chunk on socket close
When the socket closes, the client's http incoming message object was
emitting an 'aborted' event if it had not yet been ended.

However, it's possible, when a response is being repeatedly paused and
resumed (eg, if piped to a slow FS write stream), that there will be a
final chunk remaining in the js-land buffer when the socket is torn
down.

When that happens, the socketCloseListener function detects that we have
not yet reached the end of the response message data, and treats this as
an abrupt abort, immediately (and forcibly) ending the incoming message
data stream, and discarding that final chunk of data.

The result is that, for example, npm will have problems because tarballs
are missing a few bytes off the end, every time.

Closes GH-6402
2013-10-23 13:39:05 -07:00
isaacs
15a5a4a945 http: Only send connection:keep-alive if necessary
In cases where the Agent has maxSockets=Infinity, and
keepAlive=false, there's no case where we won't immediately close the
connection after the response is completed.

Since we're going to close it anyway, send a `connection:close` header
rather than a `connection:keep-alive` header.  Still send the
`connection:keep-alive` if the agent will actually reuse the socket,
however.

Closes #5838
2013-09-04 11:19:39 -07:00
Brian White
6d842897c5 lib: remove unused variables and functions 2013-08-15 17:19:17 -07:00
isaacs
967b5dbb45 http: Use streams3 directly, not .ondata/end 2013-08-08 13:01:09 -07:00
Koichi Kobayashi
72ad2c94df https: fix default port
https.get('https://github.com/') should use port 443, not 80.
2013-08-05 12:53:12 -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
Timothy J Fontaine
c898704db1 lint: fix _http_client.js after v0.10 merge 2013-07-12 15:18:53 -07:00
Timothy J Fontaine
48c542db52 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/npm/Makefile
	deps/npm/doc/api/npm-commands.md
	deps/npm/doc/api/npm-deprecate.md
	deps/npm/doc/api/npm-init.md
	deps/npm/doc/api/npm-owner.md
	deps/npm/doc/api/npm-publish.md
	deps/npm/doc/api/npm-run-script.md
	deps/npm/doc/cli/npm-adduser.md
	deps/npm/doc/cli/npm-bin.md
	deps/npm/doc/cli/npm-bugs.md
	deps/npm/doc/cli/npm-build.md
	deps/npm/doc/cli/npm-cache.md
	deps/npm/doc/cli/npm-completion.md
	deps/npm/doc/cli/npm-deprecate.md
	deps/npm/doc/cli/npm-docs.md
	deps/npm/doc/cli/npm-edit.md
	deps/npm/doc/cli/npm-explore.md
	deps/npm/doc/cli/npm-help-search.md
	deps/npm/doc/cli/npm-help.md
	deps/npm/doc/cli/npm-init.md
	deps/npm/doc/cli/npm-install.md
	deps/npm/doc/cli/npm-link.md
	deps/npm/doc/cli/npm-ls.md
	deps/npm/doc/cli/npm-outdated.md
	deps/npm/doc/cli/npm-owner.md
	deps/npm/doc/cli/npm-pack.md
	deps/npm/doc/cli/npm-prefix.md
	deps/npm/doc/cli/npm-prune.md
	deps/npm/doc/cli/npm-publish.md
	deps/npm/doc/cli/npm-restart.md
	deps/npm/doc/cli/npm-rm.md
	deps/npm/doc/cli/npm-root.md
	deps/npm/doc/cli/npm-run-script.md
	deps/npm/doc/cli/npm-search.md
	deps/npm/doc/cli/npm-shrinkwrap.md
	deps/npm/doc/cli/npm-start.md
	deps/npm/doc/cli/npm-stop.md
	deps/npm/doc/cli/npm-submodule.md
	deps/npm/doc/cli/npm-tag.md
	deps/npm/doc/cli/npm-test.md
	deps/npm/doc/cli/npm-uninstall.md
	deps/npm/doc/cli/npm-unpublish.md
	deps/npm/doc/cli/npm-update.md
	deps/npm/doc/cli/npm-version.md
	deps/npm/doc/cli/npm-view.md
	deps/npm/doc/cli/npm-whoami.md
	deps/npm/doc/files/npm-folders.md
	deps/npm/doc/files/package.json.md
	deps/npm/doc/misc/npm-coding-style.md
	deps/npm/doc/misc/npm-config.md
	deps/npm/doc/misc/npm-developers.md
	deps/npm/doc/misc/npm-disputes.md
	deps/npm/doc/misc/npm-faq.md
	deps/npm/doc/misc/npm-registry.md
	deps/npm/doc/misc/npm-scripts.md
	deps/npm/doc/misc/semver.md
	deps/npm/html/doc/README.html
	deps/npm/html/doc/api/npm-bin.html
	deps/npm/html/doc/api/npm-bugs.html
	deps/npm/html/doc/api/npm-commands.html
	deps/npm/html/doc/api/npm-config.html
	deps/npm/html/doc/api/npm-deprecate.html
	deps/npm/html/doc/api/npm-docs.html
	deps/npm/html/doc/api/npm-edit.html
	deps/npm/html/doc/api/npm-explore.html
	deps/npm/html/doc/api/npm-help-search.html
	deps/npm/html/doc/api/npm-init.html
	deps/npm/html/doc/api/npm-install.html
	deps/npm/html/doc/api/npm-link.html
	deps/npm/html/doc/api/npm-load.html
	deps/npm/html/doc/api/npm-ls.html
	deps/npm/html/doc/api/npm-outdated.html
	deps/npm/html/doc/api/npm-owner.html
	deps/npm/html/doc/api/npm-pack.html
	deps/npm/html/doc/api/npm-prefix.html
	deps/npm/html/doc/api/npm-prune.html
	deps/npm/html/doc/api/npm-publish.html
	deps/npm/html/doc/api/npm-rebuild.html
	deps/npm/html/doc/api/npm-restart.html
	deps/npm/html/doc/api/npm-root.html
	deps/npm/html/doc/api/npm-run-script.html
	deps/npm/html/doc/api/npm-search.html
	deps/npm/html/doc/api/npm-shrinkwrap.html
	deps/npm/html/doc/api/npm-start.html
	deps/npm/html/doc/api/npm-stop.html
	deps/npm/html/doc/api/npm-submodule.html
	deps/npm/html/doc/api/npm-tag.html
	deps/npm/html/doc/api/npm-test.html
	deps/npm/html/doc/api/npm-uninstall.html
	deps/npm/html/doc/api/npm-unpublish.html
	deps/npm/html/doc/api/npm-update.html
	deps/npm/html/doc/api/npm-version.html
	deps/npm/html/doc/api/npm-view.html
	deps/npm/html/doc/api/npm-whoami.html
	deps/npm/html/doc/api/npm.html
	deps/npm/html/doc/cli/npm-adduser.html
	deps/npm/html/doc/cli/npm-bin.html
	deps/npm/html/doc/cli/npm-bugs.html
	deps/npm/html/doc/cli/npm-build.html
	deps/npm/html/doc/cli/npm-bundle.html
	deps/npm/html/doc/cli/npm-cache.html
	deps/npm/html/doc/cli/npm-completion.html
	deps/npm/html/doc/cli/npm-config.html
	deps/npm/html/doc/cli/npm-dedupe.html
	deps/npm/html/doc/cli/npm-deprecate.html
	deps/npm/html/doc/cli/npm-docs.html
	deps/npm/html/doc/cli/npm-edit.html
	deps/npm/html/doc/cli/npm-explore.html
	deps/npm/html/doc/cli/npm-help-search.html
	deps/npm/html/doc/cli/npm-help.html
	deps/npm/html/doc/cli/npm-init.html
	deps/npm/html/doc/cli/npm-install.html
	deps/npm/html/doc/cli/npm-link.html
	deps/npm/html/doc/cli/npm-ls.html
	deps/npm/html/doc/cli/npm-outdated.html
	deps/npm/html/doc/cli/npm-owner.html
	deps/npm/html/doc/cli/npm-pack.html
	deps/npm/html/doc/cli/npm-prefix.html
	deps/npm/html/doc/cli/npm-prune.html
	deps/npm/html/doc/cli/npm-publish.html
	deps/npm/html/doc/cli/npm-rebuild.html
	deps/npm/html/doc/cli/npm-restart.html
	deps/npm/html/doc/cli/npm-rm.html
	deps/npm/html/doc/cli/npm-root.html
	deps/npm/html/doc/cli/npm-run-script.html
	deps/npm/html/doc/cli/npm-search.html
	deps/npm/html/doc/cli/npm-shrinkwrap.html
	deps/npm/html/doc/cli/npm-star.html
	deps/npm/html/doc/cli/npm-stars.html
	deps/npm/html/doc/cli/npm-start.html
	deps/npm/html/doc/cli/npm-stop.html
	deps/npm/html/doc/cli/npm-submodule.html
	deps/npm/html/doc/cli/npm-tag.html
	deps/npm/html/doc/cli/npm-test.html
	deps/npm/html/doc/cli/npm-uninstall.html
	deps/npm/html/doc/cli/npm-unpublish.html
	deps/npm/html/doc/cli/npm-update.html
	deps/npm/html/doc/cli/npm-version.html
	deps/npm/html/doc/cli/npm-view.html
	deps/npm/html/doc/cli/npm-whoami.html
	deps/npm/html/doc/cli/npm.html
	deps/npm/html/doc/files/npm-folders.html
	deps/npm/html/doc/files/npm-global.html
	deps/npm/html/doc/files/npm-json.html
	deps/npm/html/doc/files/npmrc.html
	deps/npm/html/doc/files/package.json.html
	deps/npm/html/doc/index.html
	deps/npm/html/doc/misc/npm-coding-style.html
	deps/npm/html/doc/misc/npm-config.html
	deps/npm/html/doc/misc/npm-developers.html
	deps/npm/html/doc/misc/npm-disputes.html
	deps/npm/html/doc/misc/npm-faq.html
	deps/npm/html/doc/misc/npm-index.html
	deps/npm/html/doc/misc/npm-registry.html
	deps/npm/html/doc/misc/npm-scripts.html
	deps/npm/html/doc/misc/removing-npm.html
	deps/npm/html/doc/misc/semver.html
	deps/npm/man/man1/npm-README.1
	deps/npm/man/man1/npm-adduser.1
	deps/npm/man/man1/npm-bin.1
	deps/npm/man/man1/npm-bugs.1
	deps/npm/man/man1/npm-build.1
	deps/npm/man/man1/npm-bundle.1
	deps/npm/man/man1/npm-cache.1
	deps/npm/man/man1/npm-completion.1
	deps/npm/man/man1/npm-dedupe.1
	deps/npm/man/man1/npm-deprecate.1
	deps/npm/man/man1/npm-docs.1
	deps/npm/man/man1/npm-edit.1
	deps/npm/man/man1/npm-explore.1
	deps/npm/man/man1/npm-help-search.1
	deps/npm/man/man1/npm-help.1
	deps/npm/man/man1/npm-init.1
	deps/npm/man/man1/npm-install.1
	deps/npm/man/man1/npm-link.1
	deps/npm/man/man1/npm-ls.1
	deps/npm/man/man1/npm-outdated.1
	deps/npm/man/man1/npm-owner.1
	deps/npm/man/man1/npm-pack.1
	deps/npm/man/man1/npm-prefix.1
	deps/npm/man/man1/npm-prune.1
	deps/npm/man/man1/npm-publish.1
	deps/npm/man/man1/npm-rebuild.1
	deps/npm/man/man1/npm-restart.1
	deps/npm/man/man1/npm-rm.1
	deps/npm/man/man1/npm-root.1
	deps/npm/man/man1/npm-run-script.1
	deps/npm/man/man1/npm-search.1
	deps/npm/man/man1/npm-shrinkwrap.1
	deps/npm/man/man1/npm-star.1
	deps/npm/man/man1/npm-stars.1
	deps/npm/man/man1/npm-start.1
	deps/npm/man/man1/npm-stop.1
	deps/npm/man/man1/npm-submodule.1
	deps/npm/man/man1/npm-tag.1
	deps/npm/man/man1/npm-test.1
	deps/npm/man/man1/npm-uninstall.1
	deps/npm/man/man1/npm-unpublish.1
	deps/npm/man/man1/npm-update.1
	deps/npm/man/man1/npm-version.1
	deps/npm/man/man1/npm-view.1
	deps/npm/man/man1/npm-whoami.1
	deps/npm/man/man1/npm.1
	deps/npm/man/man3/npm-bin.3
	deps/npm/man/man3/npm-bugs.3
	deps/npm/man/man3/npm-commands.3
	deps/npm/man/man3/npm-config.3
	deps/npm/man/man3/npm-deprecate.3
	deps/npm/man/man3/npm-docs.3
	deps/npm/man/man3/npm-edit.3
	deps/npm/man/man3/npm-explore.3
	deps/npm/man/man3/npm-help-search.3
	deps/npm/man/man3/npm-init.3
	deps/npm/man/man3/npm-install.3
	deps/npm/man/man3/npm-link.3
	deps/npm/man/man3/npm-load.3
	deps/npm/man/man3/npm-ls.3
	deps/npm/man/man3/npm-outdated.3
	deps/npm/man/man3/npm-owner.3
	deps/npm/man/man3/npm-pack.3
	deps/npm/man/man3/npm-prefix.3
	deps/npm/man/man3/npm-prune.3
	deps/npm/man/man3/npm-publish.3
	deps/npm/man/man3/npm-rebuild.3
	deps/npm/man/man3/npm-restart.3
	deps/npm/man/man3/npm-root.3
	deps/npm/man/man3/npm-run-script.3
	deps/npm/man/man3/npm-search.3
	deps/npm/man/man3/npm-shrinkwrap.3
	deps/npm/man/man3/npm-start.3
	deps/npm/man/man3/npm-stop.3
	deps/npm/man/man3/npm-submodule.3
	deps/npm/man/man3/npm-tag.3
	deps/npm/man/man3/npm-test.3
	deps/npm/man/man3/npm-uninstall.3
	deps/npm/man/man3/npm-unpublish.3
	deps/npm/man/man3/npm-update.3
	deps/npm/man/man3/npm-version.3
	deps/npm/man/man3/npm-view.3
	deps/npm/man/man3/npm-whoami.3
	deps/npm/man/man3/npm.3
	deps/npm/man/man5/npm-folders.5
	deps/npm/man/man5/npm-global.5
	deps/npm/man/man5/npm-json.5
	deps/npm/man/man7/npm-coding-style.7
	deps/npm/man/man7/npm-config.7
	deps/npm/man/man7/npm-developers.7
	deps/npm/man/man7/npm-disputes.7
	deps/npm/man/man7/npm-faq.7
	deps/npm/man/man7/npm-registry.7
	deps/npm/man/man7/npm-scripts.7
	deps/npm/man/man7/removing-npm.7
	deps/npm/man/man7/semver.7
	deps/npm/package.json
	deps/uv/AUTHORS
	deps/uv/ChangeLog
	deps/uv/src/version.c
	deps/uv/test/test-fs.c
	deps/uv/test/test-list.h
	lib/http.js
	lib/tls.js
	src/node_version.h
2013-07-12 13:26:56 -07: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
isaacs
49519f1217 http: Reuse more http/https Agent code 2013-07-09 22:31:11 -07:00
Trevor Norris
278183a902 {stream,udp,tls}_wrap: remove unused offset/length
The function arguments offset and length are now no longer used since
all I/O requests now use discretely allocated memory.
2013-07-03 15:03:41 -07:00
isaacs
adf9b67e59 Merge remote-tracking branch 'ry/v0.10' into master
Conflicts:
	ChangeLog
	deps/uv/ChangeLog
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/v8/build/common.gypi
	deps/v8/src/frames.h
	deps/v8/src/runtime.cc
	deps/v8/test/mjsunit/debug-set-variable-value.js
	lib/http.js
	src/node_version.h
2013-06-25 11:12:33 -07:00
Fedor Indutny
dc50f27d52 tls: share socket._hadError with http_client 2013-06-16 09:30:15 +02: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
896b2aa707 util: Add debuglog, deprecate console lookalikes 2013-05-21 16:39:50 -07:00
Timothy J Fontaine
951e0b69fa http: split Client into _http_client.js 2013-04-17 00:08:28 +02:00