egg icon indicating copy to clipboard operation
egg copied to clipboard

[Feature Request] HttpClient should retry request when server closes connection

Open jas0ncn opened this issue 5 years ago • 2 comments

Background

When server closes connection at unfortunate time (keep-alive race), the http client will throw a ECONNRESET error.

Under this circumstance, agentkeepalive add req.reusedSocket to detect whether request is failed because reusing tcp connection.

Proposal

Add options retryWhenResuedSocketFail to HttpClient for whether retry request when get ECONNREST and req.reusedSocket is true. This options default value is true.

Seems Chrome do the same thing: https://codereview.chromium.org/303443011

jas0ncn avatar Oct 04 '20 07:10 jas0ncn

I can do something for this proposal if necessary.

jas0ncn avatar Oct 04 '20 07:10 jas0ncn

urllib has 2 options: isRetry / retry, could we use it for this purpose

atian25 avatar Oct 12 '20 09:10 atian25