Understood, and I agree this is the correct approach. It's definitely MS that spits out rubbish cookies, but unfortunately it demands garbage back in. Just a useful point to note for anyone connecting to MS servers.
On Tue, Jan 13, 2009 at 12:49 AM, Oleg Kalnichevski <[email protected]>wrote: > On Tue, 2009-01-13 at 00:24 +1100, Jason Polites wrote: > > Hi Shyam, > > Apologies for the random "chime-in", but I just happened to be reading > your > > post. > > > > Two things I see: > > > > 1. There's some weirdness in the cookies. Namely: > > > > "Cookie: null; > > > IIIV3942733078="#BEGMD5#6c627724ce8abab6110397daf85343ca#ENDMD5#121-hoov|1775525|112|45|75|0"; > > 16024108083778=16024108083778[\r][\n]" > > > > Which is almost the same as: > > > > "Cookie: > IIIV3942733078=#BEGMD5#6c627724ce8abab6110397daf85343ca#ENDMD5#121-hoov|1775525|112|45|75|0[\r][\n]" > > > > At least the key value of the cookie is the same, and the former > > doesn't appear to have been sent in a Set-Cookie header by the server. > > Perhaps the server is grabbing the wrong cookie? > > > > 2. My reading of the log appears to suggest that everything IS > > actually working. The final GET request for > > /index2.asp?si=31424108094774 appears to return successfully? > > > > I've done some significant work with HttpClient connecting to MS > > systems (namely Exchange via WebDAV) and have had to go through all > > sorts of hoops to get it to work. One tool I found invaluable is the > > TamperData plugin for Firefox. If you are able to access this site > > successfully from Firefox (assuming MS doesn't bump you out due to > > browser restriction), TamperData will allow you to see the content of > > the HTTP headers sent to and fro. I have found this very useful to > > compare what Firefox is giving/receiving with that of HttpClient. > > > > Another "tip" was that I ended up disabling all auto-cookie creation > > in HttpClient and manually inserted the cookies just as I received > > them from the server. I found that (in 3.x HttpClient anyway) it was > > screwing up my cookies and sending back different data to the data it > > received in the Set-Cookie from the server. In my case it was a > > parsing but in HttpClient. Not sure if the version you are using has > > any of these issues. > > > > HttpClient 3.x per default attempts to maintain at least some degree of > standard compliance with regards to cookie handling instead of 'garbage > in - garbage out' policy used by so called common browsers. This policy > was relaxed somewhat in HttpClient 4.0. HttpClient 4.0 will try to > auto-detect the level of standard compliance based on the format of > incoming Set-Cookie headers and use the same cookie policy when sending > cookies back to the origin server. > > Oleg > > > > Hope something here is of help. > > > > Cheers, > > > > Jason. > > > > > > On Mon, Jan 12, 2009 at 11:04 PM, shyam <[email protected]> wrote: > > > > > Hi Oleg, > > > > > > Thank you very much for your reply. > > > > > > I solved the Circular Redirect issue by setting the setFollowRedirect > of > > > HTTPMETHOD to false. > > > > > > Now I am able to get the inside page. > > > > > > But when I try to get a link in that page, it is redirecting > abnormally. > > > And I am getting the the same index page again and again. > > > > > > I think I am setting the Cookies correctly. > > > Please Help me, I am stuck here. > > > I am attaching the Wire Log. > > > > > > Thanks for reading. > > > Regards, > > > Shyam > > > > > > -----Original Message----- > > > From: Oleg Kalnichevski [mailto:[email protected]] > > > Sent: Saturday, January 10, 2009 6:38 PM > > > To: HttpClient User Discussion > > > Subject: Re: CircularRedirectException: Circular redirect to > > > > > > shyam wrote: > > > > Hi All, > > > > > > > > > > > > > > > > I am trying to execute a Post method to login using Username and > Password > > > to > > > > a site, using HttpClient. > > > > > > > > > > > > > > > > I am getting status 301 object moved permanently. > > > > > > > > > > > > > > > > Then when I try to execute Get method on the Location, It is showing > the > > > > following exception:- > > > > > > > > > > > > > > > > org.apache.commons.httpclient.CircularRedirectException: Circular > > > redirect > > > > to' > > > > > > > > > > > > > > > > > > > > > > > > Can you please tell me why this is happening? > > > > > > > > > > > > > > Post a complete wire / context log of the session > > > > > > http://hc.apache.org/httpclient-3.x/logging.html > > > > > > Oleg > > > > > > > > > > > > > > > > > How can I correct this? > > > > > > > > > > > > > > > > Thanks & Regards > > > > > > > > > > > > > > > > Shyam > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
