🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1458

Re: TIdCookieManager and threads

#1458
From: Remy Lebeau (TeamB)
Date: Mon, 20 Dec 2004 23:51
44 lines
2791 bytes
"Bill D. Pirkle" <mbpirkle@NOSPAM.att.net> wrote in message
news:41c74be0.158720888@newsgroups.borland.com...

> Now I need to use cookies with some of these sites.  I know I need
> to attach a TIdCookieManager to each TIdHttp object (and make
> sure that AllowCookies is true).

By default, TIdHTTP instantiates its own TIdCookieManager internally if you
do not provide your own.

You do need to make sure the AllowCookies property is set to true.

> My question is:  should I dynamically create a separate cookie manager
> for each thread?

Unless you have some compelling reason to share cookies across threads, then
you should use separate instances.

> Or should I use one master cookie manager that all the threads
> share?  If they share, are there any simultaneous access worries
> that I need to sort out?

TIdCookieManager provides its own thread synching internally.

> The advantage of sharing would seem to be that if I need to carry on
> an extended conversation with a particular server, the shared cookie
> manager just magically handles everything.  So (for example) I might
> need to download and display info, wait for a user response, and then
> do more communications with the Web server.  The Web server
> should see this as the same user session.

Why would you need a shared manager for that?  If a single thread is
handling the entire conversation, then a local cookie manager would handle
all of the cookies for that conversation.

> With a shared cookie manager, my hope is that everything would be
> okay, even if I use different thread (and therefore different TIdHttp)
> objects for the different phases of the conversation.

Why would you use different threads to handle the conversation?


Gambit
Technical Details
Message-ID: <41c76616$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41c74be0.158720888@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,659a1bc0f4fd10aa
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <41c74be0.158720888@newsgroups.borland.com>
Subject: Re: TIdCookieManager and threads
Date: Mon, 20 Dec 2004 15:51:00 -0800
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41c76616$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103586838 68.69.17.41 (20 Dec 2004 15:53:58 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail