Comparing version 0.3.7 to 0.3.8
0.3.8 / 2013-08-02 | ||
================== | ||
* add debug log | ||
0.3.7 / 2013-07-11 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -12,2 +12,3 @@ /** | ||
var fs = require('fs'); | ||
var debug = require('debug')('urllib'); | ||
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../', 'package.json'))); | ||
@@ -32,2 +33,3 @@ | ||
var REQUEST_ID = 0; | ||
@@ -151,2 +153,3 @@ /** | ||
var reqId = ++REQUEST_ID; | ||
// make request | ||
@@ -193,2 +196,3 @@ var req = httplib.request(options, function (res) { | ||
res.on('data', function (chunk) { | ||
debug('Request#%d %s: `data` event emit, size %d', reqId, options.path, chunk.length); | ||
size += chunk.length; | ||
@@ -198,3 +202,8 @@ chunks.push(chunk); | ||
res.on('close', function () { | ||
debug('Request#%d %s: `close` event emit, total size %d', reqId, options.path, size); | ||
}); | ||
res.on('end', function () { | ||
debug('Request#%d %s: `end` event emit, total size %d', reqId, options.path, size); | ||
var data = Buffer.concat(chunks, size); | ||
@@ -218,3 +227,4 @@ var err = null; | ||
timer = null; | ||
__err = new Error('Request timeout for ' + timeout + 'ms.'); | ||
var msg = 'Request#' + reqId + ' timeout for ' + timeout + 'ms'; | ||
__err = new Error(msg); | ||
__err.name = 'RequestTimeoutError'; | ||
@@ -228,3 +238,5 @@ req.abort(); | ||
} | ||
done(__err || err); | ||
err = __err || err; | ||
debug('Request#%d %s %s: %s', reqId, options.path, err.name, err.message); | ||
done(err); | ||
}); | ||
@@ -249,3 +261,4 @@ | ||
req.requestId = reqId; | ||
return req; | ||
}; |
{ | ||
"name": "urllib", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more.", | ||
@@ -19,3 +19,4 @@ "keywords": [ "urllib", "http", "urlopen", "curl", "wget" ], | ||
"dependencies": { | ||
"buffer-concat": "0.0.1" | ||
"buffer-concat": "0.0.1", | ||
"debug": "0.7.2" | ||
}, | ||
@@ -22,0 +23,0 @@ "devDependencies": { |
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
18478
225
2
+ Addeddebug@0.7.2
+ Addeddebug@0.7.2(transitive)