[
https://issues.apache.org/jira/browse/HTTPCLIENT-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17922085#comment-17922085
]
Oleg Kalnichevski edited comment on HTTPCLIENT-2359 at 1/29/25 1:18 PM:
------------------------------------------------------------------------
> would still produce {{new NoHttpResponseException("The target server failed
> to respond")}}
[~vladimirsitnikov] Which is what it is supposed to do.
It is not enough just to re-open the socket and re-bind it to the connection at
this point. Some connection routes may involve proxy tunneling, TLS security
and lots of other complex stuff before the target request / response exchnage
could be executed. What Httpclient does instead it catches the exception in
`{color:#000000}HttpRequestRetryExec{color}` execution interceptor and re-spins
the entire message exchange.
Oleg
was (Author: olegk):
> would still produce {{new NoHttpResponseException("The target server failed
> to respond")}}
[~vladimirsitnikov] Which is what it is supposed to do.
It is not enough just to re-open the socket and re-bind it to the connection at
this point. Some connection routes may involve proxy tunneling, TLS security
and lots of other complex stuff before the target request / response could be
executed. What Httpclient does instead it catches the exception in
`{color:#000000}HttpRequestRetryExec{color}` execution interceptor and re-spins
the entire message exchange.
Oleg
> Retry HTTP requests if server closes connection before sending status line as
> per RFC 2068, 8.2
> -----------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2359
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2359
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: HttpClient (classic)
> Affects Versions: 4.5.14
> Reporter: Vladimir Sitnikov
> Priority: Major
>
> See https://www.rfc-editor.org/rfc/rfc2068#section-8.2
> {quote}if an HTTP/1.1 client has seen an HTTP/1.1 or
> later response from the server, and it sees the connection close
> before receiving any status from the server, the client SHOULD retry
> the request without user interaction so long as the request method is
> idempotent (see section 9.1.2); other methods MUST NOT be
> automatically retried, although user agents MAY offer a human
> operator the choice of retrying the request..{quote}
> I'm not an expert in HTTP / RFC, however, it looks like Httpclient should
> retry idempotent methods in case it receives EOF instead of a status line.
> As far as I understand, the only way to configure Httpclient to detect closed
> connections is to configure {{connectionManager.setValidateAfterInactivity}},
> however, it is more like a workaround since the server can close connections
> at arbitrary time (e.g. it can even close the connections within a couple of
> seconds if there's a huge connection demand).
> I suggest Httpclient should implement rfc2068, and it should retry
> (reconnect) in case it observes EOF before receiving the status line.
> Here's a use-case from Apache JMeter (including tcp dumps from both
> Httpclient and Firefox):
> https://github.com/apache/jmeter/issues/6330#issuecomment-2621285050
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]