Idhttp post session expire

谁都会走 提交于 2019-12-11 19:35:59

问题


I'm using Idhttp (indy10 with delphi-xe2) to post form, but I get session expired message from the site, although I've already set cookie manager. Thank you.

procedure TForm2.IdCookieManager1NewCookie(ASender: TObject; ACookie: TIdCookie;
var VAccept: Boolean);
begin
  ShowMessage(Acookie.CookieText);
end;

The result from ShowMessage is: ASP.NET_SessionId=enn1xnqde1o1rduedels5fqp; Path=/; Domain=www8.ticketingcentral.com; HttpOnly; Max-Age=252028195945; Expires=Fri, 31-Dec-9999 16:59:59 GMT


回答1:


When both Max-Age and Expires are present in a cookie, Max-Age takes priority and Expires is ignored, per RFC 6265. Max-Age is expressed in seconds from the current clock time. A Max-Age value of 252028195945 is ~7991 years in the future! Adding that the current clock creates a date in the year 10004, which TDateTime cannot represent (9999 is the highest year it supports). So you are likely getting a rounding issue with the expiration date being set to a negative value, thus representing a date in the past, not the future, thus expiring the cookie before it can ever be sent back to the HTTP server.



来源:https://stackoverflow.com/questions/17705391/idhttp-post-session-expire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!