FAQ
Currently when parsing HTTP response, you do not get the original response.
For example, "Transfer-Encoding: chunked\r\n" header is removed, and Body
is wrapped with chunkedReader.

Usually this is exactly what the user wants, but sometimes it's important
to just parse the response verbatim.

My specific use case is HTTPS mitm proxy, which reads an HTTP request from
the server, and writes it back to the client:

https://github.com/elazarl/goproxy/blob/4d9153454c077fd7cbd2200dc765aa87b94f16cd/https.go#L113

I don't see a way to get the Content-Length of the original HTTP response
without resorting to reflection or similar heresy. I resorted to just write
everything with chunked encoding, but it's silly since I already have
everything I need to just deliver the response to the client.

And I do want to use the parsing code in net/http, there's no reason to
duplicate it.

Is there a way to do that I'm missing?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 27, '13 at 8:51a
activeJun 27, '13 at 8:51a
posts1
users1
websitegolang.org

1 user in discussion

Elazar Leibovich: 1 post

People

Translate

site design / logo © 2021 Grokbase