diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-09-14 19:39:54 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-09-14 19:39:54 +0000 |
commit | dc3b2a78753bdc4c97a0007c872a4f8afd049df4 (patch) | |
tree | 101c409864cf6ec6e6f285ef772e61f0924dd32c /src/http | |
parent | e2ff3ea920ba6bc3690a333abdaa2e40656f933a (diff) | |
download | nginx-dc3b2a78753bdc4c97a0007c872a4f8afd049df4.tar.gz |
nginx-0.0.10-2004-09-14-23:39:54 import
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/ngx_http_core_module.c | 21 | ||||
-rw-r--r-- | src/http/ngx_http_request.c | 45 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 4 |
3 files changed, 50 insertions, 20 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index f00ae658c..be2e7fc78 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1178,14 +1178,18 @@ static char *ngx_set_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) ngx_http_type_t *type; if (lcf->types == NULL) { - ngx_test_null(lcf->types, - ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME - * sizeof(ngx_array_t)), - NGX_CONF_ERROR); + lcf->types = ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME + * sizeof(ngx_array_t)); + if (lcf->types == NULL) { + return NGX_CONF_ERROR; + } for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) { - ngx_init_array(lcf->types[i], cf->pool, 5, sizeof(ngx_http_type_t), - NGX_CONF_ERROR); + if (ngx_array_init(&lcf->types[i], cf->pool, 5, + 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++) { 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->type = args[0]; } diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 734576783..8b44accd8 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -97,6 +97,10 @@ void ngx_http_init_connection(ngx_connection_t *c) ngx_event_t *rev; 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)))) { ngx_http_close_connection(c); return; @@ -313,22 +317,14 @@ static void ngx_http_init_request(ngx_event_t *rev) return; } - r->cleanup.elts = ngx_palloc(r->pool, 5 * sizeof(ngx_http_cleanup_t)); - if (r->cleanup.elts == NULL) { + if (ngx_array_init(&r->cleanup, r->pool, 5, sizeof(ngx_http_cleanup_t)) + == NGX_ERROR) + { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); ngx_http_close_connection(c); 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, 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; +#if (NGX_STAT_STUB) + (*ngx_stat_requests)++; +#endif + rev->event_handler(rev); } @@ -867,6 +867,11 @@ static void ngx_http_process_request_headers(ngx_event_t *rev) ngx_del_timer(rev); } +#if (NGX_STAT_STUB) + (*ngx_stat_reading)--; + (*ngx_stat_writing)++; +#endif + rev->event_handler = ngx_http_block_read; ngx_http_handler(r); 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 (NGX_STAT_STUB) + (*ngx_stat_writing)--; +#endif + ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); return; @@ -1153,6 +1163,11 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int rc) return; } else if (rc == NGX_ERROR) { + +#if (NGX_STAT_STUB) + (*ngx_stat_writing)--; +#endif + ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); return; @@ -1162,6 +1177,10 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int rc) return; } +#if (NGX_STAT_STUB) + (*ngx_stat_writing)--; +#endif + if (r->connection->read->timer_set) { 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, "close http connection: %d", c->fd); +#if (NGX_STAT_STUB) + (*ngx_stat_active)--; +#endif + ngx_close_connection(c); } diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 8055b5f1f..276330e34 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -146,8 +146,8 @@ typedef struct { size_t connection_type; ssize_t keep_alive_n; - unsigned msie; - unsigned msie4; + unsigned msie:1; + unsigned msie4:1; } ngx_http_headers_in_t; |