Commit Graph

21 Commits (1d79f572f170de918a186db7036290975ffb1bfc)

Author SHA1 Message Date
fengmk2 7956a13dad http: logically respect maxSockets
Allows the number of pooled free sockets to equal maxSockets.
Previously it would only allow maxSockets - 1.

PR-URL: https://github.com/iojs/io.js/pull/1242
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
2015-04-17 12:20:44 -04:00
skenqbx 8453fbc879 https: don't overwrite servername option
PR-URL: https://github.com/iojs/io.js/pull/1110
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-03-10 23:28:04 -07: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
Majid Arif Siddiqui 176f0bd3df lib: improved forEach object performance
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-09-05 09:19:32 -07:00
Nathan Rajlich f3189ace6b http: remove the circular dependency
Between `ClientRequest` and `Agent`. The circular require was doing
weird things at load time, like making the `globalAgent` property
be `undefined` from within the context of the "_http_client"
module.

Removing the circular dependency completely fixes this.

This commit effectively removes the undocumented `Agent#request()`
and `Agent#get()` functions.
2014-02-26 13:19:36 -08:00
isaacs ea8feced87 http: force socket encoding to be null
Otherwise the string triggers an assertion error in node_http_parser.c,
line 370:

    assert(Buffer::HasInstance(args[0]) == true);

because the first argument is not a Buffer object.
2013-11-07 08:24:50 -08:00
fengmk2 1ce5db4d95 http: cleanup freeSockets when socket destroyed
If the socket was destroyed, we need to remove it from the agent's
`freeSockets` list, otherwise dead socket could be reused by new
request.
2013-11-07 11:42:41 +04:00
Nathan Rajlich f31037ddfe http: don't pass the request options to Agent
The `options` that were being passed in before here are specific to a
single request, which kinda defeats the purpose of using an Agent in the
first place.

On a worse note, these `options` have not yet been "processed" by the
`http.ClientRequest` class, so if `port: null` is set (like it is as the
result of a `url.parse()` call), then they take preference over the
processed values since the agent's "options" get mixed in last in the
`createSocket()` function.

Fixes #6197.
Fixes #6199.
Closes #6231.
2013-09-14 12:29:48 -07:00
Brian White 6d842897c5 lib: remove unused variables and functions 2013-08-15 17:19:17 -07:00
isaacs 65f6f06a61 http: add agent.maxFreeSockets option 2013-08-15 13:54:28 -07:00
isaacs 12cd13312b http: Support legacy agent.addRequest API
There are some agent subclasses using this today.

Despite the addRequest function being undocumented internal API, it's
easy enough to just support the old signature for backwards
compatibility.
2013-08-07 10:29:15 -07:00
isaacs 32fdae2ca3 http: Fix overlooked agent.globalAgent export
Noticed by @bnoordhuis in https://github.com/joyent/node/pull/5991#discussion_r5575946
2013-08-05 12:33:19 -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 49519f1217 http: Reuse more http/https Agent code 2013-07-09 22:31:11 -07:00
isaacs 40e92650bb http: Add agent.get/request methods 2013-07-09 22:31:11 -07:00
isaacs 9fc9b87472 http: Proper KeepAlive behavior
Instead of destroying sockets when there are no pending requests, put
them in a freeSockets list, and unref() them so that they do not keep
the event loop open.

Also, set the default max sockets to Infinity, to prevent the awful
surprising deadlocks that happen when more connections are made.
2013-07-09 22:31:11 -07:00
isaacs 6176e49181 http: style 2013-07-09 22:31:11 -07:00
Timothy J Fontaine 62e4f89765 http: split Agent into its own file 2013-04-17 00:08:28 +02:00