hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sivasubramaniam S (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HTTPCLIENT-1176) Support proxy failover per ProxySelector API
Date Sat, 25 Jan 2014 19:19:39 GMT

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

Sivasubramaniam S edited comment on HTTPCLIENT-1176 at 1/25/14 7:19 PM:
------------------------------------------------------------------------

Hi Oleg,

When one proxy is unreachable and the next is reachable, I only log the exception and proceed
with using the next reachable proxy. I needed to know the expected behavior only when all
proxies were unreachable. In that case, I can neither throw ConnectTimeoutException nor HttpHostConnectException
since these exceptions are specific to one proxy, but I need to throw an exception that says
that connection to all proxies failed.

I guess the code would be easier to understand. I have attached a patch (ProxyFailoverFix.patch).
I have tested this to work fine. Please take a look at it and see if it helps. I have a few
concerns with this patch though -

1. In the isReachable() method, I have set the socket timeout as 2000 ms. I tried to use the
timeout value set for the request, but I couldn't find out how to get this value from the
request.

2. This patch causes the test testProxy() in TestSystemDefaultRoutePlanner to fail. This happens
because determineProxy now throws an HttpException since both proxies in that test are unreachable.
I don't know how to mock the behavior of isReachable() method. Also, I have attached a second
patch (ProxyFailoverTest.patch) where I have added testFailoverProxy(). This again fails due
to the same issue of isReachable() not being mocked.

This is my first contribution. I guess I would have missed/botched up a few things. It would
be great if you could provide directions so that I can re-work on this.


was (Author: sivasubramaniams):
Initial patch for the fix.

> Support proxy failover per ProxySelector API
> --------------------------------------------
>
>                 Key: HTTPCLIENT-1176
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1176
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpConn
>    Affects Versions: 4.2 Beta1
>         Environment: All supported platforms/environments which use proxy failover
>            Reporter: Jan-Willem Maarse
>            Priority: Minor
>             Fix For: 4.4 Final
>
>         Attachments: ProxyFailoverFix.patch, ProxyFailoverTest.patch
>
>
> The ProxySelectorRoutePlanner selects a single proxy from the list returned by the java.net.ProxySelector
API. If the client can't open a socket to the proxy, other proxies in the list are ignored
and the request fails. It would be good if the Apache HttpClient could try other proxies in
the list before failing on socket errors. HttpURLConnection provides similar behavior. This
functionality is useful in network configurations where proxies can go up and down for maintenance,
for example.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message