FAQ
Actually, that was exactly my use case. I was hoping that I could "record"
a problematic request by simply dumping the entire request and replaying it
to the server. Of course this can be done using other tools like tcpdump,
netcat, or other tools, but a few calls to httputil.DumpRequest followed by
a ioutil.WriteFile seemed simple enough.

It would be nice if I could reproduce issues simply by doing:

    - cat http_dump | netcat localhost 8080
On Thursday, August 15, 2013 9:20:56 AM UTC-7, bradfitz wrote:

Honestly, those are mostly debug functions.

You shouldn't try to implement an HTTP client or server from them.
(they're not used by the net/http package)

That doesn't answer your question, though.



On Wed, Aug 14, 2013 at 9:30 PM, Joe Tsai <thebroke...@gmail.com<javascript:>
wrote:
I have some questions regarding the DumpRequest function in
net/http/httputil.

1. Is the output of DumpRequest(req, true) supposed to be a RFC 2616
compliant HTTP message? I noticed that if TransferEncoding is the identity,
then this function does not output the ContentLength. Without the content
length, replaying the dumped message back causes the server to not read the
body. In other words, should I always be able to replay the dumped request
back to the server and get the same response as the original message
(assuming no state on the server between requests)?
2. The description says that this is an "as-received wire
representation of req", but the source of the function seems to indicate
that the header is constructed from fields inside the Request struct. Even
the body seems to be reconstructed using Go's NewChunkedWriter if
chunked encoding is enabled. From what I can tell, this function is trying
to return a semantically equivalent representation of the request, but not
a "as-received wire representation" of the request. Is this assessment
correct?

Thanks.

--
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...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.
--
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

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 15, '13 at 4:30a
activeAug 19, '13 at 10:19p
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase