mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
nginx-0.0.10-2004-09-14-23:39:54 import
This commit is contained in:
parent
e2ff3ea920
commit
dc3b2a7875
@ -223,8 +223,8 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...);
|
|||||||
#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
|
#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
|
||||||
#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
|
#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
|
||||||
#define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
#define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
#define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6,
|
#define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \
|
||||||
arg7)
|
arg6, arg7)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alloc a new pool block */
|
/* allocate a new pool block */
|
||||||
|
|
||||||
if (!(n = ngx_create_pool((size_t) (p->end - (char *) p), p->log))) {
|
if (!(n = ngx_create_pool((size_t) (p->end - (char *) p), p->log))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -99,7 +99,7 @@ void *ngx_palloc(ngx_pool_t *pool, size_t size)
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alloc a large block */
|
/* allocate a large block */
|
||||||
|
|
||||||
large = NULL;
|
large = NULL;
|
||||||
last = NULL;
|
last = NULL;
|
||||||
|
@ -64,6 +64,22 @@ ngx_msec_t ngx_accept_mutex_delay;
|
|||||||
ngx_int_t ngx_accept_disabled;
|
ngx_int_t ngx_accept_disabled;
|
||||||
|
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
|
||||||
|
ngx_atomic_t ngx_stat_accepted0;
|
||||||
|
ngx_atomic_t *ngx_stat_accepted = &ngx_stat_accepted0;
|
||||||
|
ngx_atomic_t ngx_stat_requests0;
|
||||||
|
ngx_atomic_t *ngx_stat_requests = &ngx_stat_requests0;
|
||||||
|
ngx_atomic_t ngx_stat_active0;
|
||||||
|
ngx_atomic_t *ngx_stat_active = &ngx_stat_active0;
|
||||||
|
ngx_atomic_t ngx_stat_reading0;
|
||||||
|
ngx_atomic_t *ngx_stat_reading = &ngx_stat_reading0;
|
||||||
|
ngx_atomic_t ngx_stat_writing0;
|
||||||
|
ngx_atomic_t *ngx_stat_writing = &ngx_stat_reading0;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ngx_command_t ngx_events_commands[] = {
|
static ngx_command_t ngx_events_commands[] = {
|
||||||
|
|
||||||
@ -187,6 +203,16 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle)
|
|||||||
size = 128 /* ngx_accept_mutex */
|
size = 128 /* ngx_accept_mutex */
|
||||||
+ 128; /* ngx_connection_counter */
|
+ 128; /* ngx_connection_counter */
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
|
||||||
|
size += 128 /* ngx_stat_accepted */
|
||||||
|
+ 128 /* ngx_stat_requests */
|
||||||
|
+ 128 /* ngx_stat_active */
|
||||||
|
+ 128 /* ngx_stat_reading */
|
||||||
|
+ 128; /* ngx_stat_writing */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(shared = ngx_create_shared_memory(size, cycle->log))) {
|
if (!(shared = ngx_create_shared_memory(size, cycle->log))) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
@ -194,6 +220,16 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle)
|
|||||||
ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
|
ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
|
||||||
ngx_connection_counter = (ngx_atomic_t *) (shared + 128);
|
ngx_connection_counter = (ngx_atomic_t *) (shared + 128);
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
|
||||||
|
ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * 128);
|
||||||
|
ngx_stat_requests = (ngx_atomic_t *) (shared + 3 * 128);
|
||||||
|
ngx_stat_active = (ngx_atomic_t *) (shared + 4 * 128);
|
||||||
|
ngx_stat_reading = (ngx_atomic_t *) (shared + 5 * 128);
|
||||||
|
ngx_stat_writing = (ngx_atomic_t *) (shared + 6 * 128);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
||||||
"counter: " PTR_FMT ", %d",
|
"counter: " PTR_FMT ", %d",
|
||||||
ngx_connection_counter, *ngx_connection_counter);
|
ngx_connection_counter, *ngx_connection_counter);
|
||||||
|
@ -433,6 +433,18 @@ extern ngx_msec_t ngx_accept_mutex_delay;
|
|||||||
extern ngx_int_t ngx_accept_disabled;
|
extern ngx_int_t ngx_accept_disabled;
|
||||||
|
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
|
||||||
|
extern ngx_atomic_t *ngx_stat_accepted;
|
||||||
|
extern ngx_atomic_t *ngx_stat_requests;
|
||||||
|
extern ngx_atomic_t *ngx_stat_active;
|
||||||
|
extern ngx_atomic_t *ngx_stat_reading;
|
||||||
|
extern ngx_atomic_t *ngx_stat_writing;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ngx_accept_mutex_unlock() \
|
#define ngx_accept_mutex_unlock() \
|
||||||
if (ngx_accept_mutex_held) { \
|
if (ngx_accept_mutex_held) { \
|
||||||
*ngx_accept_mutex = 0; \
|
*ngx_accept_mutex = 0; \
|
||||||
|
@ -127,6 +127,10 @@ void ngx_event_accept(ngx_event_t *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_accepted)++;
|
||||||
|
(*ngx_stat_active)++;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_accept_disabled = (ngx_uint_t) s + NGX_ACCEPT_THRESHOLD
|
ngx_accept_disabled = (ngx_uint_t) s + NGX_ACCEPT_THRESHOLD
|
||||||
- ecf->connections;
|
- ecf->connections;
|
||||||
|
@ -1178,14 +1178,18 @@ static char *ngx_set_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
|||||||
ngx_http_type_t *type;
|
ngx_http_type_t *type;
|
||||||
|
|
||||||
if (lcf->types == NULL) {
|
if (lcf->types == NULL) {
|
||||||
ngx_test_null(lcf->types,
|
lcf->types = ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME
|
||||||
ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME
|
* sizeof(ngx_array_t));
|
||||||
* sizeof(ngx_array_t)),
|
if (lcf->types == NULL) {
|
||||||
NGX_CONF_ERROR);
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) {
|
for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) {
|
||||||
ngx_init_array(lcf->types[i], cf->pool, 5, sizeof(ngx_http_type_t),
|
if (ngx_array_init(&lcf->types[i], cf->pool, 5,
|
||||||
NGX_CONF_ERROR);
|
sizeof(ngx_http_type_t)) == NGX_ERROR)
|
||||||
|
{
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1194,7 +1198,10 @@ static char *ngx_set_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
|||||||
for (i = 1; i < cf->args->nelts; i++) {
|
for (i = 1; i < cf->args->nelts; i++) {
|
||||||
ngx_http_types_hash_key(key, args[i]);
|
ngx_http_types_hash_key(key, args[i]);
|
||||||
|
|
||||||
ngx_test_null(type, ngx_push_array(&lcf->types[key]), NGX_CONF_ERROR);
|
if (!(type = ngx_array_push(&lcf->types[key]))) {
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
type->exten = args[i];
|
type->exten = args[i];
|
||||||
type->type = args[0];
|
type->type = args[0];
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,10 @@ void ngx_http_init_connection(ngx_connection_t *c)
|
|||||||
ngx_event_t *rev;
|
ngx_event_t *rev;
|
||||||
ngx_http_log_ctx_t *ctx;
|
ngx_http_log_ctx_t *ctx;
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_reading)++;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(ctx = ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)))) {
|
if (!(ctx = ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)))) {
|
||||||
ngx_http_close_connection(c);
|
ngx_http_close_connection(c);
|
||||||
return;
|
return;
|
||||||
@ -313,22 +317,14 @@ static void ngx_http_init_request(ngx_event_t *rev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->cleanup.elts = ngx_palloc(r->pool, 5 * sizeof(ngx_http_cleanup_t));
|
if (ngx_array_init(&r->cleanup, r->pool, 5, sizeof(ngx_http_cleanup_t))
|
||||||
if (r->cleanup.elts == NULL) {
|
== NGX_ERROR)
|
||||||
|
{
|
||||||
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||||
ngx_http_close_connection(c);
|
ngx_http_close_connection(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* set by ngx_pcalloc():
|
|
||||||
*
|
|
||||||
* r->cleanup.nelts = 0;
|
|
||||||
*/
|
|
||||||
r->cleanup.nalloc = 5;
|
|
||||||
r->cleanup.size = sizeof(ngx_http_cleanup_t);
|
|
||||||
r->cleanup.pool = r->pool;
|
|
||||||
|
|
||||||
|
|
||||||
if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
|
if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
|
||||||
sizeof(ngx_table_elt_t)) == NGX_ERROR)
|
sizeof(ngx_table_elt_t)) == NGX_ERROR)
|
||||||
@ -360,6 +356,10 @@ static void ngx_http_init_request(ngx_event_t *rev)
|
|||||||
|
|
||||||
r->http_state = NGX_HTTP_READING_REQUEST_STATE;
|
r->http_state = NGX_HTTP_READING_REQUEST_STATE;
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_requests)++;
|
||||||
|
#endif
|
||||||
|
|
||||||
rev->event_handler(rev);
|
rev->event_handler(rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,6 +867,11 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
|
|||||||
ngx_del_timer(rev);
|
ngx_del_timer(rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_reading)--;
|
||||||
|
(*ngx_stat_writing)++;
|
||||||
|
#endif
|
||||||
|
|
||||||
rev->event_handler = ngx_http_block_read;
|
rev->event_handler = ngx_http_block_read;
|
||||||
ngx_http_handler(r);
|
ngx_http_handler(r);
|
||||||
return;
|
return;
|
||||||
@ -1143,6 +1148,11 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int rc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rc == NGX_HTTP_CLIENT_CLOSED_REQUEST || r->closed) {
|
if (rc == NGX_HTTP_CLIENT_CLOSED_REQUEST || r->closed) {
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_writing)--;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_http_close_request(r, 0);
|
ngx_http_close_request(r, 0);
|
||||||
ngx_http_close_connection(r->connection);
|
ngx_http_close_connection(r->connection);
|
||||||
return;
|
return;
|
||||||
@ -1153,6 +1163,11 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int rc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (rc == NGX_ERROR) {
|
} else if (rc == NGX_ERROR) {
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_writing)--;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_http_close_request(r, 0);
|
ngx_http_close_request(r, 0);
|
||||||
ngx_http_close_connection(r->connection);
|
ngx_http_close_connection(r->connection);
|
||||||
return;
|
return;
|
||||||
@ -1162,6 +1177,10 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int rc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_writing)--;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (r->connection->read->timer_set) {
|
if (r->connection->read->timer_set) {
|
||||||
ngx_del_timer(r->connection->read);
|
ngx_del_timer(r->connection->read);
|
||||||
}
|
}
|
||||||
@ -1887,6 +1906,10 @@ void ngx_http_close_connection(ngx_connection_t *c)
|
|||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||||
"close http connection: %d", c->fd);
|
"close http connection: %d", c->fd);
|
||||||
|
|
||||||
|
#if (NGX_STAT_STUB)
|
||||||
|
(*ngx_stat_active)--;
|
||||||
|
#endif
|
||||||
|
|
||||||
ngx_close_connection(c);
|
ngx_close_connection(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +146,8 @@ typedef struct {
|
|||||||
size_t connection_type;
|
size_t connection_type;
|
||||||
ssize_t keep_alive_n;
|
ssize_t keep_alive_n;
|
||||||
|
|
||||||
unsigned msie;
|
unsigned msie:1;
|
||||||
unsigned msie4;
|
unsigned msie4:1;
|
||||||
} ngx_http_headers_in_t;
|
} ngx_http_headers_in_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ void ngx_imap_proxy_init(ngx_imap_session_t *s)
|
|||||||
#if 0
|
#if 0
|
||||||
peers->peers[0].addr = inet_addr("81.19.69.70");
|
peers->peers[0].addr = inet_addr("81.19.69.70");
|
||||||
peers->peers[0].addr_port_text.len = sizeof("81.19.69.70:110") - 1;
|
peers->peers[0].addr_port_text.len = sizeof("81.19.69.70:110") - 1;
|
||||||
peers->peers[0].addr_port_text.data = "81.19.69.70:110";
|
peers->peers[0].addr_port_text.data = (u_char *) "81.19.69.70:110";
|
||||||
peers->peers[0].port = htons(110);
|
peers->peers[0].port = htons(110);
|
||||||
#else
|
#else
|
||||||
peers->peers[0].addr = inet_addr("81.19.64.101");
|
peers->peers[0].addr = inet_addr("81.19.64.101");
|
||||||
peers->peers[0].addr_port_text.len = sizeof("81.19.64.101:110") - 1;
|
peers->peers[0].addr_port_text.len = sizeof("81.19.64.101:110") - 1;
|
||||||
peers->peers[0].addr_port_text.data = "81.19.64.101:110";
|
peers->peers[0].addr_port_text.data = (u_char *) "81.19.64.101:110";
|
||||||
peers->peers[0].port = htons(110);
|
peers->peers[0].port = htons(110);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user