Created
June 12, 2012 03:42
-
-
Save kawaz/2914780 to your computer and use it in GitHub Desktop.
superagentをプロキシ対応するパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** node_modules/tower/node_modules/superagent/lib/node/index.js.orig 2012-06-12 11:59:44.000000000 +0900 | |
--- node_modules/tower/node_modules/superagent/lib/node/index.js 2012-06-12 12:38:44.000000000 +0900 | |
*************** | |
*** 458,463 **** | |
--- 458,472 ---- | |
// initiate request | |
var mod = exports.protocols[url.protocol]; | |
+ // use proxy | |
+ if(process.env.http_proxy) { | |
+ var proxy = parse(process.env.http_proxy); | |
+ options.port = proxy.port; | |
+ options.path = this.url; | |
+ options.host = proxy.hostname; | |
+ mod = exports.protocols[proxy.protocol]; | |
+ } | |
+ | |
// request | |
var req = this.req = mod.request(options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment