Re: reuse HTRequest

Richard Atterer <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
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
  ¯ '` ¯
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.