urllib 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 2.11.1 / 2016-08-04
3
+ ==================
4
+
5
+ * fix: catch http.request sync error (#199)
6
+
2
7
  2.11.0 / 2016-06-26
3
8
  ==================
4
9
 
package/lib/urllib.js CHANGED
@@ -480,7 +480,7 @@ exports.requestWithCallback = function (url, args, callback) {
480
480
 
481
481
  args.requestUrls.push(url);
482
482
 
483
- var req = httplib.request(options, function (res) {
483
+ function onResponse(res) {
484
484
  debug('Request#%d %s `req response` event emit: status %d, headers: %j',
485
485
  reqId, url, res.statusCode, res.headers);
486
486
 
@@ -628,7 +628,15 @@ exports.requestWithCallback = function (url, args, callback) {
628
628
  done(err, data, res);
629
629
  });
630
630
  });
631
- });
631
+ }
632
+
633
+ var req;
634
+ // request headers checker will throw error
635
+ try {
636
+ req = httplib.request(options, onResponse);
637
+ } catch (err) {
638
+ return done(err);
639
+ }
632
640
 
633
641
  var abortRequest = function () {
634
642
  debug('Request#%d %s abort, connected: %s', reqId, url, connected);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urllib",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "Help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more.",
5
5
  "keywords": [
6
6
  "urllib",
@@ -22,8 +22,8 @@
22
22
  "url": "git://github.com/node-modules/urllib.git"
23
23
  },
24
24
  "scripts": {
25
- "test": "mocha -R spec -t 30000 -r should -r should-http test/*.test.js",
26
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -t 30000 -r should -r should-http test/*.test.js",
25
+ "test": "mocha -R spec -t 30000 -r should -r should-http -r intelli-espower-loader test/*.test.js",
26
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -t 30000 -r should -r should-http -r intelli-espower-loader test/*.test.js",
27
27
  "ci": "npm run lint && npm run test-cov",
28
28
  "lint": "jshint .",
29
29
  "autod": "autod -w --prefix '^' -t test -e examples"
@@ -45,10 +45,12 @@
45
45
  "co": "*",
46
46
  "coffee": "1",
47
47
  "formstream": "1",
48
+ "intelli-espower-loader": "^1.0.1",
48
49
  "istanbul": "*",
49
50
  "jshint": "*",
50
51
  "mocha": "*",
51
52
  "pedding": "1",
53
+ "power-assert": "^1.4.1",
52
54
  "semver": "5",
53
55
  "should": "8",
54
56
  "should-http": "*",