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

Jonathan Moore updated HTTPCLIENT-980:
--------------------------------------

    Attachment: no-503-on-ioexception.patch

Not sure I would classify this as a "bug", but I do agree with the desired 
behavior. :) I've attached a patch to fix this.

This patch is contributed to the ASF with the permission of my employer.

Note, though, that there are certain cases where the CachingHttpClient may 
catch an IOException from the backend and return an actual HttpResponse:
* If a stale cache entry is marked 'must-revalidate' or 'proxy-revalidate' (for 
a shared cache), and an IOException is thrown when trying to revalidate the 
cache entry, the caching client will return a 504 Gateway Timeout, as required 
by the HTTP/1.1 spec.
* Otherwise, if the stale cache entry gets an IOException on revalidation, 
we'll return the stale entry with a Warning header attached.

Both of the above cases deal with revalidating a previously-obtained response, 
rather than a request that gets forwarded through to the origin as-is (which is 
I think the situation the original reporter was in).

> CachingHttpClient returns a 503 response when the backend HttpClient produces 
> an IOException
> --------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-980
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-980
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1 Alpha2
>            Reporter: Vianney Carel
>            Priority: Minor
>         Attachments: no-503-on-ioexception.patch
>
>
> The CachingHttpClient returns an HTTP 503 response when the backend 
> HttpClient throws an IOException.
> It happens for instance when the backend is DefaultHttpClient 
> (AbstractHttpClient), issuing a request to a server not listening on the 
> target port.
> Well, it sounds tricky, but it makes the HttpClient not having a consistant 
> behaviour in an implementation using both caching and regular clients.
> If a 503 should really be returned in that case, I suggest the 
> AbstractHttpClient to return it and the CachingHttpClient to just propagate 
> any exception thrown by the backend.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to