Mercurial > hg > nginx-vendor-0-8
comparison src/event/ngx_event_accept.c @ 32:da8c190bdaba NGINX_0_1_16
nginx 0.1.16
*) Bugfix: if the response were transferred by chunks, then on the HEAD
request the final chunk was issued.
*) Bugfix: the "Connection: keep-alive" header were issued, even if the
keepalive_timeout directive forbade the keep-alive use.
*) Bugfix: the errors in the ngx_http_fastcgi_module caused the
segmentation faults.
*) Bugfix: the compressed response encrypted by SSL may not transferred
complete.
*) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK
options, are not used for the unix domain sockets.
*) Feature: the rewrite directive supports the arguments rewriting.
*) Bugfix: the response code 400 was returned for the POST request with
the "Content-Length: 0" header; bug appeared in 0.1.14.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 25 Jan 2005 00:00:00 +0300 |
parents | 7ca9bdc82b3f |
children | a39d1b793287 |
comparison
equal
deleted
inserted
replaced
31:1b17dd824438 | 32:da8c190bdaba |
---|---|
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 #include <ngx_event.h> | 9 #include <ngx_event.h> |
10 #include <nginx.h> | 10 #include <nginx.h> |
11 | 11 |
12 | 12 |
13 typedef struct { | |
14 int flag; | |
15 ngx_str_t *name; | |
16 } ngx_accept_log_ctx_t; | |
17 | |
18 | |
19 static void ngx_close_accepted_socket(ngx_socket_t s, ngx_log_t *log); | 13 static void ngx_close_accepted_socket(ngx_socket_t s, ngx_log_t *log); |
20 static u_char *ngx_accept_log_error(void *data, u_char *buf, size_t len); | 14 static u_char *ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len); |
21 | 15 |
22 | 16 |
23 void ngx_event_accept(ngx_event_t *ev) | 17 void ngx_event_accept(ngx_event_t *ev) |
24 { | 18 { |
25 ngx_uint_t instance, accepted; | 19 ngx_uint_t instance, accepted; |
26 socklen_t len; | 20 socklen_t len; |
27 struct sockaddr *sa; | 21 struct sockaddr *sa; |
28 ngx_err_t err; | 22 ngx_err_t err; |
29 ngx_log_t *log; | 23 ngx_log_t *log; |
30 ngx_pool_t *pool; | 24 ngx_pool_t *pool; |
31 ngx_socket_t s; | 25 ngx_socket_t s; |
32 ngx_event_t *rev, *wev; | 26 ngx_event_t *rev, *wev; |
33 ngx_connection_t *c, *ls; | 27 ngx_connection_t *c, *ls; |
34 ngx_event_conf_t *ecf; | 28 ngx_event_conf_t *ecf; |
35 ngx_accept_log_ctx_t *ctx; | |
36 | 29 |
37 ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module); | 30 ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module); |
38 | 31 |
39 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { | 32 if (ngx_event_flags & NGX_USE_RTSIG_EVENT) { |
40 ev->available = 1; | 33 ev->available = 1; |
79 } | 72 } |
80 | 73 |
81 ngx_memcpy(log, ls->log, sizeof(ngx_log_t)); | 74 ngx_memcpy(log, ls->log, sizeof(ngx_log_t)); |
82 pool->log = log; | 75 pool->log = log; |
83 | 76 |
84 if (!(ctx = ngx_palloc(pool, sizeof(ngx_accept_log_ctx_t)))) { | 77 log->data = &ls->listening->addr_text; |
85 ngx_destroy_pool(pool); | |
86 return; | |
87 } | |
88 | |
89 /* -1 disables the connection number logging */ | |
90 ctx->flag = -1; | |
91 ctx->name = &ls->listening->addr_text; | |
92 | |
93 log->data = ctx; | |
94 log->handler = ngx_accept_log_error; | 78 log->handler = ngx_accept_log_error; |
95 | 79 |
96 len = ls->listening->socklen; | 80 len = ls->listening->socklen; |
97 | 81 |
98 s = accept(ls->fd, sa, &len); | 82 s = accept(ls->fd, sa, &len); |
465 ngx_close_socket_n " failed"); | 449 ngx_close_socket_n " failed"); |
466 } | 450 } |
467 } | 451 } |
468 | 452 |
469 | 453 |
470 static u_char *ngx_accept_log_error(void *data, u_char *buf, size_t len) | 454 static u_char *ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len) |
471 { | 455 { |
472 ngx_accept_log_ctx_t *ctx = data; | 456 return ngx_snprintf(buf, len, " while accept() on %V", log->data); |
473 | 457 } |
474 return ngx_snprintf(buf, len, " while accept() on %V", ctx->name); | |
475 } |