[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881054#comment-17881054
 ] 

Patrick Barry commented on HTTPCLIENT-2339:
-------------------------------------------

Understood. Thanks to your reply, I know how to workaround the issue.

I'll update this to "bug" so it will hopefully help others using the 
DefaultConnectionReuseStrategy.

https://www.rfc-editor.org/rfc/rfc9110.html#name-408-request-timeout

 
{noformat}
15.5.9. 408 Request TimeoutThe 408 (Request Timeout) status code indicates that 
the server did not receive a complete request message within the time that it 
was prepared to wait.If the client has an outstanding request in transit, it 
MAY repeat that request. If the current connection is not usable (e.g., as it 
would be in HTTP/1.1 because request delimitation is lost), a new connection 
will be used.{noformat}
https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.7

 
{noformat}
6.5.7.  408 Request Timeout

   The 408 (Request Timeout) status code indicates that the server did
   not receive a complete request message within the time that it was
   prepared to wait.  A server SHOULD send the "close" connection option
   (Section 6.1 of [RFC7230]) in the response, since 408 implies that
   the server has decided to close the connection rather than continue
   waiting.  If the client has an outstanding request in transit, the
   client MAY repeat that request on a new connection.{noformat}
Really, the problem is the server is sending the wrong value for "connection" 
header, but it would be great if this library could compensate for it.

> Force close on connection when 408 is returned
> ----------------------------------------------
>
>                 Key: HTTPCLIENT-2339
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2339
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (async)
>    Affects Versions: 5.3.1
>            Reporter: Patrick Barry
>            Priority: Major
>
> Regarding http1.1 requests.... We have a service we are reaching out to, that 
> is sending back a 408, but no connection: close.  
> According to [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408]
>  
> {noformat}
> The HTTP 408 Request Timeout client error response status code indicates that 
> the server would like to shut down this unused connection. A 408 is sent on 
> an idle connection by some servers, even without any previous request by the 
> client.
> A server should send the Connection: close header field in the response, 
> since 408 implies that the server has decided to close the connection rather 
> than continue waiting.
> {noformat}
>  
> We are using the CloseableHttpAsyncClient with 
> PoolingAsyncClientConnectionManager.  When we get a 408 and they do not 
> specify that connection should be closed, how can we force this? Can it be 
> accomplished with an interceptor or is it done by default inside the library? 
>  The response is actually sending back Connection=keep-alive
>  



--
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