You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stephen Charles Huey <st...@fastmail.fm> on 2004/04/07 01:31:03 UTC

HttpClient: Maximum redirects (100) exceeded

Please excuse my ignorance if I ask a really dumb question.  I've been
using HttpClient without trouble for a long time, and it accesses a
secure site for me really well.  However, something on the site seems to
have changed, and now I'm experiencing an exception telling me the
maximum number of redirects has been exceeded.  The method
getFollowRedirects() tells me that it's set to true, but I'm guessing
that internally HttpClient or the HttpMethod sets that to false once a
certain number have been followed/received.  Is this correct?  

Every method I try to execute afterwards says getFollowRedirects is false
even though I explicitly set it to true right before querying that.  Or
does the fact that they're all POST methods have anything to do with them
being disabled from following redirects?  

Here's where my ignorance rears its head:  when I'm using a web browser
on the site and click on the link for the simple GET request, it loads up
the next page very quickly, so I'm wondering if it's possible that there
were really 100+ redirects in that time span, or if HttpClient is being
confused somehow.  

My main question is, how do I get around this problem, or is there no way
to do it with HttpClient?  I'm getting this exception message on the
simple GET request:

Apr 6, 2004 6:25:58 PM org.apache.commons.httpclient.HttpMethodBase
execute
SEVERE: Narrowly avoided an infinite loop in execute
org.apache.commons.httpclient.HttpRecoverableException: Maximum redirects
(100) exceeded
        at
        org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1111)
        at
        org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:675)
        at
        org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
        at QuickWebImporter.importAll(QuickWebImporter.java:76)
        at QuickWebImporter.main(QuickWebImporter.java:148)
getAddressBook follow redirects again: true
postExportPage follow redirects: false
Apr 6, 2004 6:25:58 PM org.apache.commons.httpclient.HttpMethodBase
processRedirectResponse
INFO: Redirect requested but followRedirects is disabled

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: HttpClient: Maximum redirects (100) exceeded

Posted by Stephen Charles Huey <st...@fastmail.fm>.
I didn't copy all of my message here.  Basically, my problem is that I'm
getting this when trying to execute a simple GET:

Apr 7, 2004 10:00:54 AM org.apache.commons.httpclient.HttpMethodBase
execute

SEVERE: Narrowly avoided an infinite loop in execute

org.apache.commons.httpclient.HttpRecoverableException: Maximum redirects
(100) exceeded

	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1111)


I've been doing this for a long time, but something changed on the
website and I guess that change is making me go into an infinite loop, so
I'm trying to figure out how to get around that so I can download my
addresses with this Java program once again.  The statement "Execute loop
try 1" will show up 100 times in my wire trace log, and it just tries the
same block of code below each time.  I don't understand a lot of it, but
I'm particularly wondering what it means when it says "Should close
connection in response to Connection: close".  I'm also wondering why the
socket appears to be stale...I had to use a GET and a POST and a GET
before this point, so there has been plenty of activity!  



2004/04/07 09:38:56:211 CDT [DEBUG] HttpConnection -
-HttpConnection.setSoTimeout(0)

2004/04/07 09:38:56:361 CDT [DEBUG] HttpConnection - -An error occurred
while reading from the socket, is appears to be stale
<java.net.SocketException: Socket Closed>java.net.SocketException: Socket
Closed

	at java.net.PlainSocketImpl.setOption(Unknown Source)

	at java.net.Socket.setSoTimeout(Unknown Source)

	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(Unknown Source)

	at org.apache.commons.httpclient.HttpConnection.isStale(HttpConnection.java:542)

	at org.apache.commons.httpclient.HttpConnection.isOpen(HttpConnection.java:468)

	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:660)

	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)

	at FedexWebImporter.importAll(FedexWebImporter.java:82)

	at FedexWebImporter.main(FedexWebImporter.java:156)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)

	at koala.dynamicjava.interpreter.EvaluationVisitor.visit(EvaluationVisitor.java:666)

	at edu.rice.cs.drjava.model.repl.EvaluationVisitorExtension.visit(EvaluationVisitorExtension.java:254)

	at koala.dynamicjava.tree.StaticMethodCall.acceptVisitor(StaticMethodCall.java:107)

	at edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$InterpreterExtension.interpret(DynamicJavaAdapter.java:493)

	at edu.rice.cs.drjava.model.repl.DynamicJavaAdapter.interpret(DynamicJavaAdapter.java:96)

	at edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM$4.run(InterpreterJVM.java:264)



