- From: Luke Gonze <applix!luke@uunet.uu.net>
- Date: Mon, 25 Mar 1996 11:05:12 -0500 (EST)
- To: applix!uunet!w3.org!www-talk@uunet.uu.net
This works for receiving requests from a browser. I haven't tested it in a real industrial strength situation yet. The first thing you'd need to improve is to handle requests larger than BUFSIZE. #define BUFSIZE 10000 int reader(int fd) { char buf[BUFSIZE+1]; char *bptr = buf; int n; int buflen; buflen = BUFSIZE; /* read the string itself */ while( (n = read(fd, bptr, buflen)) > 0){ bptr[n] = '\0'; bptr += n; buflen -= n; } /* if the output of this looks funny, by the way, keep in mind that ^M is ascii 13 */ printf("read from httpd server: \n%s\n",buf); if( buflen == BUFSIZE ) return(n); else return(BUFSIZE - buflen); } --- Luke Gonze --- luke@applix.com --- --- Software Engineer, Applix Espresso project ---
Received on Monday, 25 March 1996 11:56:38 UTC