diff options
| author | John Graham-Cumming <jgc@jgc.org> | 2013-01-25 10:20:19 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-01-25 10:20:19 -0800 |
| commit | 3c77b8961c97816417fd66816e53a9aa6d64de46 (patch) | |
| tree | 60d240a3a341db6ea2ae617739bf52603226c118 /src/pkg/runtime/proc.c | |
| parent | df21f06fdfa393747634d378a5a4344d0a7b54c3 (diff) | |
| download | go-3c77b8961c97816417fd66816e53a9aa6d64de46.tar.xz | |
net/http: fix Content-Length/Transfer-Encoding on HEAD requests
net/http currently assumes that the response to a HEAD request
will always have a Content-Length header. This is incorrect.
RFC2616 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response. The
metainformation contained in the HTTP headers in response to a
HEAD request SHOULD be identical to the information sent in
response to a GET request. This method can be used for
obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This
method is often used for testing hypertext links for validity,
accessibility, and recent modification."
This means that three cases are possible: a Content-Length
header, a Transfer-Encoding header or neither. In the wild the
following sites exhibit these behaviours (curl -I):
HEAD on http://www.google.co.uk/ has Transfer-Encoding: chunked
HEAD on http://www.bbc.co.uk/ has Content-Length: 45247
HEAD on http://edition.cnn.com/ has neither header
This patch does not remove the ErrMissingContentLength error
for compatibility reasons, but it is no longer used.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7182045
Diffstat (limited to 'src/pkg/runtime/proc.c')
0 files changed, 0 insertions, 0 deletions
