hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Use HttpClinet to login a https site.
Date Tue, 07 Sep 2004 06:51:14 GMT
Hi Ian,

the trick is in the onload="document.AUTOSUBMIT.submit()" part
of the HTML page. A browser will detect this handler and execute
the JavaScript code in it after loading the document. That particular
JavaScript creates a followup request, sending the data in the
hidden input field "SMPostPreserve" to the URL specified in the
action attribute of the <form> tag. I find it particularily ugly that
the URL itself also contains a query string, but that is not your

The problem here is that the redirect after a login is handled
completely on the application/HTML/JavaScript level and is
in no way visible on the HTTP level. Therefore, it can not be
automatically handled by the HttpClient.

The easiest way for you to go on is to handle the page in your
application. Search for the action= part and extract the URL.
Then search for the value= part in the input field named
SMPostPreserve. Create a new post request to the target
URL, add the parameter from the hidden input field, and
hope that it works. Unfortunately, your code may be broken
at any time if that redirect page on the server undergoes
significant changes.

hope that helps,

Ian Zhang <hhzhang@yahoo.com> 
06.09.2004 22:29
Please respond to
"Commons HttpClient Project"

Commons HttpClient Project <commons-httpclient-dev@jakarta.apache.org>

Use HttpClinet to login a https site.


Everyone.  I am not sure if this mailing list is the
place asking for help.  If it is not, sorry.


I use HttpClient 2.01 to login a site using form (post
method) login.   I got the following response message.
  It looks like it continue to processing.  The
Netscape or IE will automatically be forwarded (or
redirect).  How do I handle using HttpClient?

It is a https site.  I have the user id and password
to use a form login.

The status is 200.  Is the a forwarding, redirect or
proxy problem?

Thanks for the help.

statuscode:200 HTTP/1.1 200

onLoad="document.AUTOSUBMIT.submit();">This page is
used to hold your data while you are being authorized
for your request.<BR><BR>You will be forwarded to
continue the authorization process. If this does not
happen automatically, please click the Continue button

Ian Zhang

Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 

To unsubscribe, e-mail: 
For additional commands, e-mail: 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message