Re: reuse HTRequest

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 UTC