Changeset 1731
- Timestamp:
- 04/09/2007 07:58:57 PM (17 months ago)
- Location:
- branches/lighttpd-1.4.x
- Files:
-
- 2 modified
-
NEWS (modified) (1 diff)
-
src/mod_accesslog.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.4.x/NEWS
r1730 r1731 29 29 * fixed accesslog.use-syslog in a conditional and the caching of the 30 30 accesslog for files (fixes #1064) 31 * fixed various crashes at startup on broken accesslog.format strings (#1000) 32 * fixed handling of %% in accesslog.format 31 33 32 34 -
branches/lighttpd-1.4.x/src/mod_accesslog.c
r1729 r1731 160 160 size_t i, j, k = 0, start = 0; 161 161 162 if (format->used == 0) return -1; 163 162 164 for (i = 0; i < format->used - 1; i++) { 163 164 165 switch(format->ptr[i]) { 165 166 case '%': 166 if ( start != i) {167 /* copy the string */167 if (i > 0 && start != i) { 168 /* copy the string before this % */ 168 169 if (fields->size == 0) { 169 170 fields->size = 16; … … 184 185 } 185 186 186 187 187 /* we need a new field */ 188 188 … … 200 200 case '>': 201 201 case '<': 202 /* only for s */ 202 /* after the } has to be a character */ 203 if (format->ptr[i+2] == '\0') { 204 log_error_write(srv, __FILE__, __LINE__, "s", "%< and %> have to be followed by a format-specifier"); 205 return -1; 206 } 207 203 208 204 209 for (j = 0; fmap[j].key != '\0'; j++) { … … 218 223 219 224 if (fmap[j].key == '\0') { 220 log_error_write(srv, __FILE__, __LINE__, "s s", "config: ", "failed");225 log_error_write(srv, __FILE__, __LINE__, "s", "%< and %> have to be followed by a valid format-specifier"); 221 226 return -1; 222 227 } 223 228 224 229 start = i + 3; 230 i = start - 1; /* skip the string */ 225 231 226 232 break; … … 233 239 234 240 if (k == format->used - 1) { 235 log_error_write(srv, __FILE__, __LINE__, "s s", "config: ", "failed");241 log_error_write(srv, __FILE__, __LINE__, "s", "%{ has to be terminated by a }"); 236 242 return -1; 237 243 } 244 245 /* after the } has to be a character */ 238 246 if (format->ptr[k+1] == '\0') { 239 log_error_write(srv, __FILE__, __LINE__, "ss", "config: ", "failed"); 247 log_error_write(srv, __FILE__, __LINE__, "s", "%{...} has to be followed by a format-specifier"); 248 return -1; 249 } 250 251 if (k == i + 2) { 252 log_error_write(srv, __FILE__, __LINE__, "s", "%{...} has to be contain a string"); 240 253 return -1; 241 254 } … … 259 272 260 273 if (fmap[j].key == '\0') { 261 log_error_write(srv, __FILE__, __LINE__, "s s", "config: ", "failed");274 log_error_write(srv, __FILE__, __LINE__, "s", "%{...} has to be followed by a valid format-specifier"); 262 275 return -1; 263 276 } 264 277 265 278 start = k + 2; 279 i = start - 1; /* skip the string */ 266 280 267 281 break; 268 282 default: 283 /* after the % has to be a character */ 284 if (format->ptr[i+1] == '\0') { 285 log_error_write(srv, __FILE__, __LINE__, "s", "% has to be followed by a format-specifier"); 286 return -1; 287 } 288 269 289 for (j = 0; fmap[j].key != '\0'; j++) { 270 290 if (fmap[j].key != format->ptr[i+1]) continue; … … 283 303 284 304 if (fmap[j].key == '\0') { 285 log_error_write(srv, __FILE__, __LINE__, "s s", "config: ", "failed");305 log_error_write(srv, __FILE__, __LINE__, "s", "% has to be followed by a valid format-specifier"); 286 306 return -1; 287 307 } 288 308 289 309 start = i + 2; 310 i = start - 1; /* skip the string */ 290 311 291 312 break; … … 782 803 buffer_append_string(b, get_http_method_name(con->request.http_method)); 783 804 break; 805 case FORMAT_PERCENT: 806 buffer_append_string(b, "%"); 807 break; 784 808 case FORMAT_SERVER_PORT: 785 809 buffer_append_long(b, srv->srvconf.port);

