Giter Site home page Giter Site logo

Comments (5)

elazarl avatar elazarl commented on September 26, 2024

Hi @simathur, thanks for using goproxy.

When replying to a CONNECT request, the proxy is expected to create a tunnel. That is, to send any bytes sent to the proxy to the remote site, and send any bytes coming from the remote site back to the client.

So it cannot reuse the connection, and would not use any HTTP, 1.1, or 1.0.

Does that make sense, or am I misunderstanding the question?

from goproxy.

s8mathur avatar s8mathur commented on September 26, 2024

Thanks for the clarification, I understand conceptually. Though, I am still wondering what the following code block does in the ConnectAccept case block in handleHttps(). It does seem to be sending a HTTP 1.0 preamble to the upstream server, no?

ctx.Logf("Accepting CONNECT to %s", host)
proxyClient.Write([]byte("HTTP/1.0 200 OK\r\n\r\n"))
go copyAndClose(ctx, targetSiteCon, proxyClient)
go copyAndClose(ctx, proxyClient, targetSiteCon)

Thanks for your code and time!

from goproxy.

elazarl avatar elazarl commented on September 26, 2024

While the standard doesn't seem to mandate a particular HTTP version for the response[0], in practice I've seen that proxies use HTTP/1.0, so I'm trying to stick with that. Here, have a look at squid proxy which have the HTTP/1.0 response hardwired in code.

[0]

5.3 Establishing a Tunnel with CONNECT

Any successful (2xx) response to a CONNECT request indicates that the
proxy has established a connection to the requested host and port,
and has switched to tunneling the current connection to that server
connection.

It may be the case that the proxy itself can only reach the requested
origin server through another proxy. In this case, the first proxy
SHOULD make a CONNECT request of that next proxy, requesting a tunnel
to the authority. A proxy MUST NOT respond with any 2xx status code
unless it has either a direct or tunnel connection established to the
authority.

from goproxy.

s8mathur avatar s8mathur commented on September 26, 2024

Thanks for the explanation. BTW, do you hang around on IRC/#go-nuts sometimes? My nick is "simathur" when I am on IRC.

from goproxy.

elazarl avatar elazarl commented on September 26, 2024

Unfortunately I don't use IRC frequently. Should I?

On Wed, May 7, 2014 at 8:10 AM, simathur [email protected] wrote:

Thanks for the explanation. BTW, do you hang around on IRC/#go-nuts
sometimes? My nick is "simathur" when I am on IRC.


Reply to this email directly or view it on GitHubhttps://github.com//issues/47#issuecomment-42390114
.

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.