Static analyzer fixes;
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 21:53:16 +0000 (21:53 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 May 2011 21:53:16 +0000 (21:53 +0000)
  - fix uninitialized access in case of us sending 404
  - remove unneeded duplicate line.

webcit/context_loop.c

index b506428b02387551563e337fdebb50da2dea5318..6d01f640928bf93d744c302fb7ca645765ca53d5 100644 (file)
@@ -436,7 +436,6 @@ int ReadHTTPRequest (ParsedHttpHdrs *Hdr)
                StrBufExtract_token(HeaderName, Line, 0, ':');
 
                pchs = ChrPtr(Line);
-               pche = pchs + StrLength(Line);
                pch = pchs + StrLength(HeaderName) + 1;
                pche = pchs + StrLength(Line);
                while ((pch < pche) && isspace(*pch))
@@ -522,6 +521,9 @@ void context_loop(ParsedHttpHdrs *Hdr)
 
                do_404();
 
+               /* How long did this transaction take? */
+               gettimeofday(&tx_finish, NULL);
+
                lprintf(9, "HTTP: 404 [%ld.%06ld] %s %s \n",
                        ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) / 1000000,
                        ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) % 1000000,