$Log$
+Revision 1.120 1999/12/12 18:12:28 ajc
+* get http request: clear hold buffer before starting to read in HTTP request.
+ This was causing some requests to get corrupted.
+
Revision 1.119 1999/12/08 18:25:21 ajc
* Increased the size of the backlog queue length passed to accept() and made
it a configuration parameter in webcit.h
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
int a;
if (strlen(hold) == 0) {
+ strcpy(buf, "");
a = client_gets(sock, buf);
if (a<1) return(-1);
} else {
/*
* Find out what it is that the web browser is asking for
*/
+ memset(hold, 0, sizeof(hold));
do {
if (req_gets(sock, buf, hold) < 0) return;
+ fprintf(stderr, "%sReq: %s%s\n",
+ ( (req==NULL) ? "\033[32m" : "" ) ,
+ buf,
+ ( (req==NULL) ? "\033[0m" : "" ) );
if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
cookie_to_stuff(&buf[15], &desired_session,
NULL, NULL, NULL);
pthread_setspecific(MyConKey, (void *)TheSession);
TheSession->http_sock = sock;
TheSession->lastreq = time(NULL); /* log */
- fprintf(stderr, "%s\n", req->line);
session_loop(req); /* perform the requested transaction */
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
}
if (ContentLength > 0) {
+ fprintf(stderr, "Content length: %d\n", ContentLength);
content = malloc(ContentLength + 1);
read(WC->http_sock, content, ContentLength);
retval = client_read(sock, &buf[i], 1);
/*
- * Strip any trailing not-printable characters.
+ * Strip any trailing non-printable characters.
*/
buf[i] = 0;
while ((strlen(buf) > 0) && (!isprint(buf[strlen(buf) - 1]))) {