Giter Site home page Giter Site logo

support http connect method about goproxy HOT 9 CLOSED

elazarl avatar elazarl commented on June 25, 2024
support http connect method

from goproxy.

Comments (9)

elazarl avatar elazarl commented on June 25, 2024

Hi,

Thanks for using goproxy.

Yes. This is the expected behavior.
curl -p will issue a CONNECT request to the remote site baidu.com, would get a direct connection, and then

If you want, you can either disable CONNECT requests, or, apply MITM techniques to capture the CONNECT request.

It is currently not possible to MITM a generic TCP connection, but I'm working and thinking on a solution now. Feel free to write suggestions for how to do that.

MITM connect request is also relevant for websockets.

Did you expect anything else? Is disabling CONNECT requests to port 80 a good enough solution for you?

from goproxy.

zhangpy avatar zhangpy commented on June 25, 2024

What I want is to modify response html content in such case.

Can you show me a demo code how to disable CONNECT request? I could try it.
And my web server is 8080 instead of 80.

from goproxy.

elazarl avatar elazarl commented on June 25, 2024

Did that solve your problem?

Thanks,

from goproxy.

zhangpy avatar zhangpy commented on June 25, 2024

No. this will give exception in console, and the response is not modified. (failed to connect.)

INFO: Running 2 CONNECT handlers
2014/04/03 22:46:08 [002] INFO: handler: &{0 } www.baidu.com:80
2014/04/03 22:46:08 [002] INFO: handler: &{2 } www.baidu.com:80
2014/04/03 22:46:08 [002] INFO: Assuming CONNECT is TLS, mitm proxying it
2014/04/03 22:46:08 [002] WARN: Cannot handshake client www.baidu.com:80 local error: unexpected message

It seems disable http CONNECT request will fail all connection. It will try to use ssl to connect target web site, but the website does not support.

Could we apply MITM techniques to capture the CONNECT request and modify response?

from goproxy.

elazarl avatar elazarl commented on June 25, 2024

Can you explain what is the expected behavior? I'm not sure I understand it.

What are the curl commands, and what is the expected output?

from goproxy.

zhangpy avatar zhangpy commented on June 25, 2024

I expect that goproxy could proxy the page correctly with my modification (like add alert script at the end of page - shows in demo code) in this case:
curl -v -p --proxy localhost:7000 http://www.baidu.com

from goproxy.

elazarl avatar elazarl commented on June 25, 2024

I think I understand. I'll add a way to "Hijack" CONNECT requests in a few minutes.

from goproxy.

elazarl avatar elazarl commented on June 25, 2024

Please let me know if it works for you, see the eavesdropper example.

You can test it with curl -p and it should work.

Did that work for you?

Thanks,

from goproxy.

zhangpy avatar zhangpy commented on June 25, 2024

It works. thanks.
I make some change and send a pull request. please review. thanks.

from goproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.