Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The log file for althttpd is now RFC-4180 CSV. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | 3.7.17 |
Files: | files | file ages | folders |
SHA1: |
52bfa21f48e14a29a899840ca3fe3416 |
User & Date: | drh 2013-07-15 11:17:18.994 |
References
2013-07-15
| ||
17:11 | The log file for althttpd is now RFC-4180 CSV. Cherry-pick merge from check-in [52bfa21f48e14a29]. (check-in: 93ba1a8d9d user: drh tags: trunk) | |
Context
2013-07-19
| ||
20:22 | Put a yellow background on the prerelease snapshots on the download page. (check-in: c032a10b8b user: drh tags: 3.7.17) | |
2013-07-15
| ||
17:11 | The log file for althttpd is now RFC-4180 CSV. Cherry-pick merge from check-in [52bfa21f48e14a29]. (check-in: 93ba1a8d9d user: drh tags: trunk) | |
11:17 | The log file for althttpd is now RFC-4180 CSV. (check-in: 52bfa21f48 user: drh tags: 3.7.17) | |
2013-06-26
| ||
19:13 | Add the "Pre-release Snapshot" heading to the download page, with the ability to include winrt81 VSIX snapshots. (check-in: a8228d3c37 user: drh tags: 3.7.17) | |
Changes
Changes to misc/althttpd.c.
︙ | ︙ | |||
144 145 146 147 148 149 150 | static int useHttps = 0; /* True to use HTTPS: instead of HTTP: */ static char *zHttp = "http"; /* http or https */ static int useTimeout = 1; /* True to use times */ static int ipv6Only = 0; /* Use IPv6 only */ static int ipv4Only = 0; /* Use IPv4 only */ /* | | < < < < | | | > > | > | > > > > | > > > < | | | | | < < < | > > > > > > > > > > > > > > > > > | > | | | | | | | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 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 233 234 235 236 237 238 239 240 241 | static int useHttps = 0; /* True to use HTTPS: instead of HTTP: */ static char *zHttp = "http"; /* http or https */ static int useTimeout = 1; /* True to use times */ static int ipv6Only = 0; /* Use IPv6 only */ static int ipv4Only = 0; /* Use IPv4 only */ /* ** Double any double-quote characters in a string. */ static char *Escape(char *z){ int i, j; int n; char c; char *zOut; for(i=0; (c=z[i])!=0 && c!='"'; i++){} if( c==0 ) return z; n = 1; for(i++; (c=z[i])!=0; i++){ if( c=='"' ) n++; } zOut = malloc( i+n+1 ); if( zOut==0 ) return ""; for(i=j=0; (c=z[i])!=0; i++){ zOut[j++] = c; if( c=='"' ) zOut[j++] = c; } zOut[j] = 0; return zOut; } /* ** Make an entry in the log file. If the HTTP connection should be ** closed, then terminate this process. Otherwise return. */ static void MakeLogEntry(int a){ FILE *log; if( zTmpNam ){ unlink(zTmpNam); } if( zLogFile && !omitLog ){ time_t now; struct tm *pTm; struct rusage self, children; int waitStatus; char zDate[200]; char *zRM = zRemoteUser ? zRemoteUser : ""; if( zScript==0 || zScript[0]==0 ) zScript = ""; if( zRemoteAddr==0 || zRemoteAddr[0]==0 ) zRemoteAddr = ""; if( zHttpHost==0 || zHttpHost[0]==0 ) zHttpHost = ""; if( zReferer==0 || zReferer[0]==0 ) zReferer = ""; if( zAgent==0 || zAgent[0]==0 ) zAgent = ""; time(&now); pTm = localtime(&now); strftime(zDate, sizeof(zDate), "%Y-%m-%d %H:%M:%S", pTm); waitpid(-1, &waitStatus, WNOHANG); getrusage(RUSAGE_SELF, &self); getrusage(RUSAGE_CHILDREN, &children); 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); /* Log record files: ** (1) Date and time ** (2) IP address ** (3) URL being accessed ** (4) Referer ** (5) Reply status ** (6) Bytes received ** (7) Bytes sent ** (8) Self user time ** (9) Self system time ** (10) Children user time ** (11) Children system time ** (12) Total wall-clock time * (13) Request number for same TCP/IP connection ** (14) User agent ** (15) Remote user */ fprintf(log, "%s,%s,\"%s://%s%s\",\"%s\",%s,%d,%d,%d,%d,%d,%d,%d,%d,\"%s\",\"%s\"\n", zDate, zRemoteAddr, zHttp, Escape(zHttpHost), Escape(zScript), Escape(zReferer), zReplyStatus, nIn, nOut, (int)(self.ru_utime.tv_sec*1000000 + self.ru_utime.tv_usec), (int)(self.ru_stime.tv_sec*1000000 + self.ru_stime.tv_usec), (int)(children.ru_utime.tv_sec*1000000 + children.ru_utime.tv_usec), (int)(children.ru_stime.tv_sec*1000000 + children.ru_stime.tv_usec), (int)(now - beginTime), nRequest, Escape(zAgent), Escape(zRM) ); #endif fclose(log); nIn = nOut = 0; } } if( closeConnection ){ |
︙ | ︙ | |||
941 942 943 944 945 946 947 | nIn += strlen(zLine); zFieldName = GetFirstElement(zLine,&zVal); if( zFieldName==0 || *zFieldName==0 ) break; RemoveNewline(zVal); if( strcasecmp(zFieldName,"User-Agent:")==0 ){ zAgent = StrDup(zVal); | < | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | nIn += strlen(zLine); zFieldName = GetFirstElement(zLine,&zVal); if( zFieldName==0 || *zFieldName==0 ) break; RemoveNewline(zVal); if( strcasecmp(zFieldName,"User-Agent:")==0 ){ zAgent = StrDup(zVal); }else if( strcasecmp(zFieldName,"Accept:")==0 ){ zAccept = StrDup(zVal); }else if( strcasecmp(zFieldName,"Content-length:")==0 ){ zContentLength = StrDup(zVal); }else if( strcasecmp(zFieldName,"Content-type:")==0 ){ zContentType = StrDup(zVal); }else if( strcasecmp(zFieldName,"Referer:")==0 ){ |
︙ | ︙ |