🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1693

Re: TIdHTTP and Cookie (newby question)

#1693
From: Richard Kavanagh
Date: Wed, 22 Nov 2006 18:31
86 lines
3987 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:45648f67@newsgroups.borland.com...
>
> "Richard Kavanagh" <dd.foldhill@google-ignore-mail.com> wrote in message
> news:45642bbb$1@newsgroups.borland.com...
>
>> The cookie is stored in IE's cookie directory and looks like this:-
>
> Indy has no concept of IE's cookies (or any other browser's cookies, for
> that matter).  You have to parse the cookie file yourself and then add it 
> to
> the CookieManager manually.
>
>> Going from back to front, I assume the star is some terminating symbol
>
> Yes.
>
>> the previous four numbers are FILETIME numbers indicating I know what 
>> not.
>
> From back to front, they are creation time high/low DWORDs and expire time
> high/low DWORDs.  More specifically, they are Win32 API FILETIME values.
>
>> Not sure what 1536 stands for.
>
> Flags that control the cookie's behavior.
>
>> The first two probably mean authority and some over-complicated password
>
> They are the cookie's name and value.
>
>> followed by the domain.
>
> It is the domain and path that the cookie is valid for.
>
>> Looking at past correspondence on the same or similar subjects all they
>> say is that the CookieManager does it all for you
>
> Correct.
>
>> there is no CookieManager.
>
> Yes, there is.  TIdHTTP has a CookieManager property of type
> TIdCookieManager.  Such a component exists on the Component Palette.  If 
> you
> do not provide your own CookieManager object to that property, then a
> default one is created internally when TIdHTTP sends a request.
>
>> How do I instantiate one and more importantly initialize it with the 
>> above
> cookie?
>
> Indy's cookie support requires the cookie text to be formatted according 
> to
> how they are transmitted over HTTP, not how they are stored in files.
> Cookie storage is a browser-specific operation.  Only the HTTP format is
> standardized.  As such, you will have to load the cookie data from file 
> and
> re-format into a text value that Indy can consume properly.  For example:
>
>    ULONG ulFlags = 1536;
>
>    TIdCookieRFC2109 *Cookie =
> IdHTTP1->CookieManager->CookieCollection->Add();
>
>    Cookie->CookieName = "auth";
>    Cookie->Value = "7e5a7cec0769ed530cad95244bb62b44";
>    Cookie->Domain = "einstein.phys.uwm.edu";
>    Cookie->Path = "/";
>    Cookie->Secure = (ulFlags & 0x0001);
>
> Refer to the following page for more details:
>
>    HTTP::Cookies support for Microsoft Internet Explorer
>    http://www.geocities.com/typopl/msieinfo.htm
>
>
> Gambit

Thanks Remy,
 This has given me a start. However there is still no CookieManager. IdHTTP 
has a property that is a pointer to something called CookieManager of type 
TIdCookieManager; however its value is NULL. So how do I instantiate and 
initialise one. The help files are not clear to me.
Richard
Technical Details
Message-ID: <45649763@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45642bbb$1@newsgroups.borland.com> <45648f67@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,68afa507f0d6b215
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Richard Kavanagh" <dd.foldhill@google-ignore-mail.com>
From: "Richard Kavanagh" <dd.foldhill@google-ignore-mail.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45642bbb$1@newsgroups.borland.com> <45648f67@newsgroups.borland.com>
Subject: Re: TIdHTTP and Cookie (newby question)
Date: Wed, 22 Nov 2006 18:31:01 -0000
Lines: 90
Organization: Foldhill
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.71.21.61
Message-ID: <45649763@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1164220259 82.71.21.61 (22 Nov 2006 10:30:59 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail