TooTallNate / node-proxy-agent

Maps proxy protocols to `http.Agent` implementations
285 stars 69 forks source link

Error: Protocol:https: not supported. #1

Closed jonathanong closed 10 years ago

jonathanong commented 10 years ago

suddenly getting this error as of 0.11.12 when i'm proxying https requests over an http proxy. am i doing things wrong? or do you have to change something?

TooTallNate commented 10 years ago

Repro code? Nothing has changed as of recently AFAIK

jonathanong commented 10 years ago

don't have repo code. just a test in cojs/cogent: https://github.com/cojs/cogent/commit/ec707e28f6d59c3b66be91d228161f2f5f008a6c

not sure what's going on. works in 0.11.11 but fails in 0.11.12. getting:

     Error: Protocol:https: not supported.
      at new ClientRequest (_http_client.js:70:11)
      at Object.exports.request (http.js:52:10)
      at Object.exports.request (https.js:136:15)
      at Context.request (/Users/jong/Workspace/cogent/lib/index.js:167:39)
      at next (/Users/jong/Workspace/cogent/node_modules/co/index.js:93:21)
      at Context.<anonymous> (/Users/jong/Workspace/cogent/node_modules/co/index.js:50:5)
      at Test.Runnable.run (/Users/jong/Workspace/cogent/node_modules/mocha/lib/runnable.js:196:15)
      at Runner.runTest (/Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:374:10)
      at /Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:452:12
      at next (/Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:299:14)
      at /Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:309:7
      at next (/Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:247:23)
      at Immediate._onImmediate (/Users/jong/Workspace/cogent/node_modules/mocha/lib/runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:374:17)
jonathanong commented 10 years ago

oh my god i just looked at the code. you added it :P any reason agent protocol must match request protocol's?

TooTallNate commented 10 years ago

Ok, shit, thanks for the report. Looking into it.

TooTallNate commented 10 years ago

Ok, can repro. It seems I (unintentionally) introduced a slight behavior change in https://github.com/joyent/node/commit/d6bbb19f1d1d6397d862d09304bc63c476f675c1...

With that commit, any agent instance must have a protocol field set to "http:" or "https:" (depending on which core module you were using)... We should probably fix this in node, or failing that, I'll have the agent-base module have a default protocol field based on the secureEndpoint field or something.

Thanks for the report in any case! We'll get this sorted out.

TooTallNate commented 10 years ago

@jonathanong See https://github.com/joyent/node/pull/7351

TooTallNate commented 10 years ago

In short, v0.11.12 is botched, wait for v0.11.13 for the proper fix (and/or use v0.11.11 for now).

TooTallNate commented 10 years ago

@jonathanong Ok, so https://github.com/joyent/node/commit/9f23fe11418b66ab5812bed61e207af4e8f18efb fixes the problem. Closing this issue now. Cheers!

jonathanong commented 10 years ago

Woot!