[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Sitnikov updated HTTPCLIENT-2359:
------------------------------------------
    Description: 
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

  was:
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.


> 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

Reply via email to