W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2003

Re: reuse HTRequest

From: Jerry G. Chiuan <jerry@oridus.com>
Date: Wed, 3 Sep 2003 18:13:11 -0700
Message-ID: <1a5001c37281$b52081e0$25a8a8a8@piglet>
To: <www-lib@w3.org>
Cc: "Akritidis Xristoforos" <cakrit@hol.net>, "Richard Atterer" <richard@list03.atterer.net>

Hi All,
I found that HTRequest can't be shared with multi-threads even I do
synchronize it, I don't know why
It must be due to restriction from internal implementation
But it can be reused by single thread for sure
Therefore, I have to constrcuct individual HTRequest, all of those stuff,
for every single thread, and destrcut it once it won't be used any more by
that thread.
I can't only construct one and reuse it for all threads

- Jerry


>
> On Tue, Sep 02, 2003 at 06:03:19PM -0700, Jerry G. Chiuan wrote:
> > I would like to reuse HTRequest to keep sending data, e.g.
>
> Ah, interesting, I hadn't noticed that HTRequest_clear() exists!
>
> In my code, I have been successful in reusing HTRequest objects. When
doing
> this, make sure to reset any altered attributes to their defaults. For
> example, if you add extra headers sometimes (pragma no-cache,
if-mod-since,
> ranges etc), remove them again.
>
> Some snippets - pragma no-cache:
>
>   if (pragmaNoCache)
>     HTRequest_addGnHd(request, HT_G_PRAGMA_NO_CACHE);
>   else
>     HTRequest_setGnHd(request, static_cast<HTGnHd>(HTRequest_gnHd(request)
>                                                    &
~HT_G_PRAGMA_NO_CACHE));
>
> Ranges:
>
>   HTRequest_deleteRange(request); // Delete old range, if any
>   HTRequest_addRange(request, "bytes", "1234-"); // Add new range
>
> Cheers,
>
>   Richard
>
> PS: Please don't quote entire completely unrelated postings at the bottom
> of your mail.
> --
>   __   _
>   |_) /|  Richard Atterer     |  GnuPG key:
>   | \/|  http://atterer.net  |  0x888354F7
>    '` 
>
>
Received on Wednesday, 3 September 2003 21:10:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:43 GMT