+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...
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();
void url(char *buf);
void escputs1(char *strbuf, int nbsp);
long extract_long(char *source, long int parmnum);
+void dump_vars(void);
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);
* 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);
RETSIGTYPE timeout(int signum) {
- printf("\rConnection timed out.\n");
+ fprintf(stderr, "Connection timed out.\n");
exit(3);
}
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);
}
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);
}
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);
}
{
char buf[256];
- sprintf(buf,"%s\n",string);
+ sprintf(buf,"%s\n", string);
serv_write(buf, strlen(buf));
}
/*
* 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) {
va_start(arg_ptr, format);
vsprintf(wptr->w_data, format, arg_ptr);
va_end(arg_ptr);
-
}
int wContentLength(void) {