W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

HTTPServ/HTServHTTP not accept'ing?

From: Niklas Wiberg <e95_nwi@it.kth.se>
Date: Tue, 21 Dec 1999 08:15:57 -0500 (EST)
Message-ID: <385F7EBF.D4EF727E@it.kth.se>
To: www-lib@w3.org
Hello,
I'm attempting to create a simple server application using libwww 5.2.8.
In order to get started, I've tried to change the listen.c example to
use HTTPServ instead of HTSocket.
The relevant code (from my modified listen.c) is:

/*<snip>*/
HTProtocol_add("http", "tcp", ms->port, NO, NULL, HTServeHTTP);

        /* Set up the request */
        ms->request = HTRequest_new();
        HTRequest_setOutputFormat(ms->request, DEFAULT_FORMAT);
        HTRequest_setOutputStream(ms->request,
                                  HTFWriter_new(ms->request, OUTPUT,
YES));

        /* Start listening on the socket */
        HTPrint("Listening on port %d\n", ms->port);
        if ((status = HTServeAbsolute("http://localhost", ms->request))
== NO) {
/*<snip>*/

The changes from the original listen.c code is in the first and the last
lines.
The problem is that this code does not result in any accept call. The
HTLoadSocket function calls SocketEvent, which does HTHostAccept, but
HTServeHTTP does not lead to any accept being done, as far as I can see.
(`netstat -anf inet` does not show anything listening on port 80, as
would be expected) 
Now, by looking at older versions of HTTPServe.c in the CVS repository,
I've found that prior to revision 2.18 of HTTPServ.c, there was a call
to HTDoAccept in HTServeHTTP. I can't find any explanation why it's been
removed anywhere.

Does anyone know the reason for the lack (or removal) of an accept'ing
function call in HTTPServ?
Could it be that the thought is that one should set up and handle server
TCP connections in the application?

Any feedback would be greatly appreciated.
Best Regards
Niklas Wiberg
Received on Tuesday, 21 December 1999 08:31:44 GMT

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