HttpMethod.setRequestHeader("User-Agent", "Mozilla, etc....");
You should make this value the same as what your browser is using.
Mike
[EMAIL PROTECTED] wrote:
Welp, I have tried everything I can think of cookie types, http 1.0 versus
1.1, even matching the headers line for line. It is even the exact same
content-length as the browser trace. I still get the 200 OK instead of the
302 Found with the new location I need. I'm at a loss.
Here's my latest trace for any eagle eye that can help. I don't even know what else to try. Any suggestions?
Ross
-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 2:18 PM
To: Commons HttpClient Project
Subject: Re: Posting Issues was RE: Cookie Issues
Ross, I'd say giving empty string "" or a blank " " as a parameter _should_ work around the problem. Still, it does seem to be a bug in HttpClient, and a proper fix must be implemented. I'll get back to you as soon as I know more.
Oleg
On Tue, 2003-07-01 at 20:11, Ross Rankin wrote:
I think I might have an idea but I don't know how to solve it... Here ths Posted information from the HTTPClient:
st=a Words=java Use=All Town=New+York states=NY%2C+US Freshness= EdLevel=DR3 EdExec=YES EmpType=JTFT EmpType=JTCT EmpType=JTIN minsalary=0 maxsalary=gt120 vt=title submit1=Search sname= jrdid
Versus the post info from the browser: st=a Words=java Use=All Town=new+york states=NY%2C+US Freshness= EdLevel=DR3 EdExc=YES EmpType=JTFT EmpType=JTCT EmpType=JTIN minsalary=0 maxsalary=gt120 vt=title submit1=Search sname= jrdid=
Well they look identical, but I noticed the missing '=' on the jrdid parameter. So I did an experiment, I created a form and did a post by typing the URL instead of letting the form post. Well, to the posted page jrdid vs. jrdid= is the difference between null and empty string.
So, in my code, I have an array of name value pairs which I do setName and setValue on, how do I in the last item make it append the = sign rather
than
dropping it?
Thanks.
Ross
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 1:38 PM
To: 'Commons HttpClient Project'
Subject: RE: Cookie Issues
Well it has changed my problem. Here what happens now, I still do not get the post results that I want. Here's the proxy trace with a browser:
POST /JobSeeker/Jobs/JobQuery.asp?ch=al HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Referer: http://www.careerbuilder.com/JobSeeker/Jobs/JobQuery.asp?ch=al Accept-Language: en-us Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YComp 5.0.0.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322) Host: www.careerbuilder.com Content-Length: 191 Pragma: no-cache Cookie: BID=X1AF7F150CF82DEEBA4E03DAF0F931A1314C4A2FA0C33F3DC0A204C3B55F8553AF
;
bJobSeeker=True; CB%5FSID=e81477595a9e4a5b9d9e386d618e0b15%2D110294498%2Drh%2D1; PU=0 Connection: keep-alive Accept-encoding: gzip, deflate Browser reload detected... Posting 191 bytes... st=a Words=java Use=All Town=new+york states=NY%2C+US Freshness= EdLevel=DR3 EdExc=YES EmpType=JTFT EmpType=JTCT EmpType=JTIN minsalary=0 maxsalary=gt120 vt=title submit1=Search sname= jrdid= Continue ignored...
+++RESP 12+++ HTTP/1.1 302 Found Server: Microsoft-IIS/5.0 Date: Mon, 30 Jun 2003 17:23:37 GMT X-Powered-By: ASP.NET Connection: close Set-Cookie: BID=X1AF7F150CF82DEEBA4E03DAF0F931A131AE9ACC050B2FDB88D31C12A6193198AB
;
domain=.careerbuilder.com; expires=Tue, 29-Jun-2004 15:00:00 GMT; path=/ Location: /JobSeeker/Jobs/JobResults.asp?jrdid=&strCrit=QID%3DA3846750832018%3Bs t%3Da%3Buse%3DAll%3BrawWords%3Djava%3BTID%3D13938%3BBID%3DD2J8%3BCTY%3 DNew+York%3BSID%3DNY%3BCID%3DUS%3BENR%3DNO%3BDTP%3DDR3%3BYDI%3DYES%3BI ND%3DAll%3BPDQ%3DAll%3BJN%3DAll%3BPAYL%3D0%3BPAYH%3Dgt120%3BPOY%3DNO%3 BETD%3DJTFT%3BETD%3DJTCT%3BETD%3DJTIN%3BRE%3DALL%3BMGT%3DDC%3BSUP%3DDC %3BFRE%3D30%3BCHL%3Dal%3BQS%3Dhhr%5FJobQuery%2Easp%3BSS%3DNO%3BTITL%3D 0%3BVT%3Dtitle&CiBookMark=1&sname= Connection: close P3P: CP="CAO CURa IVAa HISa OUR IND UNI COM NAV INT STA",policyref="http://img.icbdr.com/images/CBP3P.xml" Content-Length: 0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: bJobSeeker=True; expires=Wed, 30-Jun-2004 17:23:36 GMT; domain=.careerbuilder.com; path=/ Note the 302 result with the page location I would need to get. However when I do a Post with the HTTPClient the trace shows I get a 200
OK
back and the location in that header is the same post location I just
posted
to so I get the form back again. Any Ideas??
Ross
PS: here's the relevant trace:
2003/06/30 13:34:23:889 EDT [DEBUG] wire - ->> "POST /JobSeeker/Jobs/jobfindall.asp?ch=al HTTP/1.0[\r][\n]" 2003/06/30 13:34:23:919 EDT [DEBUG] wire - ->> "Referer: http://www.careerbuilder.com/JobSeeker/Jobs/JobQuery.asp?ch=al[ \r][\n]" 2003/06/30 13:34:23:989 EDT [DEBUG] wire - ->> "User-Agent: Jakarta Commons-HttpClient/2.0beta1[\r][\n]" 2003/06/30 13:34:23:989 EDT [DEBUG] wire - ->> "Host: www.careerbuilder.com[\r][\n]" 2003/06/30 13:34:23:989 EDT [DEBUG] wire - ->> "Cookie: CB%5FSID=94254f4c05dc49409a412b4aa0d6b6df%2D110295211%2Drs%2D1; BID=X1F973B11E6FB9EE790A13B8953372A922546BBBFACB72F0CFCC4162D2A3951A01; PU=0; bJobSeeker=True[\r][\n]" 2003/06/30 13:34:24:009 EDT [DEBUG] wire - ->> "Content-Length:
192[\r][\n]"
2003/06/30 13:34:24:009 EDT [DEBUG] wire - ->> "Content-Type: application/x-www-form-urlencoded[\r][\n]" 2003/06/30 13:34:24:009 EDT [DEBUG] wire - ->> "[\r][\n]" 2003/06/30 13:34:24:029 EDT [DEBUG] wire - ->> "st=a&Words=java&Use=All&Town=New+York&states=NY%2C+US&Freshness=&EdLevel
=DR3&EdExec=YES&EmpType=JTFT&EmpType=JTCT&EmpType=JTIN&minsalary=0&maxsalary
=gt120&vt=title&submit1=Search&sname=&jrdid= " 2003/06/30 13:34:24:169 EDT [DEBUG] wire - -<< "HTTP/1.1 200 OK[\r][\n]" 2003/06/30 13:34:24:209 EDT [DEBUG] wire - -<< "Server: Microsoft-IIS/5.0[\r][\n]" 2003/06/30 13:34:24:209 EDT [DEBUG] wire - -<< "Date: Mon, 30 Jun 2003 17:33:36 GMT[\r][\n]" 2003/06/30 13:34:24:209 EDT [DEBUG] wire - -<< "X-Powered-By: ASP.NET[\r][\n]" 2003/06/30 13:34:24:239 EDT [DEBUG] wire - -<< "Set-Cookie: BID=X1F973B11E6FB9EE790A13B8953372A922496B935C637EB6873BC4EA 56DCD426B2; domain=.careerbuilder.com; expires=Tue, 29-Jun-2004 15:00:00 GMT; path=/[\r][\n]" 2003/06/30 13:34:24:239 EDT [DEBUG] wire - -<< "P3P: CP="CAO CURa IVAa
HISa
OUR IND UNI COM NAV INT STA",policyref="http ://img.icbdr.com/images/CBP3P.xml"[\r][\n]" 2003/06/30 13:34:24:239 EDT [DEBUG] wire - -<< "Connection: Keep-Alive[\r][\n]" 2003/06/30 13:34:24:259 EDT [DEBUG] wire - -<< "Content-Length: 29610[\r][\n]" 2003/06/30 13:34:24:259 EDT [DEBUG] wire - -<< "Content-Type: text/html; charset=ISO-8859-1[\r][\n]" 2003/06/30 13:34:24:259 EDT [DEBUG] wire - -<< "Set-Cookie:
bJobSeeker=True;
expires=Wed, 30-Jun-2004 17:33:36 GMT; doma in=.careerbuilder.com; path=/[\r][\n]" 2003/06/30 13:34:24:279 EDT [DEBUG] wire - -<< "Cache-control: private[\r][\n]" 2003/06/30 13:34:24:279 EDT [DEBUG] wire - -<< "[\r][\n]" 2003/06/30 13:34:24:279 EDT [DEBUG] wire - -<< "[0x9][0x9][0x9]<html>[\r][\n]" 2003/06/30 13:34:24:299 EDT [DEBUG] wire - -<< "[0x9][0x9][0x9]<head><title>CareerBuilder.com jobs. Search by field of interest, keyword, city, state, or other options and find the job you want.</title>[\r][\n]"
-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 4:36 PM
To: Ross Rankin
Subject: RE: Cookie Issues
Ross, Sorry for not being clear enough. Try setting HttpMethodBase#setStrictMode(boolean) to true.
I hope this helps
Oleg
On Fri, 2003-06-27 at 22:12, Ross Rankin wrote:
I tried both NETSCAPE_DRAFT and RFC2109 and the trace of the post shows
it
has separate lines for each cookie.
Ross
-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 3:43 PM
To: Commons HttpClient Project
Subject: RE: Cookie Issues
Ross,
However I noticed in my proxy traces the browser put all the cookies
in
one
line instead of separate lines for each cookie. Could that cause a
problem?
Try using strict mode. In strict mode all cookies are sent as one 'Cookie' header.
cheer
Oleg
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]
