Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Upgrade Dependency for Request #5926

Closed
sonewman opened this issue Aug 12, 2014 · 1 comment
Closed

Upgrade Dependency for Request #5926

sonewman opened this issue Aug 12, 2014 · 1 comment
Milestone

Comments

@sonewman
Copy link

There is currently an issue with the Tunnel Agent in the version of Request packaged with NPM.

This means that installs will not work when making requests through a secure or unsecure proxy.

This issue has come about due to the http refactor in Node v0.11.* which resulted in the http.request method signature to change so that arguments can be passed as either an object or as the previous legacy way (URL string, options, callback).

The tunnel proxy did not reflect that change as it overrides the http.Agent used for it's requests.

This resulted in requests failing:

npm ERR! TypeError: Request path contains unescaped characters.
npm ERR!     at new ClientRequest (_http_client.js:72:11)
npm ERR!     at TunnelingAgent.exports.request (http.js:50:10)
npm ERR!     at TunnelingAgent.createSocket (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:117:25)
npm ERR!     at TunnelingAgent.createSecureSocket [as createSocket] (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:184:41)
npm ERR!     at TunnelingAgent.addRequest (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:80:8)
npm ERR!     at new ClientRequest (_http_client.js:153:16)
npm ERR!     at Object.exports.request (http.js:50:10)
npm ERR!     at Object.exports.request (https.js:136:15)
npm ERR!     at Request.start (/usr/local/lib/node_modules/npm/node_modules/request/request.js:583:30)
npm ERR!     at Request.end (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1237:28)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/lib/node_modules/npm/cli.js" "install" "request"
npm ERR! cwd /Users/sam/tmp
npm ERR! node -v v0.11.14-pre
npm ERR! npm -v 1.4.21
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/sam/tmp/npm-debug.log
npm ERR! not ok code 0

The important thing to notice here is that the request path contains unescaped characters, this is because the URL string being used to connect was in fact [object Object] (the request options object).

I have manually tested this, replacing the version of Request being used in NPM with the most up-to-date release and this has fixed the problem, as I am aware that this bug has been rectified in the tunnel-agent module: request/tunnel-agent@7abb63b

@sonewman
Copy link
Author

nice 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants