Skip to content

net/http: malformed HTTP request when GET follows HEAD request #5522

@davecheney

Description

@davecheney
Issue report from user via golang-nuts:
https://groups.google.com/d/msg/golang-nuts/h7RrDiFx0uo/uenFHfqot_AJ

What steps will reproduce the problem?

Compile and run http://play.golang.org/p/fI1wA1Uq4A

What is the expected output?

http://javascript.ru HEAD: OK
http://javascript.ru GET: OK
http://example.com HEAD: OK
http://example.com GET: OK

What do you see instead?

http://javascript.ru HEAD: OK
http://javascript.ru GET: Error: Get http://javascript.ru: malformed HTTP version
"\x1f\x8b\b\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00HTTP/1.1"
http://example.com HEAD: OK
http://example.com GET: Error: Get http://example.iana.org: EOF

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Ubuntu 13.04

* Also reproducible on Windows 7

Which version are you using?  (run 'go version')

go version go1.1 linux/amd64

* Also reproducible on: devel +c786b0f8eb4b Tue May 21 03:22:52 2013 +0800 windows/amd64

Please provide any additional information below.

The issue happens after sending a 'HEAD' request to a resource and then performing
another request. In the snippet above, I send 'HEAD' and then 'GET'. The same would be
if 'HEAD' after 'HEAD' is used. If 'HEAD' request is not used, then no such errors occur.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions