comparison src/http/ngx_http_log_handler.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 8b6db3bda591
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
131 u_char *line, *p; 131 u_char *line, *p;
132 size_t len; 132 size_t len;
133 ngx_http_log_t *log; 133 ngx_http_log_t *log;
134 ngx_http_log_op_t *op; 134 ngx_http_log_op_t *op;
135 ngx_http_log_loc_conf_t *lcf; 135 ngx_http_log_loc_conf_t *lcf;
136 #if (WIN32) 136 #if (NGX_WIN32)
137 u_long written; 137 u_long written;
138 #endif 138 #endif
139 139
140 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 140 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
141 "http log handler"); 141 "http log handler");
158 } else { 158 } else {
159 len += op[i].len; 159 len += op[i].len;
160 } 160 }
161 } 161 }
162 162
163 #if (WIN32) 163 #if (NGX_WIN32)
164 len += 2; 164 len += 2;
165 #else 165 #else
166 len++; 166 len++;
167 #endif 167 #endif
168 168
184 } else { 184 } else {
185 p = op[i].op(r, p, op[i].data); 185 p = op[i].op(r, p, op[i].data);
186 } 186 }
187 } 187 }
188 188
189 #if (WIN32) 189 #if (NGX_WIN32)
190 *p++ = CR; *p++ = LF; 190 *p++ = CR; *p++ = LF;
191 WriteFile(log[l].file->fd, line, p - line, &written, NULL); 191 WriteFile(log[l].file->fd, line, p - line, &written, NULL);
192 #else 192 #else
193 *p++ = LF; 193 *p++ = LF;
194 write(log[l].file->fd, line, p - line); 194 write(log[l].file->fd, line, p - line);
209 209
210 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, 210 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
211 uintptr_t data) 211 uintptr_t data)
212 { 212 {
213 return ngx_sprintf(buf, "%ui", r->connection->number); 213 return ngx_sprintf(buf, "%ui", r->connection->number);
214
215 #if 0
216 return buf + ngx_snprintf((char *) buf, NGX_INT_T_LEN + 1,
217 "%" NGX_UINT_T_FMT,
218 r->connection->number);
219 #endif
220 } 214 }
221 215
222 216
223 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, 217 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
224 uintptr_t data) 218 uintptr_t data)
247 struct timeval tv; 241 struct timeval tv;
248 242
249 ngx_gettimeofday(&tv); 243 ngx_gettimeofday(&tv);
250 244
251 return ngx_sprintf(buf, "%l.%03l", tv.tv_sec, tv.tv_usec / 1000); 245 return ngx_sprintf(buf, "%l.%03l", tv.tv_sec, tv.tv_usec / 1000);
252
253 #if 0
254 return buf + ngx_snprintf((char *) buf, TIME_T_LEN + 5, "%ld.%03ld",
255 tv.tv_sec, tv.tv_usec / 1000);
256 #endif
257 } 246 }
258 247
259 248
260 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, 249 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
261 uintptr_t data) 250 uintptr_t data)
272 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, 261 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
273 uintptr_t data) 262 uintptr_t data)
274 { 263 {
275 return ngx_sprintf(buf, "%ui", 264 return ngx_sprintf(buf, "%ui",
276 r->err_status ? r->err_status : r->headers_out.status); 265 r->err_status ? r->err_status : r->headers_out.status);
277
278 #if 0
279 return buf + ngx_snprintf((char *) buf, 4, "%" NGX_UINT_T_FMT,
280 r->err_status ? r->err_status : r->headers_out.status);
281 #endif
282 } 266 }
283 267
284 268
285 static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf, 269 static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
286 uintptr_t data) 270 uintptr_t data)
287 { 271 {
288 return ngx_sprintf(buf, "%O", r->connection->sent); 272 return ngx_sprintf(buf, "%O", r->connection->sent);
289
290 #if 0
291 return buf + ngx_snprintf((char *) buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
292 r->connection->sent);
293 #endif
294 } 273 }
295 274
296 275
297 static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf, 276 static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
298 uintptr_t data) 277 uintptr_t data)
299 { 278 {
300 return ngx_sprintf(buf, "%O", r->connection->sent - r->header_size); 279 return ngx_sprintf(buf, "%O", r->connection->sent - r->header_size);
301 #if 0
302 return buf + ngx_snprintf((char *) buf, NGX_OFF_T_LEN + 1, OFF_T_FMT,
303 r->connection->sent - r->header_size);
304 #endif
305 } 280 }
306 281
307 282
308 static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf, 283 static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
309 uintptr_t data) 284 uintptr_t data)
468 } 443 }
469 444
470 if (buf == NULL) { 445 if (buf == NULL) {
471 return (u_char *) NGX_OFF_T_LEN; 446 return (u_char *) NGX_OFF_T_LEN;
472 } 447 }
473 return buf + ngx_snprintf((char *) buf, 448 return ngx_sprintf(buf, "%O", r->headers_out.content_length_n);
474 NGX_OFF_T_LEN + 2, OFF_T_FMT,
475 r->headers_out.content_length_n);
476 } 449 }
477 450
478 if (data == offsetof(ngx_http_headers_out_t, last_modified)) { 451 if (data == offsetof(ngx_http_headers_out_t, last_modified)) {
479 if (r->headers_out.last_modified_time == -1) { 452 if (r->headers_out.last_modified_time == -1) {
480 if (buf) { 453 if (buf) {