Comparing version 0.2.1 to 0.2.2
@@ -87,2 +87,3 @@ /** | ||
} | ||
var timer = null; | ||
var req = request_method(options, function(res) { | ||
@@ -95,2 +96,6 @@ var chunks = [], size = 0; | ||
res.on('end', function() { | ||
if (timer) { | ||
clearTimeout(timer); | ||
timer = null; | ||
} | ||
var data = null; | ||
@@ -112,7 +117,16 @@ switch(chunks.length) { | ||
var timeout = args.timeout; | ||
req.setTimeout(timeout, function() { | ||
timer = setTimeout(function() { | ||
timer = null; | ||
req.__isTimeout = true; | ||
req.abort(); | ||
}); | ||
}, timeout); | ||
// req.setTimeout(timeout, function() { | ||
// req.__isTimeout = true; | ||
// req.abort(); | ||
// }); | ||
req.on('error', function(err) { | ||
if (timer) { | ||
clearTimeout(timer); | ||
timer = null; | ||
} | ||
if (req.__isTimeout) { | ||
@@ -119,0 +133,0 @@ err.name = 'RequestTimeoutError'; |
{ | ||
"name": "urllib", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more. Like python's _urllib_ module.", | ||
@@ -5,0 +5,0 @@ "keywords": ["urllib", "http", "urlopen"], |
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
15487
459