W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2003

Performing a single Request

From: Stewart Johnson <stewart.johnson@ieee.org>
Date: Mon, 26 May 2003 01:27:08 +0930
To: www-lib@w3.org
Message-Id: <200305260127.08897.stewart.johnson@ieee.org>

G'day --

I've been using the the W3C libwww for a little while now, and I've generally 
had success. I'm having trouble figuring a new problem out, and I'm looking 
for some advice. Hopefully someone can find the time to steer me in the right 
direction! :^)

The tool I'm currently writing only ever needs to perform a POST request on a 
single server. It does this request once every half an hour, so for all 
intents and purposes the requests happen in isolation. I'm writing this tool 
in C++.

I have everything working okay, but I can't help but think there's an easier 
(and less verbose) way to do it. I'm initialising the library, creating my 
HTRequest and calling HTPostFormAnchorToChunk to get my result. That all 
seems correct, my problem is the next part:

I'm entering the eventloop using HTEventList_loop. I've previously registered 
a terminate_handler callback to catch the HTResponse of my HTRequest and save 
the status in the HTRequest's context, and then call HTEventList_stopLoop. 
That seems like a whole bunch of unnecessary effort. In addition, it feels 
ugly because the terminate_handler is a static function.

Is it easy to replace the HTEventList_loop? Is there another way of firing off 
my single HTRequest and catching the response, preferably all within the one 
function, rather than using a callback?

Any advice is greatly appreciated.

Received on Sunday, 25 May 2003 11:57:13 UTC

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