catapult-project / catapult

Deprecated Catapult GitHub. Please instead use http://crbug.com "Speed>Benchmarks" component for bugs and https://chromium.googlesource.com/catapult for downloading and editing source code..
https://chromium.googlesource.com/catapult
BSD 3-Clause "New" or "Revised" License
1.91k stars 562 forks source link

[wpr-go] Grow support for HTTP CONNECT to make wpr-go a complete proxy #4619

Open ncalexan opened 5 years ago

ncalexan commented 5 years ago

I posted this in https://github.com/catapult-project/catapult/issues/4167#issuecomment-462437038 and got no response. But that's a closed issue, so let's try a new issue instead! Hopefully this will at least get triaged.

I want to make it easier to run WprGo against Firefox and other Gecko-based products. The Gecko engine doesn't have an equivalent of Chrome's --host-resolver-rules, so it's not easy for me to port-map 80->8080 and 443->8081 inside of the product. But it is easy for me to configure a proxy to do the port-mapping for me -- with, say, goproxy it's just a few lines of code to do exactly the connection hijacking suggested. That is, I've made a trivial proxy that serves on localhost:4040 and just port-maps localhost:80->localhost:8080 and localhost:433->localhost:8081. With a few layers of certificates, it appears to work just fine. This will save me requiring privileges to bind 80 and 443 for WprGo.

One downside is that I need to coordinate two proxies, and in particular two certificates. Clearly I'll be able to re-use one of the certificates with a little work.

So:

This is exactly the behaviour @xunjieli suggested in #4167 (comment).

Thanks for your time, for making WprGo great (and really readable -- I don't speak Go and I can modify it), and for helping Firefox/Gecko out!