2004/04/07 09:38:56:532 CDT [DEBUG] HttpConnection - -Connection is
stale, closing...

2004/04/07 09:38:56:732 CDT [DEBUG] HttpMethodBase - -Execute loop try 1

2004/04/07 09:38:56:852 CDT [DEBUG] wire - ->> "GET
/swab/AddressMain.do?appID=FSM&cc_lang=us&cc=us&language=us&sType=&gnd_flag=Y&dgalc=N
HTTP/1.1[\r][\n]"

2004/04/07 09:38:56:952 CDT [DEBUG] HttpMethodBase - -Adding Host request
header

2004/04/07 09:38:57:062 CDT [DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0final[\r][\n]"

2004/04/07 09:38:57:203 CDT [DEBUG] wire - ->> "Host:
www.fedex.com[\r][\n]"

2004/04/07 09:38:57:343 CDT [DEBUG] wire - ->> "Cookie: $Version=0;
fdx_login=41.bb83.4d658350; $Domain=.fedex.com; $Path=/[\r][\n]"

2004/04/07 09:38:57:493 CDT [DEBUG] wire - ->> "Cookie: $Version=0;
fdx_appname=inet; $Domain=.fedex.com; $Path=/[\r][\n]"

2004/04/07 09:38:57:693 CDT [DEBUG] wire - ->> "[\r][\n]"

2004/04/07 09:38:57:813 CDT [DEBUG] wire - -<< "HTTP/1.1 302 Moved
Temporarily[\r][\n]"

2004/04/07 09:38:57:944 CDT [DEBUG] wire - -<< "Server:
Netscape-Enterprise/4.1[\r][\n]"

2004/04/07 09:38:58:084 CDT [DEBUG] wire - -<< "Date: Wed, 07 Apr 2004
14:38:52 GMT[\r][\n]"

2004/04/07 09:38:58:234 CDT [DEBUG] wire - -<< "Location:
https://www.fedex.com/cgi-bin/ssoswab;SWABSESSIONID=A0S85B1LbPcoaGqyWhaC7m4x6gxJ3ptWQa2gGiFlp1I1DoPWJA0W!1270069690!wwls9.sac.fedex.com!7998!7002?cc_lang=us_en&returnurl=https://www.fedex.com/swab/AddressMain.do?appID%3DFSM%26cc_lang%3Dus%26cc%3Dus%26language%3Dus%26sType%3D%26gnd_flag%3DY%26dgalc%3DN[\r][\n]"

2004/04/07 09:38:58:384 CDT [DEBUG] wire - -<< "Content-Type:
text/html[\r][\n]"

2004/04/07 09:38:58:525 CDT [DEBUG] wire - -<< "Set-Cookie:
SWABSESSIONID=A0S85B1LbPcoaGqyWhaC7m4x6gxJ3ptWQa2gGiFlp1I1DoPWJA0W!1270069690!wwls9.sac.fedex.com!7998!7002;
path=/[\r][\n]"

2004/04/07 09:38:58:695 CDT [DEBUG] wire - -<< "Connection:
close[\r][\n]"

2004/04/07 09:38:58:845 CDT [DEBUG] HttpMethodBase - -Cookie accepted:
"$Version=0;
SWABSESSIONID=A0S85B1LbPcoaGqyWhaC7m4x6gxJ3ptWQa2gGiFlp1I1DoPWJA0W!1270069690!wwls9.sac.fedex.com!7998!7002;
$Path=/"

2004/04/07 09:38:58:995 CDT [DEBUG] HttpMethodBase - -Redirect required

2004/04/07 09:38:59:205 CDT [DEBUG] HttpMethodBase - -Redirect requested
to location
'https://www.fedex.com/cgi-bin/ssoswab;SWABSESSIONID=A0S85B1LbPcoaGqyWhaC7m4x6gxJ3ptWQa2gGiFlp1I1DoPWJA0W!1270069690!wwls9.sac.fedex.com!7998!7002?cc_lang=us_en&returnurl=https://www.fedex.com/swab/AddressMain.do?appID%3DFSM%26cc_lang%3Dus%26cc%3Dus%26language%3Dus%26sType%3D%26gnd_flag%3DY%26dgalc%3DN'

2004/04/07 09:38:59:306 CDT [DEBUG] HttpMethodBase - -Redirecting from
'https://www.fedex.com:443/swab/AddressMain.do' to
'https://www.fedex.com/cgi-bin/ssoswab;SWABSESSIONID=A0S85B1LbPcoaGqyWhaC7m4x6gxJ3ptWQa2gGiFlp1I1DoPWJA0W!1270069690!wwls9.sac.fedex.com!7998!7002?cc_lang=us_en&returnurl=https://www.fedex.com/swab/AddressMain.do?appID%3DFSM%26cc_lang%3Dus%26cc%3Dus%26language%3Dus%26sType%3D%26gnd_flag%3DY%26dgalc%3DN

2004/04/07 09:38:59:446 CDT [DEBUG] HttpMethodBase - -Should close
connection in response to Connection: close


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: HttpClient: Maximum redirects (100) exceeded

Posted by Michael Becke <be...@u.washington.edu>.
Hi Stephen,

In regard to PostMethods, they cannot be redirected.  Setting  
followRedirects to true will have no effect.

As for the 100+ redirects it seems that there is a loop somewhere.  If  
you post a wire log  
<http://jakarta.apache.org/commons/httpclient/logging.html> of the  
first few redirects we should be able to figure out what's happening.

Mike

On Apr 6, 2004, at 7:31 PM, Stephen Charles Huey wrote:

> Please excuse my ignorance if I ask a really dumb question.  I've been
> using HttpClient without trouble for a long time, and it accesses a
> secure site for me really well.  However, something on the site seems  
> to
> have changed, and now I'm experiencing an exception telling me the
> maximum number of redirects has been exceeded.  The method
> getFollowRedirects() tells me that it's set to true, but I'm guessing
> that internally HttpClient or the HttpMethod sets that to false once a
> certain number have been followed/received.  Is this correct?
>
> Every method I try to execute afterwards says getFollowRedirects is  
> false
> even though I explicitly set it to true right before querying that.  Or
> does the fact that they're all POST methods have anything to do with  
> them
> being disabled from following redirects?
>
> Here's where my ignorance rears its head:  when I'm using a web browser
> on the site and click on the link for the simple GET request, it loads  
> up
> the next page very quickly, so I'm wondering if it's possible that  
> there
> were really 100+ redirects in that time span, or if HttpClient is being
> confused somehow.
>
> My main question is, how do I get around this problem, or is there no  
> way
> to do it with HttpClient?  I'm getting this exception message on the
> simple GET request:
>
> Apr 6, 2004 6:25:58 PM org.apache.commons.httpclient.HttpMethodBase
> execute
> SEVERE: Narrowly avoided an infinite loop in execute
> org.apache.commons.httpclient.HttpRecoverableException: Maximum  
> redirects
> (100) exceeded
>         at
>          
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.jav 
> a:1111)
>         at
>          
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 675)
>         at
>          
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 529)
>         at QuickWebImporter.importAll(QuickWebImporter.java:76)
>         at QuickWebImporter.main(QuickWebImporter.java:148)
> getAddressBook follow redirects again: true
> postExportPage follow redirects: false
> Apr 6, 2004 6:25:58 PM org.apache.commons.httpclient.HttpMethodBase
> processRedirectResponse
> INFO: Redirect requested but followRedirects is disabled
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org