oldbloke: (Default)
Add MemoryShare This Entry
posted by [personal profile] oldbloke at 12:36pm on 09/07/2007
Can I send a cookie to the browser without starting a new page?
From a Perl CGI?
There are 8 comments on this entry. (Reply.)
 
posted by [identity profile] spoonrefuter.livejournal.com at 11:39am on 09/07/2007
Don't think so, unless you use Javascript in the generated HTML.
 
posted by [identity profile] oldbloke.livejournal.com at 12:04pm on 09/07/2007
Best deal I can think of then is to do it in one of those self-closing windows. Or a 1x1pixel one...
 
posted by [identity profile] spoonrefuter.livejournal.com at 12:06pm on 09/07/2007
Or an 1x1 iframe ?
 
posted by [identity profile] blue-condition.livejournal.com at 12:26pm on 09/07/2007
Isn't that precisely how a lot of naughty sites put tracking cookies on? ;)
 
posted by [identity profile] spoonrefuter.livejournal.com at 12:59pm on 09/07/2007
I wouldn't know anything about naughty sites... Honest Guv.
 
posted by [identity profile] oldbloke.livejournal.com at 01:27pm on 09/07/2007
's alright, if the cookie doesn't already exist (or has bad content) I have to build a form for a login which will be LDAP checked anyway, and the page written in response to the LDAP check can set the cookie.
 
posted by [identity profile] caramel-betty.livejournal.com at 09:52pm on 09/07/2007
That half-reminds me of a system at work I documented recently.

Basically, people get redirected through two layers of shit. First off, they get a form where they log in. When submitted, this sends back a HTTP redirect (302, I think) to /session123456/foo.html but also sets a cookie to 123456. When they request /session123456/foo.html but also send the cookie, they get HTTP redirected to /session/foo.html (and they rely on the cookie for the rest of the session); those without cookies carry on using the session ID in URL thingermy. Two redirects to hack about with cookies, but the user pretty much never sees anything going on.

Seems to work pretty well. A bit annoying to write as an infrastructure, but it seems to be easy to ignore once you're writing actual pages using it. Works pretty neatly.
 
posted by [identity profile] imc.livejournal.com at 12:32am on 10/07/2007
Not quite as complicated as LiveJournal's cookie scheme

May

SunMonTueWedThuFriSat
        1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29 30
 
31