Closed
Description
What version of Go are you using (go version
)?
go1.8beta2
What operating system and processor architecture are you using (go env
)?
windows/amd64
What did you do?
When running below sample program the program hangs on http.DefaultClient.Do(req)
package main
import (
"net/http"
"log"
"net/http/httputil"
)
func main(){
req, err := http.NewRequest("GET", "https://start.exactonline.nl/api/v1/current/Me", http.NoBody)
if err != nil {
log.Fatal(err)
}
rdata, err := httputil.DumpRequestOut(req, true)
if err != nil {
log.Fatal(err)
}
log.Println(string(rdata))
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
log.Println(resp.Status)
}
What did you expect to see?
401 Unauthorized
What did you see instead?
Nothing (hangs for minutes)
Other info
I expect this also has something to do with the server side because when using a different URL everything is OK.
But since this code runs fine on Go 1.7.3 and earlier I expect it is a bug in 1.8.
Note: In the go1.7 code we use a new(bytes.Buffer)
instead of http.NoBody
in a function that does GET, PUT and POST requests, so only in the GET requests will have an empty buffer.
- The program works when compiling in versions < 1.8beta1
- The program works when setting the body to
nil
- The program also works if you do not dump the request
Possibly related to #18117 ?