Hi guys,
Nice to hear from you after a long time :)
Cookie mgmnt is not a Swazoo duty, it only provides all infrastructure
for it. You set a cookie by properly constructing a HTTPResponse.
Example from Aida:
AIDASite answerTo: aRequest
...
response := Swazoo.HTTPResponse ok.
response entity: <your html response>.
session cookie ifFalse: [response cookie: (self cookieHeaderFor: session)].
^response
AIDASite cookieHeaderFor: aSession
"set a permanent cookie on client (up to year 2010, enough?) "
"for secure sessions different id as for usual ! "
| id |
id := aSession lastRequest isEncrypted
ifTrue: [aSession secureId]
ifFalse: [aSession id].
^(WriteStream on: String new)
nextPutAll: self cookieName;
nextPutAll: '=';
nextPutAll: id printString;
nextPutAll: '; path=/; expires=Friday, 01-Jan-2010 01:00:00 GMT';
contents
In Aida I extended HTTPRequest with a method:
idFromCookie
"return session id from our cookie. nil if not aida field present in
cookie"
| stream part |
stream := self cookie readStream.
[stream atEnd] whileFalse:
[part := stream upTo: $; .
('aida9357*' match: part) ifTrue:
[^part readStream upTo: $=; upToEnd] ].
^nil
.. but event that hadn't been nessesary.
Cheers
Janko
Lukas Renggli wrote:
>> sorry stef, I had to deal with some cookie bug from
swazzo...
>
>
> Did you fix it and publish it on swazoo.This is important to report
> this kind of bug to janko. Jankoi how do we proceed? should david
> send you the fix?
Already a long time ago, I decided not to support cookies in SmallWiki
anymore. Still there are probably some deprecated messages dealing
with that, but I suggest not to cookies as they are generally not
worth the troubles. Therefor I suspect that the "cookie-bug" isn't a
problem with Swazoo but with SmallWiki ...
Cheers,
Lukas
--
Janko Mivsek
Systems Architect
EraNova d.o.o.
Ljubljana, Slovenia
http://www.eranova.si