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

Re: reuse HTRequest

From: Richard Atterer <richard@list03.atterer.net>
Date: Wed, 3 Sep 2003 16:01:16 +0200
To: "Jerry G. Chiuan" <jerry@oridus.com>
Cc: www-lib@w3.org, Akritidis Xristoforos <cakrit@hol.net>
Message-ID: <20030903140116.GB1589@nenya.lan>

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);
    HTRequest_setGnHd(request, static_cast<HTGnHd>(HTRequest_gnHd(request)
                                                   & ~HT_G_PRAGMA_NO_CACHE));


  HTRequest_deleteRange(request); // Delete old range, if any
  HTRequest_addRange(request, "bytes", "1234-"); // Add new range



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 15:19:31 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:56 UTC