Re: Testing
- Posted by jacquesd Oct 04, 2008
- 1222 views
Finally I localized the login bug. It is not in the euForum code but in datetime.e library. When in login form if the <remember me forever> checkbox is not checked, euforum code try to set a cookie that expires in 1 hour. the actual code is:
expire = dt:now_gmt() if web:post_has("login_forever") then expire = dt:add(expire,1,YEARS) else expire = dt:add(expire,1,HOURS) -- this return date prior du current date!! end if
the dt:add() function return a date prior to actual date so the browser doesn't set the cookie as it is already expired. This is a bug to be solved by the datetime.e library maintainer.
For my part I will replaced all 1 hours cookies by session cookies. Those expires when the browser is closed. Login that is not set forever will last the browser session.
Jacques
With this simple test program, I couldn't reproduce the bug. I am at -0400, and at the time of writing here are my times:
$ date Sat Oct 4 20:11:51 EDT 2008 $ date utc Sun Oct 5 00:11:53 UTC 2008 $
include std/datetime.e object expire = now_gmt() ? expire expire = add(expire, 1, HOURS) ? expire
$ exu dt.e {2008,10,5,0,9,26} {2008,10,5,1,9,26}
It is not clear to me why expire would be considered as being before the current date.
What I did is put debug code in procedure generate_response() to print cgi data to a file. when I don't check the <remember me forever> box I get a date in august at cgi output.
I ran the request at 22:20 october 4th and the cookie is:
Set-Cookie: euf_last_page=%3Fmodule%3Dforum%26action%3Dpost%26reply%5Fid%3D0%26quote%3D0; path=/; expires=Sun, 05-Aug-2008 03:18:41 GMT
this is not a question of seconds as you can see it a question of month backward.
I ran your test and the result is OK so it seem that the problem is not in dt:add() I jumped to fast on conclusion. But it is obvious that cgi output is not dated properly.
jacques.