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

Re: terminate handler??

From: Francois Nicot <fnicot@silicom.fr>
Date: Wed, 19 Jul 2000 18:34:12 +0200
Message-ID: <3975D884.37B57087@silicom.fr>
To: Jim Marshall <jim_marshall2268@hotmail.com>
CC: www-lib@w3.org
Jim,

see my answers to your questions within your original text.

Jim Marshall wrote:

> I'm a newbie to libwww as well as net programming in C, my questions might
> be covered elsewhere (I've looked and can't find them) - so please direct to
> the location where I can get these answers without having to pester you.
>
> I have the need to post a form to a server, the server will process teh
> request and return some information (a URL) to me at which point I must make
> a GET request to this URL.  However; looking at the postform.c example (and
> most of the others) the terminate handler calls 'exit' which terminates the
> program.

are you sure you need these to steps ?
if you use  the POST method you are likely not to expect any answer  from the
server (it 's a bit like "fire and forget") whereas  if you use the GET method
to "send" your form to the server , you expect a document as an answer from the
server.


>
>
> questions:
> 1 - Can I return a value from the terminate handler which will result in the
> code continueing?  Currently if I return HT_OK it seems to get hung in a
> loop (specifically in HTEvtLst.c on this line  HTTRACE(THD_TRACE, "Event
> Loop.. One or more sockets were not through their connect phase - try
> again\n");).

if you still need to continue after your first answer you could have a look at
the terminate_handler function from w3c webbot. : http://www.w3.org/Robot/

it manages a context (Robot* robot) containing the number of pending requests
(mr->cnt).

the cleanup procedure depends on mr->cnt >= 0.

>
> 2 - Any type of examples available for doing the above type of program?  The
> postform.c is exactly what I need to post the request to the server, I then
> need to parse the response and issue a get.  Can I initiate a new request
> request from teh terminate handler (I doubt it).
>

yes, you can , assuming the  following code extracted from postform.c is
condtionnal and depends on the number of pending requests (see
http://www.w3.org/Robot/)

....
    /* Terminate libwww */
    HTProfile_delete();

    exit(0);
.....

>
> Please help, thanks
> -Jim
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Received on Wednesday, 19 July 2000 12:30:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:37 GMT