support for localhost/127.0.0.1 proxy bypass #2355
Conversation
I've added two commits for the settings. The issue I had seems to be build related - performing a clean build removed the segfault. The first settings commit adds settings, seeding the list with "localhost" and "127.0.0.1". The second reverts that change but instead detects an empty list and uses "localhost" and "127.0.0.1". This allows you to use a command line flag like --proxy-bypass none, which is technically a host but shouldn't match anything and will therefore force all traffic through the proxy. However, if you completely omit --proxy-bypass, you'll get behavior you probably expect (use the proxy except for localhost/127.0.0.1). I considered the second change slightly controversial so I've not squashed these commits. |
@@ -107,6 +107,20 @@ QNetworkReply * MyNetworkAccessManager::createRequest(Operation op, const QNetwo | |||
return QNetworkAccessManager::createRequest(op, r3, outgoingData); | |||
} | |||
|
|||
MyNetworkProxyFactory::MyNetworkProxyFactory (QNetworkProxy proxy, QList<QString> bph, ResourceObject & res): |
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.
Why do you need the ResourceObject
here? It isn't used, so should ideally be removed.
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.
Just an oversight - I was originally using it, then removed it but missed this line. Thanks!
Also, I don't think the approach taken is ok (bypass proxy for localhost by default). If someone wants that, it is better to opt in via Thanks for the contribution, though! |
Also, please squash the commits and rebase it against master and add an entry in both |
@elerch: any update? |
Sorry - got pulled into some fires at the office. Things are dying down so I just got back to this and should be able to make the changes tomorrow. |
8078b0b
to
8fcd774
Compare
I squashed the commit, made the changes you suggested and rebased on the latest commits. The changes were retested after a build but with Qt upgraded it's probably worth a clean build, so I'm doing that now. This is probably ready to go but I'll do final testing once the build is complete. Let me know if there's any other changes you think I need to make. Thanks! |
FYI - Finished re-testing on a clean build and all is well, so this is ready as far as I'm concerned. Let me know if you want any other changes. |
Looks good, once you make the above changes I'll merge it ASAP. |
Also, would prefer if you move up your name so that it is in the list of |
91f49d5
to
1a326ff
Compare
Your comments all made sense. I made the corresponding changes and retested. |
Sorry, a few more nitpicks ... thought you'd remove the unused variable. Also, I think that the commit message should be |
no worries - removed the unused variable and changed the message |
This adds the command line option --bypass-proxy-for which will bypass the proxy when specific hosts are referenced. It is most useful for bypassing localhost/127.0.0.1 references (e.g. --bypass-proxy-for localhost) This fixes wkhtmltopdf#1565 and wkhtmltopdf#2130
Thank you for the contribution, and appreciate your patience during the review process. |
It would be great if you could honor the |
I'd appreciate a PR which implements this. |
|
This option was added here: wkhtmltopdf/wkhtmltopdf#2355
This option was added here: wkhtmltopdf/wkhtmltopdf#2355
This PR addresses #1565 and #2130. It is currently using hardcoded values for localhost (localhost and 127.0.0.1) for bypass. I started wiring this into the settings system but was getting seg faults so I'm clearly doing something wrong there. I'll create a new PR for customization of the bypass values through the settings once I get that worked out.
This was originally worked off rev 7f74d89.