hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Poulin" <jacques.pou...@gmail.com>
Subject Escaping of form parameters
Date Tue, 09 Jan 2007 13:58:46 GMT
Hi,

I'm trying to replicate an internet browser's behavior against the
Matchbook.com web site.

On this web site, requests are sent using POST to a server-side engine.
Request parameters are "XML-like" values.

For example, in order to login, one needs to pre-format a POST request where
the parameter name looks like this :

<login-request><userID>the user id</userID><password>the
password</password><action>login</action></login-request><

I coded my client using Perl, and it works fine.  The HTTP request looks
like this :

===== START =====
POST
http://www.matchbook.com/hindsight/matchbook.com/operation/business/security
/login/loginMachine
Referer: http://www.matchbook.com/navigation/processorFrame.jsp?mod=23
Content-Type: application/x-www-form-urlencoded
Extra-Cmd: login
Mb-User-Token: null
X-Ajax-Cap-Length: 113|<=-
X-Ajax-Reqid: bbgidfagccaaa
X-Ajaxhs-Id: p1jEJ-1

<login-request><userID>the user id</userID><password>the
password</password><action>login</action></login-request><=-  
   
===== END =====


Using HttpClient, the request fails.  Here's the log of the request :

===== START =====
2007/01/09 08:43:23:640 EST [DEBUG] header - >> "POST
/hindsight/matchbook.com/operation/business/security/login/loginMachine
HTTP/1.1[\r][\n]"
2007/01/09 08:43:23:640 EST [DEBUG] HttpMethodBase - Adding Host request
header
2007/01/09 08:43:23:671 EST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1
There are now 0 keys in the balances hashmap
2007/01/09 08:43:23:890 EST [DEBUG] HttpMethodBase - Default charset used:
ISO-8859-1
2007/01/09 08:43:23:890 EST [DEBUG] header - >> "User-Agent: Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0)[\r][\n]"
2007/01/09 08:43:23:906 EST [DEBUG] header - >> "Referer:
http://www.matchbook.com/navigation/processorFrame.jsp?mod=23[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "extra-cmd: login[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "mb-user-token:
null[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "x-ajax-reqid:
bbgidfacacjie[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "x-ajaxhs-id:
h8lFF-1[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "x-ajax-cap-length:
113|<=-[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "Host:
www.matchbook.com[\r][\n]"
2007/01/09 08:43:23:921 EST [DEBUG] header - >> "Cookie: $Version=0;
JSESSIONID=abcICU7L9LceKcSNsghar; $Path=/[\r][\n]"
2007/01/09 08:43:23:953 EST [DEBUG] header - >> "Cookie: $Version=0;
Coyote-2-d94b088a=ac11010a:0; $Path=/[\r][\n]"
2007/01/09 08:43:23:953 EST [DEBUG] header - >> "Content-Length:
161[\r][\n]"
2007/01/09 08:43:23:953 EST [DEBUG] header - >> "Content-Type:
application/x-www-form-urlencoded[\r][\n]"
2007/01/09 08:43:23:953 EST [DEBUG] header - >> "[\r][\n]"
2007/01/09 08:43:23:953 EST [DEBUG] content - >>
"%3Clogin-request%3E%3CuserID%3Ethe user id%3C%2FuserID%3E%3Cpassword%3Ethe
password%3C%2Fpassword%3E%3Caction%3Elogin%3C%2Faction%3E%3C%2Flogin-request
%3E%3C=-++++++"
===== END =====


The problem seems to be that the POST parameter name is escaped when
HttpClient is used.

I tried using either setParameter(String, String), or
setRequestBody(NameValuePair[]), and the result is the same.

My question would thus be : how can I --> NOT <-- escape the post parameter
name when creating a request with the PostMethod object ?

Thanks.


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


Mime
View raw message