[AWS] Possible 'cookie' problem (AWS.Client.Parse_Header) ?
Charles Darcy
charlie@mullum.com.au
29 Jul 2003 21:53:03 +1000
Hi,
Should the AWS.Client.Parse_Header procedure set the
Connection.Cookie when the parsed cookie is a null string (ie there is
no cookie) ?
-- Existing code.
--
procedure Parse_Header (...) is
...
begin
...
Connection.Cookie := +Response.Header
(Answer, Messages.Set_Cookie_Token);
...
end Parse_Header;
I'm using AWS to fetch pages from a site which requires a login.
When I login, the site sends me a cookie. This cookie is added to the
headers of any subsequent GET's to the site, to verify the access.
My problem is that after I receive the cookie, the site sends
further messages which contain no cookie. In this case, Parse_Header
still sets Connection.Cookie to a null string. Any further GET's to the
site will now fail, since the verifying cookie is not present.
I changed the code to:
procedure Parse_Header (...) is
...
begin
...
declare
The_Cookie : Unbounded_String
:= +Response.Header (Answer,
Messages.Set_Cookie_Token);
begin
if The_Cookie /= "" then
Connection.Cookie := The_Cookie;
end if;
end;
...
end Parse_Header;
The Connection.Cookie is now only updated if a new cookie exists.
These changes fix my problem, but being new to AWS/networks/cookies, I'm
not sure if they are correct in every case ?
Any advice will be appreciated.
regards,
Charlie.