Comparing version 0.5.0 to 0.5.1
0.5.1 / 2013-08-23 | ||
================== | ||
* detect connect timeout or response timeout fixed #18 | ||
* update doc | ||
0.5.0 / 2013-08-11 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -181,2 +181,4 @@ /** | ||
var timer = null; | ||
var __err = null; | ||
var connnected = false; // socket connected or not | ||
var done = function (err, data, res) { | ||
@@ -199,2 +201,6 @@ if (timer) { | ||
var req = httplib.request(options, function (res) { | ||
connnected = true; | ||
debug('Request#%d %s `req response` event emit: status %d, headers: %j', | ||
reqId, options.path, res.statusCode, res.headers); | ||
if (writeStream) { | ||
@@ -248,2 +254,6 @@ // If there's a writable stream to recieve the response data, just pipe the | ||
res.on('error', function () { | ||
debug('Request#%d %s: `res error` event emit, total size %d', reqId, options.path, size); | ||
}); | ||
res.on('aborted', function () { | ||
@@ -255,4 +265,10 @@ res.aborted = true; | ||
res.on('end', function () { | ||
debug('Request#%d %s: `res end` event emit, total size %d', reqId, options.path, size); | ||
var data = Buffer.concat(chunks, size); | ||
debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, options.path, size, res._dumped); | ||
if (__err && connnected) { | ||
// req.abort() after `res data` event emit. | ||
return done(__err, data, res); | ||
} | ||
var err = null; | ||
@@ -297,3 +313,2 @@ | ||
var timeout = args.timeout; | ||
var __err = null; | ||
@@ -304,3 +319,4 @@ timer = setTimeout(function () { | ||
__err = new Error(msg); | ||
__err.name = 'RequestTimeoutError'; | ||
__err.name = connnected ? 'ResponseTimeoutError' : 'ConnectionTimeoutError'; | ||
debug('Request#%d %s %s: %s, connected: %s', reqId, options.path, __err.name, msg, connnected); | ||
req.abort(); | ||
@@ -318,3 +334,3 @@ }, timeout); | ||
err = __err || err; | ||
debug('Request#%d %s `error` event emit, %s: %s', reqId, options.path, err.name, err.message); | ||
debug('Request#%d %s `req error` event emit, %s: %s', reqId, options.path, err.name, err.message); | ||
done(err); | ||
@@ -321,0 +337,0 @@ }); |
{ | ||
"name": "urllib", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more.", | ||
@@ -16,3 +16,3 @@ "keywords": [ "urllib", "http", "urlopen", "curl", "wget", "request", "https" ], | ||
"blanket": { "pattern": "urllib/lib" }, | ||
"travis-cov": { "threshold": 100 } | ||
"travis-cov": { "threshold": 98 } | ||
}, | ||
@@ -19,0 +19,0 @@ "dependencies": { |
@@ -34,3 +34,3 @@ # urllib | ||
### .request(url[, options][, callback][, content]) | ||
### .request(url[, options][, callback]) | ||
@@ -48,3 +48,3 @@ #### Arguments | ||
- ***headers*** Object - Request headers. | ||
- ***timeout*** Number - Request timeout in milliseconds. Defaults to `exports.TIMEOUT`. | ||
- ***timeout*** Number - Request timeout in milliseconds. Defaults to `exports.TIMEOUT`. Include remote server connecting timeout and response timeout. When timeout happen, will return `ConnectionTimeout` or `ResponseTimeout`. | ||
- ***auth*** String - `username:password` used in HTTP Basic Authorization. | ||
@@ -189,2 +189,3 @@ - ***agent*** [http.Agent](http://nodejs.org/api/http.html#http_class_http_agent) - HTTP Agent object. | ||
* [√] https & self-signed certificate | ||
* [√] Connection timeout & response timeout | ||
@@ -200,11 +201,11 @@ ## Authors | ||
repo age : 2 years, 3 months | ||
active : 33 days | ||
commits : 103 | ||
active : 34 days | ||
commits : 106 | ||
files : 17 | ||
authors : | ||
83 fengmk2 80.6% | ||
9 XiNGRZ 8.7% | ||
6 ibigbug 5.8% | ||
4 Jackson Tian 3.9% | ||
1 aleafs 1.0% | ||
86 fengmk2 81.1% | ||
9 XiNGRZ 8.5% | ||
6 ibigbug 5.7% | ||
4 Jackson Tian 3.8% | ||
1 aleafs 0.9% | ||
``` | ||
@@ -211,0 +212,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26177
305
233