diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-02-16 13:40:36 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-02-16 13:40:36 +0000 |
commit | 1ebfead9da0596e8e84231f7ea8ba25a650a4d1e (patch) | |
tree | 15e18d104477e04ffb5fcb31b3fb43f20dcfe996 /src/http/modules | |
parent | 675cc5a855cec4acaae2937cb832c424e4d3bacf (diff) | |
download | nginx-release-0.1.19.tar.gz nginx-release-0.1.19.zip |
nginx-0.1.19-RELEASE importrelease-0.1.19
*) Bugfix: now, if request contains the zero, then the 404 error is
returned for the local requests.
*) Bugfix: nginx could not be built on NetBSD 2.0.
*) Bugfix: the timeout may occur while reading of the the client
request body via SSL connections.
Diffstat (limited to 'src/http/modules')
-rw-r--r-- | src/http/modules/ngx_http_autoindex_handler.c | 5 | ||||
-rw-r--r-- | src/http/modules/ngx_http_geo_module.c | 31 | ||||
-rw-r--r-- | src/http/modules/ngx_http_gzip_filter.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_index_handler.c | 5 | ||||
-rw-r--r-- | src/http/modules/ngx_http_ssi_filter.c | 94 | ||||
-rw-r--r-- | src/http/modules/ngx_http_static_handler.c | 5 |
6 files changed, 79 insertions, 63 deletions
diff --git a/src/http/modules/ngx_http_autoindex_handler.c b/src/http/modules/ngx_http_autoindex_handler.c index ac2438e7f..2e555a058 100644 --- a/src/http/modules/ngx_http_autoindex_handler.c +++ b/src/http/modules/ngx_http_autoindex_handler.c @@ -128,6 +128,11 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) return NGX_DECLINED; } + /* TODO: Win32 */ + if (r->zero_in_uri) { + return NGX_DECLINED; + } + alcf = ngx_http_get_module_loc_conf(r, ngx_http_autoindex_module); if (!alcf->enable) { diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 7d17f03ca..0d8267d8e 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -10,9 +10,9 @@ typedef struct { - ngx_radix_tree_t *tree; - ngx_pool_t *pool; - ngx_array_t values; + ngx_radix_tree_t *tree; + ngx_pool_t *pool; + ngx_array_t values; } ngx_http_geo_conf_t; @@ -63,21 +63,31 @@ static ngx_http_variable_value_t ngx_http_geo_null_value = /* AF_INET only */ -static ngx_http_variable_value_t *ngx_http_geo_variable(ngx_http_request_t *r, - void *data) +static ngx_http_variable_value_t * +ngx_http_geo_variable(ngx_http_request_t *r, void *data) { ngx_radix_tree_t *tree = data; - struct sockaddr_in *sin; + struct sockaddr_in *sin; + ngx_http_variable_value_t *var; sin = (struct sockaddr_in *) r->connection->sockaddr; - return (ngx_http_variable_value_t *) + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http geo started"); + + var = (ngx_http_variable_value_t *) ngx_radix32tree_find(tree, ntohl(sin->sin_addr.s_addr)); + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http geo: %V %V", &r->connection->addr_text, &var->text); + + return var; } -static char *ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +static char * +ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { char *rv; ngx_str_t *value; @@ -91,7 +101,7 @@ static char *ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - if (!(tree = ngx_radix_tree_create(cf->pool, 8))) { + if (!(tree = ngx_radix_tree_create(cf->pool, -1))) { return NGX_CONF_ERROR; } @@ -148,7 +158,8 @@ static char *ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) /* AF_INET only */ -static char *ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +static char * +ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { ngx_int_t rc, n; ngx_uint_t i; diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c index ccf5dc4be..c7a16a7c8 100644 --- a/src/http/modules/ngx_http_gzip_filter.c +++ b/src/http/modules/ngx_http_gzip_filter.c @@ -216,7 +216,7 @@ static ngx_http_module_t ngx_http_gzip_filter_module_ctx = { NULL, /* merge server configuration */ ngx_http_gzip_create_conf, /* create location configuration */ - ngx_http_gzip_merge_conf, /* merge location configuration */ + ngx_http_gzip_merge_conf /* merge location configuration */ }; diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c index 892b825ae..1c7d0dfad 100644 --- a/src/http/modules/ngx_http_index_handler.c +++ b/src/http/modules/ngx_http_index_handler.c @@ -120,6 +120,11 @@ static ngx_int_t ngx_http_index_handler(ngx_http_request_t *r) return NGX_DECLINED; } + /* TODO: Win32 */ + if (r->zero_in_uri) { + return NGX_DECLINED; + } + log = r->connection->log; /* diff --git a/src/http/modules/ngx_http_ssi_filter.c b/src/http/modules/ngx_http_ssi_filter.c index 334dd53e6..eeb515f3a 100644 --- a/src/http/modules/ngx_http_ssi_filter.c +++ b/src/http/modules/ngx_http_ssi_filter.c @@ -518,48 +518,49 @@ static int ngx_http_ssi_copy_opcode(ngx_http_request_t *r, #endif -static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, - ngx_http_ssi_ctx_t *ctx) +static ngx_int_t +ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx) { - char *p, *last, *end, ch; + u_char *p, *last, *end, ch; ngx_http_ssi_conf_t *conf; ngx_http_ssi_state_e state; conf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module); state = ctx->state; - p = ctx->pos; end = ctx->buf->last; last = NULL; - while (p < end) { - ch = *p++; + for (p = ctx->pos; p < end; p++) { - switch (state) { - - case ssi_start_state: + ch = *p; - /* a tight loop */ + if (state == ssi_start_state) { - for ( ;; ) { + /* the tight loop */ - if (ch == '<') { - last = p - 1; - state = ssi_tag_state; - break; + for ( /* void */ ; p < end; p++) { + if (ch != '<') { + continue; } - if (p == end) { - ctx->last = p; - ctx->pos = p; - ctx->state = ssi_start_state; + last = p; + state = ssi_tag_state; + break; + } - return NGX_HTTP_SSI_COPY; - } + if (p == end) { + ctx->last = p; + ctx->pos = p; + ctx->state = ssi_start_state; - ch = *p++; + return NGX_HTTP_SSI_COPY; } + } + + switch (state) { + case ssi_start_state: break; case ssi_tag_state: @@ -569,7 +570,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, break; case '<': - last = p - 1; + last = p; break; default: @@ -586,7 +587,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, break; case '<': - last = p - 1; + last = p; state = ssi_tag_state; break; @@ -604,7 +605,7 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, break; case '<': - last = p - 1; + last = p; state = ssi_tag_state; break; @@ -621,11 +622,10 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, ctx->last = last; ctx->pos = p; ctx->state = ssi_precommand_state; - - return NGX_HTTP_SSI_COPY; + break; case '<': - last = p - 1; + last = p; state = ssi_tag_state; break; @@ -645,14 +645,14 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, break; default: + ctx->command.len = 1; ctx->command.data = - ngx_palloc(r->pool, NGX_HTTP_SSI_COMMAND_LEN + 1); + ngx_palloc(r->pool, NGX_HTTP_SSI_COMMAND_LEN); if (ctx->command.data == NULL) { return NGX_ERROR; } ctx->command.data[0] = ch; - ctx->command.len = 1; state = ssi_command_state; break; } @@ -665,20 +665,15 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, case CR: case LF: case '\t': - ctx->command.data[ctx->command.len] = 0; state = ssi_preparam_state; break; case '-': - ctx->command.data[ctx->command.len] = 0; state = ssi_comment_end0_state; break; default: - if (ctx->command.len >= NGX_HTTP_SSI_COMMAND_LEN) { - ctx->command.data[NGX_HTTP_SSI_COMMAND_LEN] = 0; - - ctx->last = last; + if (ctx->command.len == NGX_HTTP_SSI_COMMAND_LEN) { ctx->pos = p; ctx->state = ssi_error_state; @@ -704,28 +699,30 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, default: if (ctx->params.elts == NULL) { - ngx_init_array(ctx->params, r->pool, - 5, sizeof(ngx_table_elt_t), NGX_ERROR); + if (ngx_array_init(&ctx->params = r->pool, + 4, sizeof(ngx_table_elt_t)) = NGX_ERROR) + { + return NGX_ERROR; + } } - if (!(ctx->param = ngx_push_array(&ctx->params))) { + if (!(ctx->param = ngx_array_push(&ctx->params))) { return NGX_ERROR; } + ctx->param->key.len = 1; ctx->param->key.data = - ngx_palloc(r->pool, NGX_HTTP_SSI_PARAM_LEN + 1); + ngx_palloc(r->pool, NGX_HTTP_SSI_PARAM_LEN); if (ctx->param->key.data == NULL) { return NGX_ERROR; } ctx->param->key.data[0] = ch; - ctx->param->key.len = 1; - ctx->param->value.data = - ngx_palloc(r->pool, conf->value_len + 1); + ctx->param->value.len = 0; + ctx->param->value.data = ngx_palloc(r->pool, conf->value_len); if (ctx->param->value.data == NULL) { return NGX_ERROR; } - ctx->param->value.len = 0; state = ssi_param_state; break; @@ -739,27 +736,21 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, case CR: case LF: case '\t': - ctx->param->key.data[ctx->param->key.len] = 0; state = ssi_preequal_state; break; case '=': - ctx->param->key.data[ctx->param->key.len] = 0; state = ssi_prevalue_state; break; case '-': - ctx->last = last; ctx->pos = p; ctx->state = ssi_error_end0_state; return NGX_HTTP_SSI_INVALID_PARAM; default: - if (ctx->param->key.len >= NGX_HTTP_SSI_PARAM_LEN) { - ctx->param->key.data[NGX_HTTP_SSI_PARAM_LEN] = 0; - - ctx->last = last; + if (ctx->param->key.len == NGX_HTTP_SSI_PARAM_LEN) { ctx->pos = p; ctx->state = ssi_error_state; @@ -784,7 +775,6 @@ static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r, break; case '-': - ctx->last = last; ctx->pos = p; ctx->state = ssi_error_end0_state; diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c index fa2bcd55b..1ff45da60 100644 --- a/src/http/modules/ngx_http_static_handler.c +++ b/src/http/modules/ngx_http_static_handler.c @@ -87,6 +87,11 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r) return NGX_DECLINED; } + /* TODO: Win32 */ + if (r->zero_in_uri) { + return NGX_DECLINED; + } + if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { return NGX_HTTP_NOT_ALLOWED; } |