0

I've encountered a wierd cookie behavior. I have python client which logs in to a remote server and executes a servlet code over there. But unfortunately I am not able to get the Set-Cookie:JSESSIONID back from the server. I was able to fix this problem by specifying the remote machine's IP address instead of it's hostname during the login.

Does anyone have an explanation for this behavior?

I am using this code in the client:

rdr_hndlr = self.RedirectHandler()
rdr_hndlr.set_rep_data(rep_data)
opnr = urllib2.build_opener(rdr_hndlr)
rep_rq = urllib2.Request(rep_servlet, rep_data)
try:
    res = opnr.open(rep_rq)
...

P.S. the hostnames and other network configurations are correctly configured as other Python clients are able to connect using the hostname from this machine to the server.

Thanks!

Ofir Prizat
  • 155
  • 1
  • 12
  • JSESSIONID is created when a new session is created. Are you sure that a session is created with request with hostname? – Keerthivasan Dec 22 '13 at 07:14
  • I am not sure, so it might not be created, but then the question would be why would a session not be created when using hostname instead of IP? – Ofir Prizat Dec 22 '13 at 07:21
  • This [link](http://stackoverflow.com/questions/595872/under-what-conditions-is-a-jsessionid-created) may help you learn about when JSESSSIONID is created – Keerthivasan Dec 22 '13 at 07:23
  • Thanks! Though, I still don't understand why should there be a difference between using hostname/IP, especially when other clients are able to login and get the session id while logging in using the hostname from the same machine to the same server. – Ofir Prizat Dec 22 '13 at 07:40
  • Yes, try to debug and find the difference in the requests. These kind of problems are very weird always ;) – Keerthivasan Dec 22 '13 at 07:42
  • Unfortunately, this issue occurs on a customer site :) – Ofir Prizat Dec 22 '13 at 08:27

0 Answers0