net/http: client action when doing redirection #30689
Comments
@bradfitz would you help to answer? thank you. |
Sorry, but I don't understand the question or problem. |
sorry, i update my question. @bradfitz by the way there is a redirection in http invoke. |
If you close a response body without reading from it, the net/http package has the right to just close the TCP connection, as that's usually more efficient that reading bytes just to discard them. See docs at https://golang.org/pkg/net/http/#Client.Do |
so if the returned error is nil, does http.client guarantee that all the requests is sent correctly and all response data is fetched to local even if the reponse data is large? |
go version 1.11.2.
i use http.client to get an object from an object storage server continually.
the server will response with status code 307 and a redirection url.
my code like:
if uncomment the special line it works as my expection, object will be downloaded continually and data stream could be watched from network card,
if comment the special line, the http.client will also send a request to the redirection url, but no as much as data stream be watched in network card. i doubt that the objects didn't be downloaded.
my question is what's the difference between processing http response with and without 'ioutil.ReadAll(resp.Body)'.
could anyone help me to resolve my confusion? thanks.
The text was updated successfully, but these errors were encountered: