You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Charles Fr Rey (JIRA)" <ji...@apache.org> on 2009/05/28 20:33:45 UTC

[jira] Created: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

CircularRedirectException encountered when using a proxy, but not when reaching the target directly
---------------------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-852
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient, HttpConn
    Affects Versions: 4.0 Beta 2
         Environment: Proxy: tinyproxy/1.6.4
            Reporter: Charles Fr Rey


A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.

The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.

Here is a snippet of code that exemplifies the problem (use your own proxy):

---
String proxyHost = "xyz.webfactional.com";
int proxyPort = 7295;

DefaultHttpClient httpclient = new DefaultHttpClient();
// without a proxy it's OK!
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
        new HttpHost(proxyHost, proxyPort, "http"));

HttpParams params = httpclient.getParams();
HttpClientParams.setRedirecting(params, true);
HttpProtocolParams.setUserAgent(params,
        "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");

// OK, this fixes the problem, but at what cost / other problems ?
//httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);

String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";

HttpUriRequest request;
HttpResponse response;

request = new HttpGet(url);
System.out.println("request = " + request.getRequestLine());
response = httpclient.execute(request);
System.out.println("status = " + response.getStatusLine());
System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Charles Fr Rey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715479#action_12715479 ] 

Charles Fr Rey commented on HTTPCLIENT-852:
-------------------------------------------

OK, seems fixed, that's great!

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-852.
------------------------------------------

    Resolution: Fixed

Charles,

I found a bug in the DefaultHttpRequestDirector that caused that issue. Fortunately, the fix was fairly minor in scope. No refactoring was necessary. 

Could you please re-test your application with the latest code snapshot and confirm the issue has been resolved?

You can find compiled snapshots here:

https://repository.apache.org/content/repositories/snapshots/org/apache/httpcomponents/httpclient/4.0-beta3-SNAPSHOT/

Oleg

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Charles Fr Rey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714576#action_12714576 ] 

Charles Fr Rey commented on HTTPCLIENT-852:
-------------------------------------------

Thanks for your feedback. I appreciate the good work put in this library and will do everything I can to help improve it.

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-852:
-----------------------------------------

    Fix Version/s: 4.0 Beta 3

> I've already opened an issue (HTTPCLIENT-852), sorry if that was inappropriate.

Charles,
That was perfectly appropriate.

> I join with this message 3 logs that show what happens without proxy, with the proxy and with the proxy and the 
> option ALLOW_CIRCULAR_REDIRECTS. 

Could you please attach those logs to this report?

Oleg

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714443#action_12714443 ] 

Oleg Kalnichevski commented on HTTPCLIENT-852:
----------------------------------------------

I examined the logs and that is what I have found so far: 

The bug in HttpClient is triggered only when the redirect needs to be retried for some reason, for instance, due to an I/O error. There appears to be a bug Tinyproxy's connection management code causing a perfectly re-usable HTTP/1.1 connection to be dropped without proper notification of the client. The proxy should have sent the 'Connection: close' if it was not going to re-use HTTP/1.1connection). HttpClient assumes that the connection is still good, executes the redirect on the same connection, which fails because the connection has been closed on the proxy side. The second retry fails because HttpClient mistakenly assumes the URI has already been visited.

While Tinyproxy's behavior is clearly broken, HttpClient should also be able to deal with failed redirects and retry those correctly. The fix for this issue, however, will require quite a bit of refactoring in the DefaultRequestDirector and DefaultRedirectHandler and may take a few days to complete. 

Oleg

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Charles Fr Rey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Fr Rey updated HTTPCLIENT-852:
--------------------------------------

    Attachment: withproxyALLOW_CIRC_RED.log
                withproxy.log
                withoutproxy.log

Here are the logs. (Didn't see the possibility to attach files at first).

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714446#action_12714446 ] 

Oleg Kalnichevski commented on HTTPCLIENT-852:
----------------------------------------------

> [java] 2009/05/28 19:57:13:507 CEST [DEBUG] RequestAddCookies - Cookie [version: 0][name: 
> ASPSESSIONIDCSARBQBA][value: JPLPAMKCADCFBCNFOJBFJPMP][domain: www.seoconsultants.com]
> [path: /][expiry: null] match [www.seoconsultants.com:7295/]

> 7295 is the proxyPort, and shouldn't have anything to do with the target host in the example 
> (www.seoconsultants.com). 

Charles,

Please raise a separate JIRA for this issue.

Oleg

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Charles Fr Rey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714441#action_12714441 ] 

Charles Fr Rey commented on HTTPCLIENT-852:
-------------------------------------------

I don't know if it has something to do with the issue, but there's something strange that appears in the log (when using the proxy):

[java] 2009/05/28 19:57:13:507 CEST [DEBUG] RequestAddCookies - Cookie [version: 0][name: ASPSESSIONIDCSARBQBA][value: JPLPAMKCADCFBCNFOJBFJPMP][domain: www.seoconsultants.com][path: /][expiry: null] match [www.seoconsultants.com:7295/]

7295 is the proxyPort, and shouldn't have anything to do with the target host in the example (www.seoconsultants.com).

> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Issue Comment Edited: (HTTPCLIENT-852) CircularRedirectException encountered when using a proxy, but not when reaching the target directly

Posted by "Charles Fr Rey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714169#action_12714169 ] 

Charles Fr Rey edited comment on HTTPCLIENT-852 at 5/28/09 2:01 PM:
--------------------------------------------------------------------

Here are the logs. (Didn't see the possibility to attach files at first). I've only edited the logs to hide my real proxy host.

      was (Author: sp1tf1r3):
    Here are the logs. (Didn't see the possibility to attach files at first).
  
> CircularRedirectException encountered when using a proxy, but not when reaching the target directly
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-852
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-852
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpConn
>    Affects Versions: 4.0 Beta 2
>         Environment: Proxy: tinyproxy/1.6.4
>            Reporter: Charles Fr Rey
>             Fix For: 4.0 Beta 3
>
>         Attachments: withoutproxy.log, withproxy.log, withproxyALLOW_CIRC_RED.log
>
>
> A CircularRedirectException is encountered when using a proxy (tinyproxy on a remote machine), whereas everything is fine when using no proxy. The target is a URL such as http://www.seoconsultants.com/w3c/status-codes/301.asp which has a 301 redirection.
> The issue can be fixed by using ALLOW_CIRCULAR_REDIRECTS set to true (client params), but I can't consider this a "real" fix.
> Here is a snippet of code that exemplifies the problem (use your own proxy):
> ---
> String proxyHost = "xyz.webfactional.com";
> int proxyPort = 7295;
> DefaultHttpClient httpclient = new DefaultHttpClient();
> // without a proxy it's OK!
> httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
>         new HttpHost(proxyHost, proxyPort, "http"));
> HttpParams params = httpclient.getParams();
> HttpClientParams.setRedirecting(params, true);
> HttpProtocolParams.setUserAgent(params,
>         "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10");
> // OK, this fixes the problem, but at what cost / other problems ?
> //httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
> String url = "http://www.seoconsultants.com/w3c/status-codes/301.asp";
> HttpUriRequest request;
> HttpResponse response;
> request = new HttpGet(url);
> System.out.println("request = " + request.getRequestLine());
> response = httpclient.execute(request);
> System.out.println("status = " + response.getStatusLine());
> System.out.println("headers = " + Arrays.asList(response.getAllHeaders()));
> ---

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org