-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add proxy headers, add support for the https proxy #144
Conversation
Could you clean this up a bit please? There are a lot of unrelated changes in this PR caused by old commits. I have no idea what this PR would do when it has 900 changed lines in the diff. |
@mnmkng, sure. |
@mnmkng, hey, should I've even made a PR into this branch ? I now realise that it was updated long ago. And I was pulling changes from master. |
Yeah, you're right. I missed it. Please make the PR against master, not develop. Thanks. |
@mnmkng, here you go! |
@theArina thanks for your PR and the cleanup. However, there are still zero comments explaining what your changes do and what they are good for, and zero new unit tests for those changes. Also, I don't think it makes sense to add one more dependency "rimraf" just to enable "npm clean" command, that's just too wasteful. |
It depends - if we want to make this repository windows friendly, we can't use just Granted, this is not related to the PR itself and would be better done separately. |
I'll see what I can do with the comments and stuff. |
@theArina I totally understand and are grateful for your help, we just require a certain standard for this library, as it's used quite a bit, including our own production systems. |
const requestUrl = new URL(this.srcRequest.url); | ||
const hostname = `${requestUrl.hostname}:${requestUrl.port || '80'}`; | ||
|
||
let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the CONNECT protocol is unnecessary. This is just a regular web proxy.
proxy-chain/src/handler_forward.js
Line 114 in 0043ac9
this.trgRequest = http.request(reqOpts); |
const fn = reqOpts.protocol === 'https:' ? https.request : http.request;
this.trgRequest = fn(reqOpts);
and it should work.
HTTPS proxy support should be now possible via replacing Line 407 in f1bbe42
with const { protocol } = handlerOpts.upstreamProxyUrlParsed;
if (protocol !== 'http:' && protocol !== 'https:') { |
Sorry for the mess though.
#121, #47 related.