* Discovered that the HTTP socket problem is related to a socket that
authorArt Cancro <ajc@citadel.org>
Tue, 8 Dec 1998 20:47:04 +0000 (20:47 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 8 Dec 1998 20:47:04 +0000 (20:47 +0000)
          isn't properly lingering on close.  Temporarily hacked a sleep(10)
          into context_loop.c until it is figured out.

webcit/ChangeLog
webcit/auth.c
webcit/child.h
webcit/context_loop.c
webcit/tcp_sockets.c
webcit/webcit.c

index 0811d277c686f074eaf50962262929f0ab6a38f9..ec438d1058cbc3f9f220928bfa51f529e3f7db13 100644 (file)
@@ -1,3 +1,8 @@
+Tue Dec  8 15:45:42 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Discovered that the HTTP socket problem is related to a socket that
+         isn't properly lingering on close.  Temporarily hacked a sleep(10)
+         into context_loop.c until it is figured out.
+
 Mon Dec  7 17:03:18 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Did a little debugging, still trying to figure out why logging in
          displays "Connection reset by peer" error.  It used to work...
index ef8d83ef00db512b0ca4b33b4ff4dee3f8fb085b..3796b91adb9fefc88d1cbabf328417859ab60516 100644 (file)
@@ -102,6 +102,10 @@ void do_login(void) {
                output_headers();
                wprintf("<HTML><HEAD><TITLE>Nope</TITLE></HEAD><BODY>\n");
                wprintf("Your password was not accepted.\n");
+               wprintf("<HR><PRE>\n");
+               wprintf("%s\n", buf);
+               dump_vars();
+               wprintf("</PRE><HR>\n");
                wprintf("<HR><A HREF=\"/\">Try again</A>\n");
                wprintf("</BODY></HTML>\n");
                wDumpContent();
index d95ffb4686fcd24abb72b4989fbfa538517ed85a..070339dfb2dd1292425633ba83300d9850adf21e 100644 (file)
@@ -36,3 +36,4 @@ void escputs(char *strbuf);
 void url(char *buf);
 void escputs1(char *strbuf, int nbsp);
 long extract_long(char *source, long int parmnum);
+void dump_vars(void);
index 17085bf19ec6edf8b6afcfe8a814204364d09358..944619cf3ba1ad63f8d6d658c6dfb246a34ae1fb 100644 (file)
@@ -129,10 +129,12 @@ void *context_loop(int sock) {
        int ContentLength;
        int CloseSession = 0;
 
-       if ((req = malloc(sizeof(char[256][256]))) == NULL) {
-               printf("Can't malloc buffers; dropping connection.\n");
+       if ((req = malloc((long)sizeof(char[256][256]))) == NULL) {
+               sprintf(buf, "Can't malloc buffers; dropping connection.\n");
+               fprintf(stderr, "%s", buf);
+               write(sock, buf, strlen(buf));
                close (sock);
-               return NULL;
+               pthread_exit(NULL);
                }
 
        printf("Reading request from socket %d\n", sock);
@@ -250,6 +252,8 @@ void *context_loop(int sock) {
         * to support HTTP/1.1 "persistent" connections by looping back to
         * the top of this function.  For now, we'll just close.
         */
+       printf("   Lingering...\n");
+       sleep(10);
        printf("   Closing socket\n");
        close(sock);
 
index 34781617d6e9fd9b590b4f12c724f92021bc5157..017e1ea73e70b0e5c85e36f4a84e2aa7e602a6cd 100644 (file)
@@ -33,7 +33,7 @@ int serv_sock;
 
 
 RETSIGTYPE timeout(int signum) {
-       printf("\rConnection timed out.\n");
+       fprintf(stderr, "Connection timed out.\n");
        exit(3);
        }
 
@@ -53,7 +53,7 @@ int connectsock(char *host, char *service, char *protocol)
                sin.sin_port = pse->s_port;
                }
        else if ((sin.sin_port = htons((u_short)atoi(service))) == 0) {
-               fprintf(stderr,"can't get %s service entry\n", service);
+               fprintf(stderr, "Can't get %s service entry\n", service);
                return(-1);
                }
        
@@ -62,13 +62,13 @@ int connectsock(char *host, char *service, char *protocol)
                bcopy(phe->h_addr,(char *)&sin.sin_addr,phe->h_length);
                }
        else if ((sin.sin_addr.s_addr = inet_addr(host))==INADDR_NONE) {
-               fprintf(stderr,"can't get %s host entry: %s\n",
+               fprintf(stderr, "Can't get %s host entry: %s\n",
                        host,strerror(errno));
                return(-1);
                }
 
        if ((ppe=getprotobyname(protocol))==0) {
-               fprintf(stderr,"can't get %s protocol entry: %s\n",
+               fprintf(stderr, "Can't get %s protocol entry: %s\n",
                        protocol,strerror(errno));
                return(-1);
                }
@@ -80,7 +80,7 @@ int connectsock(char *host, char *service, char *protocol)
 
        s = socket(PF_INET,type,ppe->p_proto);
        if (s<0) {
-               fprintf(stderr,"can't create socket: %s\n",strerror(errno));
+               fprintf(stderr, "Can't create socket: %s\n", strerror(errno));
                return(-1);
                }
 
@@ -175,7 +175,7 @@ void serv_puts(char *string)
 {
        char buf[256];
 
-       sprintf(buf,"%s\n",string);
+       sprintf(buf,"%s\n", string);
        serv_write(buf, strlen(buf));
        }
 
index 9492d8832f1451fa1ff24a8d59fd0c460a88c99f..33907faae87343e3dd2d305658dbffa270d78fd7 100644 (file)
@@ -122,7 +122,7 @@ void free_urls(void) {
 /*
  * Diagnostic function to display the contents of all variables
  */
-void dump_vars() {
+void dump_vars(void) {
        struct urlcontent *u;
 
        for (u = urlstrings; u != NULL; u = u->next) {
@@ -158,7 +158,6 @@ void wprintf(const char *format, ...) {
                va_start(arg_ptr, format);   
                vsprintf(wptr->w_data, format, arg_ptr);   
                va_end(arg_ptr);   
-  
        }
 
 int wContentLength(void) {