diff -urN thttpd-2.21-21/libhttpd.c thttpd-2.21-22/libhttpd.c --- thttpd-2.21-21/libhttpd.c Wed Mar 20 17:12:32 2002 +++ thttpd-2.21-22/libhttpd.c Wed May 8 16:09:49 2002 @@ -1897,6 +1897,7 @@ hc->bpos=0; hc->bpos_u=0; hc->fsize=0; + hc->iscgi=0; #ifdef ERR404PERUSER hc->err404[0]='\0'; #endif @@ -3334,7 +3335,7 @@ /* Write the saved headers. */ (void) write( hc->conn_fd, headers, headers_len ); - + hc->fsize=0; /* Echo the rest of the output. */ for (;;) { @@ -3343,6 +3344,7 @@ return; if ( write( hc->conn_fd, buf, r ) != r ) return; + hc->fsize+=r; } } @@ -3465,6 +3467,9 @@ /* Interposer process. */ (void) close( p[1] ); cgi_interpose_output( hc, p[0] ); +#ifdef ADVCOUNTER + make_log_entry(hc,NULL); +#endif exit( 0 ); } (void) close( p[0] ); @@ -3550,13 +3555,13 @@ return -1; } if ( r == 0 ) - { + { unlisten( hc->hs ); cgi_child( hc ); } - + hc->iscgi=1; /* Parent process. */ - syslog( LOG_INFO, "spawned CGI process %d for file '%.200s'", r, hc->expnfilename ); +// syslog( LOG_INFO, "spawned CGI process %d for file '%.200s'", r, hc->expnfilename ); #ifdef CGI_TIMELIMIT /* Schedule a kill for the child process, in case it runs too long */ client_data.i = r; @@ -4013,6 +4018,7 @@ /* generate packet to be sent to the counter */ + if (hc->iscgi==1) return ; memset(log_outp,0,512); snprintf(log_outp,512,"%s|%s|/%s|%ld|%s|",hc->hostname,httpd_ntoa( &hc->client_addr ),hc->origfilename,hc->fsize,hc->referer); if ((write(UDSfd, log_outp,strlen(log_outp)) < 0) && (errno != EAGAIN)) diff -urN thttpd-2.21-21/libhttpd.h thttpd-2.21-22/libhttpd.h --- thttpd-2.21-21/libhttpd.h Wed Mar 20 17:12:32 2002 +++ thttpd-2.21-22/libhttpd.h Wed May 8 16:09:49 2002 @@ -152,6 +152,8 @@ off_t fpos,bpos,bpos_u; char* err404; /* Custom error404*/ int maxerr404; + /* needed if we want to do CGI traffic accounting .. */ + int iscgi; } httpd_conn; /* Methods. */