Performing a single Request

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.

TIA,
Stewart.

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