[ https://issues.apache.org/jira/browse/HTTPCLIENT-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17922077#comment-17922077 ]
Vladimir Sitnikov commented on HTTPCLIENT-2359: ----------------------------------------------- [~olegk], thanks for the quick response. Could you please clarify where's the retry logic? It looks like https://github.com/apache/httpcomponents-core/blob/81a3c82473e93cdf8ef5b7873e44046f24c6d871/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java#L333 (https://github.com/apache/httpcomponents-core/blob/81a3c82473e93cdf8ef5b7873e44046f24c6d871/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/AbstractMessageParser.java#L252) would still produce {{new NoHttpResponseException("The target server failed to respond")}} > 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: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org