]> Cypherpunks repositories - gostls13.git/commit
http: make HEAD client request follow redirects
authorEivind Uggedal <eivind@uggedal.com>
Fri, 13 May 2011 15:17:59 +0000 (08:17 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 13 May 2011 15:17:59 +0000 (08:17 -0700)
commit092f34feca489bb6b873281b7484522eb574fe9d
tree07980d8919be8e5628b366874e0e8d6a48e47d8c
parent404d49154bc61c159ae4306940cefa63233c61c7
http: make HEAD client request follow redirects

HEAD requests should in my opinion have the ability to follow redirects
like the implementation of GET requests does. My use case is polling
several thousand severs to check if they respond with 200 status codes.
Using GET requests is neither efficient in running time of the task nor
for bandwidth consumption.

This suggested patch changes the return signature of http.Head() to match
that of http.Get(), providing the final URL in a redirect chain.

`curl -IL http://google.com` follows redirects with HEAD requests just fine.

Fixes #1806.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4517058
src/pkg/http/client.go
src/pkg/http/client_test.go