• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a URI from a program and checking cookies enabled

 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple program that submits a POST request to a web site. The page being accessed is a LogIn page. I have configured the request from my program to set all the request parameters and HTTP headers that would be set if the user was using a regular browser in order to fool the web site into thinking the request originated from a browser. When the request is made, the web site responds with content which, after dumping to a flat file, produces a page which instucts the user that their browser must be set to accept cookies.
I can't understand how the web site determined that I did not have cookies enabled. From the servers perspective, you need at least 1 1/2 rounds trip requests in order to determine if the browser has cookies enabled. In the first reponse, the web site will send a "Set-Cookie" header containing a sessions id which instructs the browser to resend this header for all subsequest requests. But in my case, I never see the "Set-Cookie" header, not even in the first response. I'm definitely looking for it, but I never see it.
The server must have a method for determining if cookies are enabled or not, even before the first response if committed, but there must be a way to fool the server.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the HttpClient toolkit to be found here. Frank would suggest the HttpUnit toolkit at sourceforge.
Both provide for full emulation of cookies, etc.
Bill
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! This is great info!
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
I downloaded the HttpClient toolkit from Jakarta and installed it. I ran my test using a sample program from the Jakarta site and I still get the same response as I did when I submitted the request from my own custom program. I still get the HTML screen indicating that cookies are not enabled on the first request. Weird.
Which type of CookiePolicy do you use? I tried them all.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic