Skip to content
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

Extract creation of Net::HTTP in httpproxy #41

Merged
merged 1 commit into from
May 26, 2020

Conversation

wishdev
Copy link
Contributor

@wishdev wishdev commented May 21, 2020

The "evil-proxy" gem [1] allows one to create an HTTPS man-in-the-middle proxy using webrick/httpproxy as the base.

It's a fairly unmaintained gem and therefore has fallen behind not-so-recent changes within webrick.

The biggest issue with e-p is its use of perform_proxy_request from webrick/httpproxy. Since httpproxy does not handle HTTPS requests in normal use the Net::HTTP object does not respect the fact that it might be used for that. Therefore evil-proxy basically has a cut/paste version of perform_proxy_request within it. So that means any changes to webrick require another cut-and-paste update to e-p.

I'd like to use e-p but I'd rather not cut-and-paste the method back in. Therefore I'm wondering if the following small patch would be acceptable. It simply moves the Net::HTTP.new call out into a distinct method which allows e-p to simply override that method to allow for use_ssl and verify_mode to be customized.

Thanks!

[1] - https://github.com/bbtfr/evil-proxy

@jeremyevans
Copy link
Contributor

Thanks for the patch! This looks fine and shouldn't have any backwards compatibility issues.

@jeremyevans jeremyevans merged commit e58195f into ruby:master May 26, 2020
@wishdev wishdev deleted the httpproxy_net_http branch May 26, 2020 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants