To recap, it worked fine when I used (url) instead of (redirect).
However the generated URL incur two problems:

1.) It looks horrible.
2.) Subsequent AJAX calls are using a relative path and I don't want
to hardcode absolute paths in the JS, hence they won't work and the
application fails since it relies on them.

I was forgot to save the IRC buffer today so I didn't catch the patch
but I remembered the zeroing out of Http1, anyway I tried simply doing
this is in the entrypoint:

(de start ()
   (off *JS)
   (zero *Http1)
   (if (getUsr) (desktop) (signin)))

Note the (zero *Http1). That approach seems to be working, I can
submit without any problems but I don't know if it will hold up,
tomorrow will tell.

One very strange thing though, the HTML output looks like this when
the form first loads:

*start*
408
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns=3D"http://www.w3.org/1999/xhtml"; xml:lang=3D"en" lang=3D"en">
..
</html>

0
*end*

Note the initial 408 and the final 0.

Check it out live here: http://vizreader.com/ at the moment I'm
getting 438 instead of 408.

/Henrik



On Tue, Nov 24, 2009 at 8:55 PM, Henrik Sarvell <[email protected]> wrote:
> This is odd, the problem seems to be happening when I switch machines,
> I logged out and in several times at work today to try and trigger the
> problem. When I came home I still had the cookie so everything worked
> ok, I logged out, looks like this now:
>
> (de logout ()
> =A0 (setq *Cookies NIL)
> =A0 (cookie 'uid NIL)
> =A0 (signin))
>
> No redirects anymore, and when I tried to log back in I got exactly
> the same problem, despite removing the redirect and having (start)
> look like this:
>
> (de start () (off *JS) (if (getUsr) (desktop) (signin)))
>
> So no JS either. If you're out of ideas I'll try to reproduce the
> problem with a simple app that you can easily run.
>
> /Henrik
>
>
> On Tue, Nov 24, 2009 at 10:57 AM, Henrik Sarvell <[email protected]> wro=
te:
>> Yes (redir) is just a shortcut to:
>>
>> (de redir (Func)
>> =A0 (redirect (pack *Domain (or Func "@desktop"))))
>>
>>>>redirecting causes you to lose part of the session's context<<
>> Good to know.
>>
>> I'm sorry, it seems like I missed to list (start) earlier:
>>
>> (de start () (if (getUsr) (desktop) (signin)))
>>
>> This is the entry point, it will try and get a user object with the
>> help of the user id in the cookie, if it can't it will simply call
>> signin which when submitted routes to the dead end (sometimes).
>>
>> In fact (usrQuit) and (logout) actually doesn't have anything to do
>> with the problem at hand since they are not called at all. I'm sorry
>> that I've been unnecessarily confusing.
>>
>> I suppose we're back to the beginning here if manipulating *SesId
>> won't help me and since I'm not doing unnecessary redirects in this
>> case?
>>
>> Obviously the form is rendered correctly and when I submit the
>> following should be executed since I'm pretty sure I enter the right
>> password:
>>
>> (prog
>> =A0(cookie 'uid Uid)
>> =A0(setq *Cookies (cons 'uid Uid))
>> =A0(redir))
>>
>> And (redir) should render the desktop. However somehow something else
>> cuts in between, but only sometimes when the server has been running
>> for some time, never when I just restarted it.
>>
>> Could this thing that captures the button click before I have time to
>> redirect be something in the new JavaScript stuff you've been doing
>> lately?
>>
>>
>>
>>
>> On Tue, Nov 24, 2009 at 10:01 AM, Alexander Burger <[email protected]>=
 wrote:
>>> On Tue, Nov 24, 2009 at 09:27:16AM +0100, Henrik Sarvell wrote:
>>>> I think I understand, how would I properly log someone out of the
>>>> normal GUI, ie when using (app) et al, setting *SesId to NIL maybe? I
>>>> just browsed http.l and noticed that variable.
>>>
>>> I would not manipulate '*SesId'. This would just give errors due to
>>> illegal accesses to the session.
>>>
>>> I use "lib/adm.l", which has functions for login and logout. I'm not
>>> sure in your case, but for terminating a session just (bye) might also
>>> suffice.
>>>
>>>
>>>> (de usrQuit ()
>>>> =A0 (let Usr (getUsr)
>>>> =A0 =A0 =A0(or Usr (redir "@logout"))))
>>>
>>> What does 'redir' do? Something like 'redirect' in "lib/http.l"? Then i=
t
>>> would be better to call (logout) directly instead of redirecting to
>>> "@logout", wouldn't it? Also, this would avoid an additional HTTP
>>> transaction.
>>>
>>>
>>>> So the following redirects to logout if the user id is not in a cookie=
:
>>>>
>>>> (de logout ()
>>>> =A0 =A0(setq *Cookies NIL)
>>>> =A0 =A0(cookie 'uid NIL)
>>>> =A0 =A0(redir "@start"))
>>>
>>> Same here. I would directly call 'start' or any other functions needed.
>>>
>>>
>>>> (de signin ()
>>>> =A0 =A0(app)
>>>> =A0 =A0(action
>>>> =A0 =A0 =A0 (html 0 "RSS Reader" *Css NIL
>>>> =A0 =A0 =A0 =A0 =A0(form NIL
>>>> =A0 =A0 =A0 =A0 =A0 =A0 (<table> NIL NIL NIL
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL "Username" =A0(gui 'uname '(=
+TextField) 10))
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL "Password" =A0(gui 'pwd =A0 =
'(+PwField) =A0 10))
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (gui '(+Button) "Login"
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'(let Uid (chkLogin (val> (=
: home uname)) (val>
>>>> (: home pwd)))
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if Uid
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (prog
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(cookie=
 'uid Uid)
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(setq *=
Cookies (cons 'uid Uid))
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(redir)=
)
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (err "Could no=
t login.")))))
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL (<href> "Sign Up" "@register=
")))))))
>>>>
>>>> It was after pressing the Login button here I got the problem,
>>>> redirecting to, and rendering the login form was not a problem.
>>>
>>> Thre redirecting causes you to lose part of the session's context.
>>> Perhaps it all works if you just do the processig directly, as I
>>> suggested? The code will probably also become much simpler.
>>>
>>> You could try to just use the 'login' function from "lib/adm.l", as in
>>> "app/gui.l". I think that it has all necessary mechanisms.
>>>
>>> Cheers,
>>> - Alex
>>> --
>>> UNSUBSCRIBE: mailto:[email protected]?subject=3dunsubscribe
>>>
>>
>
-- 
UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe

Reply via email to