问题
I have this horribly stripped delphi code that basically login to server, save cookie in a global cookie manager, then upload files in threads (using Delphi 2010 + Indy 10.4736)
Each thread reads the global cookie manager and upload the file. Server side, I'm using PHP with CodeIgniter.
Everything works just fine, except that CodeIgniter has this sess_time_to_update setting in config.
This *sess_time_to_update* defaults to 300 seconds after which CodeIgniter completely regenerate the session id.
This is good for security, but this also invalidates my login/cookie info in indy.
My question is: how can I avoid this without adjusting *sess_time_to_update*? Is there some setting in Indy to make it aware of the session id? Should I add a timer and automatically re-login every 300 seconds (or less)? What's the best approach to make Indy handle this situation?
Thanks!
EDIT FWIW: the global cookie manager contains something like this
回答1:
When CodeIgniter generates a new session, it should include the session ID in the cookies for each response it sends. Update your global cookie list so that subsequent requests will use the new ID instead of continuing to use the original value.
来源:https://stackoverflow.com/questions/9830746/codeigniter-sess-time-to-update-and-indy-cookies