Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the COMBINED_LOG_FORMAT compile-time option to althttpd.c. Also catch errors opening a /tmp file and report them. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f5c16dc36c1b5d2a2b372375d74d6b6d |
User & Date: | drh 2012-05-31 08:10:51.137 |
Context
2012-06-02
| ||
18:50 | Bug fix in althttpd.c: Include the port number on the HTTP_HOST cgi environment variable. (check-in: c22354d66a user: drh tags: trunk) | |
2012-05-31
| ||
08:10 | Add the COMBINED_LOG_FORMAT compile-time option to althttpd.c. Also catch errors opening a /tmp file and report them. (check-in: f5c16dc36c user: drh tags: trunk) | |
08:00 | Adjust the search script to change an empty title into "No Title". (check-in: d53c90f145 user: drh tags: trunk) | |
Changes
Changes to misc/althttpd.c.
︙ | ︙ | |||
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | time(&now); pTm = localtime(&now); strftime(zDate, sizeof(zDate), "%Y-%m-%d %H:%M:%S", pTm); times(&sTms); rScale = 1.0/(double)sysconf(_SC_CLK_TCK); chdir((zRoot && zRoot[0]) ? zRoot : "/"); if( (log = fopen(zLogFile,"a"))!=0 ){ fprintf(log, "%s %s %s://%s%s %s %s %d %d %g %g %g %g %d %d %s %s\n", zDate, zRemoteAddr, zHttp, zHttpHost, zScript, zReferer, zReplyStatus, nIn, nOut, rScale*sTms.tms_utime, rScale*sTms.tms_stime, rScale*sTms.tms_cutime, rScale*sTms.tms_cstime, (int)(now - beginTime), nRequest, zAgent, zRM ); fclose(log); nIn = nOut = 0; } } if( closeConnection ){ exit(a); } | > > > > > > > > | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | time(&now); pTm = localtime(&now); strftime(zDate, sizeof(zDate), "%Y-%m-%d %H:%M:%S", pTm); times(&sTms); rScale = 1.0/(double)sysconf(_SC_CLK_TCK); chdir((zRoot && zRoot[0]) ? zRoot : "/"); if( (log = fopen(zLogFile,"a"))!=0 ){ #ifdef COMBINED_LOG_FORMAT strftime(zDate, sizeof(zDate), "%d/%b/%Y:%H:%M:%S %z", pTm); fprintf(log, "%s - - [%s] \"%s %s %s\" %s %d \"%s\" \"%s\"\n", zRemoteAddr, zDate, zMethod, zScript, zProtocol, zReplyStatus, nOut, zReferer, zAgent); #else strftime(zDate, sizeof(zDate), "%Y-%m-%d %H:%M:%S", pTm); fprintf(log, "%s %s %s://%s%s %s %s %d %d %g %g %g %g %d %d %s %s\n", zDate, zRemoteAddr, zHttp, zHttpHost, zScript, zReferer, zReplyStatus, nIn, nOut, rScale*sTms.tms_utime, rScale*sTms.tms_stime, rScale*sTms.tms_cutime, rScale*sTms.tms_cstime, (int)(now - beginTime), nRequest, zAgent, zRM ); #endif fclose(log); nIn = nOut = 0; } } if( closeConnection ){ exit(a); } |
︙ | ︙ | |||
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | MakeLogEntry(0); exit(0); } sprintf(zTmpNamBuf, "/tmp/-post-data-XXXXXX"); zTmpNam = zTmpNamBuf; mkstemp(zTmpNam); out = fopen(zTmpNam,"w"); zBuf = SafeMalloc( len ); alarm(15 + len/2000); n = fread(zBuf,1,len,stdin); nIn += n; fwrite(zBuf,1,n,out); free(zBuf); fclose(out); | > > > > > > > > > > > | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | MakeLogEntry(0); exit(0); } sprintf(zTmpNamBuf, "/tmp/-post-data-XXXXXX"); zTmpNam = zTmpNamBuf; mkstemp(zTmpNam); out = fopen(zTmpNam,"w"); if( out==0 ){ StartResponse("500 Cannot create /tmp file"); nOut += printf( "Content-type: text/html\r\n" "\r\n" "Could not open \"%s\" for writing\n" "</body>\n", zTmpNam ); MakeLogEntry(0); exit(0); } zBuf = SafeMalloc( len ); alarm(15 + len/2000); n = fread(zBuf,1,len,stdin); nIn += n; fwrite(zBuf,1,n,out); free(zBuf); fclose(out); |
︙ | ︙ |