Skip to content

Instantly share code, notes, and snippets.

@kawaz
Created June 12, 2012 03:42
Show Gist options
  • Save kawaz/2914780 to your computer and use it in GitHub Desktop.
Save kawaz/2914780 to your computer and use it in GitHub Desktop.
superagentをプロキシ対応するパッチ
*** 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