diff options
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/modules/ngx_http_index_handler.c | 2 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_log_handler.c | 18 | ||||
| -rw-r--r-- | src/http/ngx_http.h | 2 | ||||
| -rw-r--r-- | src/http/ngx_http_config.c | 39 | ||||
| -rw-r--r-- | src/http/ngx_http_core.c | 2 | ||||
| -rw-r--r-- | src/http/ngx_http_event.c | 2 | ||||
| -rw-r--r-- | src/http/ngx_http_output_filter.c | 2 |
7 files changed, 34 insertions, 33 deletions
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c index db3e3ccfe..d2084f057 100644 --- a/src/http/modules/ngx_http_index_handler.c +++ b/src/http/modules/ngx_http_index_handler.c @@ -4,7 +4,7 @@ #include <ngx_errno.h> #include <ngx_string.h> #include <ngx_files.h> -#include <ngx_config_command.h> +#include <ngx_config_file.h> #include <ngx_http.h> #include <ngx_http_config.h> #include <ngx_http_index_handler.h> diff --git a/src/http/modules/ngx_http_log_handler.c b/src/http/modules/ngx_http_log_handler.c index 4937ed0b8..b2f0e0d54 100644 --- a/src/http/modules/ngx_http_log_handler.c +++ b/src/http/modules/ngx_http_log_handler.c @@ -32,8 +32,6 @@ int ngx_http_log_handler(ngx_http_request_t *r) len += r->connection->addr_text.len; len += r->request_line.len; - ngx_log_debug(r->connection->log, "log handler: %d" _ len); - ngx_test_null(line, ngx_palloc(r->pool, len), NGX_ERROR); p = line; @@ -46,13 +44,8 @@ int ngx_http_log_handler(ngx_http_request_t *r) *p++ = ' '; - *p = '\0'; - ngx_log_debug(r->connection->log, "log handler: %s" _ line); - ngx_localtime(&tm); - ngx_log_debug(r->connection->log, "log handler: %s" _ line); - *p++ = '['; p += ngx_snprintf(p, 21, "%02d/%s/%d:%02d:%02d:%02d", tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1], @@ -63,9 +56,6 @@ int ngx_http_log_handler(ngx_http_request_t *r) *p++ = ' '; - *p = '\0'; - ngx_log_debug(r->connection->log, "log handler: %s" _ line); - *p++ = '"'; ngx_memcpy(p, r->request_line.data, r->request_line.len); p += r->request_line.len; @@ -79,19 +69,13 @@ int ngx_http_log_handler(ngx_http_request_t *r) p += ngx_snprintf(p, 21, QD_FMT, r->connection->sent); - *p = '\0'; - ngx_log_debug(r->connection->log, "log handler: %s" _ line); - #if (WIN32) *p++ = CR; *p++ = LF; #else *p++ = LF; #endif - *p = '\0'; - ngx_log_debug(r->connection->log, "log handler: %s" _ line); - - write(1, line, len); + write(1, line, p - line); return NGX_OK; } diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h index ed7ca929d..c3e0620d2 100644 --- a/src/http/ngx_http.h +++ b/src/http/ngx_http.h @@ -9,7 +9,7 @@ #include <ngx_hunk.h> #include <ngx_files.h> #include <ngx_connection.h> -#include <ngx_config_command.h> +#include <ngx_config_file.h> #define NGX_HTTP_VERSION_10 1000 diff --git a/src/http/ngx_http_config.c b/src/http/ngx_http_config.c index 2fb641079..f33fc625d 100644 --- a/src/http/ngx_http_config.c +++ b/src/http/ngx_http_config.c @@ -1,7 +1,7 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_config_command.h> +#include <ngx_config_file.h> #include <ngx_http.h> #include <ngx_http_write_filter.h> #include <ngx_http_output_filter.h> @@ -17,7 +17,7 @@ void **ngx_srv_conf; void **ngx_loc_conf; #if 0 -void *ngx_http_block(ngx_conf_t *cf) +int ngx_http_block(ngx_conf_t *cf) { ngx_http_conf_ctx_t *ctx; @@ -25,10 +25,12 @@ void *ngx_http_block(ngx_conf_t *cf) ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), NGX_ERROR); +#if 0 /* null server config */ ngx_test_null(ctx->srv_conf, ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module), NGX_ERROR); +#endif /* null location config */ ngx_test_null(ctx->loc_conf, @@ -36,10 +38,12 @@ void *ngx_http_block(ngx_conf_t *cf) NGX_ERROR); for (i = 0; modules[i]; i++) { +#if 0 if (modules[i]->create_srv_conf) ngx_test_null(ctx->srv_conf[i], modules[i]->create_srv_conf(cf->pool), NGX_ERROR); +#endif if (modules[i]->create_loc_conf) ngx_test_null(ctx->loc_conf[i], @@ -51,10 +55,9 @@ void *ngx_http_block(ngx_conf_t *cf) return ngx_conf_parse(cf); } -void *ngx_server_block(ngx_conf_t *cf) +int ngx_server_block(ngx_conf_t *cf) { - ngx_http_conf_ctx_t *ctx, *prev; - ngx_http_core_loc_conf_t *loc_conf; + ngx_http_conf_ctx_t *ctx, *prev; ngx_test_null(ctx, ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), @@ -88,31 +91,45 @@ void *ngx_server_block(ngx_conf_t *cf) rc = ngx_conf_parse(cf); cf->ctx = prev; - if (loc == NULL) - return NULL; + if (loc == NGX_ERROR) + return NGX_ERROR; for (i = 0; modules[i]; i++) { +#if 0 if (modules[i]->merge_srv_conf) if (modules[i]->merge_srv_conf(cf->pool, prev->srv_conf, ctx->srv_conf) == NGX_ERROR) return NGX_ERROR; +#endif + + if (modules[i]->init_srv_conf) + if (modules[i]->init_srv_conf(cf->pool, ctx->srv_conf) == NGX_ERROR) + return NGX_ERROR; if (modules[i]->merge_loc_conf) if (modules[i]->merge_loc_conf(cf->pool, prev->loc_conf, ctx->loc_conf) == NGX_ERROR) return NGX_ERROR; + + for (array) { + if (modules[i]->merge_loc_conf(cf->pool, + ctx->loc_conf, loc->loc_conf) + == NGX_ERROR) + return NGX_ERROR; + } + } } - return (void *) 1; + return NGX_OK; } -void *ngx_location_block(ngx_conf_t *cf) +int ngx_location_block(ngx_conf_t *cf) { + ngx_http_conf_ctx_t *ctx, *prev; - ngx_test_null(ctx, - ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), + ngx_test_null(ctx, ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), NGX_ERROR); ctx->srv_conf = cf->ctx->srv_conf; diff --git a/src/http/ngx_http_core.c b/src/http/ngx_http_core.c index cb7bdc9d9..6d5d72276 100644 --- a/src/http/ngx_http_core.c +++ b/src/http/ngx_http_core.c @@ -1,7 +1,7 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_config_command.h> +#include <ngx_config_file.h> #include <ngx_http.h> #include <ngx_http_core.h> #include <ngx_http_config.h> diff --git a/src/http/ngx_http_event.c b/src/http/ngx_http_event.c index 60b3ca416..82e4a5315 100644 --- a/src/http/ngx_http_event.c +++ b/src/http/ngx_http_event.c @@ -107,7 +107,7 @@ int ngx_http_init_connection(ngx_connection_t *c) c->addr_text.len = ngx_inet_ntop(c->family, (char *)c->sockaddr + c->addr, c->addr_text.data, c->addr_text.len); - if (c->addr_text.len = 0) + if (c->addr_text.len == 0) return NGX_ERROR; ngx_test_null(ctx, ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)), diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c index e8388dcc7..e16c1f77b 100644 --- a/src/http/ngx_http_output_filter.c +++ b/src/http/ngx_http_output_filter.c @@ -3,7 +3,7 @@ #include <ngx_files.h> #include <ngx_string.h> #include <ngx_hunk.h> -#include <ngx_config_command.h> +#include <ngx_config_file.h> #include <ngx_http.h> #include <ngx_http_config.h> #include <ngx_http_output_filter.h> |
