I did experiment but when using the same client I immediately got an EOF 
again. But that might also have been due to the rate-limiting. 

I started reading the source code of the http.Client and DefaultTransport 
but if any could advice good articles/books about the internals to get the 
most out of it, I would be very interested.

On Monday, April 18, 2022 at 6:23:22 AM UTC+2 amits...@gmail.com wrote:

> On Sunday, April 17, 2022 at 11:52:17 PM UTC+10 toon....@gmail.com wrote:
>
>> It is not clear to me from the documentation whether I can continue to 
>> use an http.Client after a POST failed (due to the connection being closed 
>> ;  In my case the connection closes probably due to rate-limiting).
>>
>> The documentation of the http.Transport does mention that, if a network 
>> error occurs, it will retry if the request is idempotent. Given I'm doing a 
>> basicPOST that is not the case for me. 
>>
>> But the http.Client will reestablish the connection on the next call to 
>> Post(...) ?
>>
>
> I believe you will see that's the case. Perhaps worth experimenting with 
> it? The reason is due to the underlying connection pooling behavior of the  
> DefaultTransport: https://go.dev/src/net/http/transport.go#L42:
> " It establishes network connections as needed // and caches them for 
> reuse by subsequent calls"
>
>
>> toon
>>
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b28780a5-1e59-4562-95d5-b4ae964e2c4dn%40googlegroups.com.

Reply via email to