Latest update - 7540

This commit is contained in:
2019-07-19 08:47:57 +09:00
parent a17d307d9b
commit 28f62b6672
6 changed files with 61 additions and 15 deletions
+25 -5
View File
@@ -265,6 +265,14 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
return NGX_ERROR; return NGX_ERROR;
} }
if (hinit->bucket_size > 65536 - ngx_cacheline_size) {
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build %s, too large "
"%s_bucket_size: %i",
hinit->name, hinit->name, hinit->bucket_size);
return NGX_ERROR;
}
for (n = 0; n < nelts; n++) { for (n = 0; n < nelts; n++) {
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
{ {
@@ -300,17 +308,19 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
} }
key = names[n].key_hash % size; key = names[n].key_hash % size;
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
#if 0 #if 0
ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0, ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
"%ui: %ui %ui \"%V\"", "%ui: %ui %uz \"%V\"",
size, key, test[key], &names[n].key); size, key, len, &names[n].key);
#endif #endif
if (test[key] > (u_short) bucket_size) { if (len > bucket_size) {
goto next; goto next;
} }
test[key] = (u_short) len;
} }
goto found; goto found;
@@ -341,7 +351,17 @@ found:
} }
key = names[n].key_hash % size; key = names[n].key_hash % size;
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
if (len > 65536 - ngx_cacheline_size) {
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build %s, you should "
"increase %s_max_size: %i",
hinit->name, hinit->name, hinit->max_size);
return NGX_ERROR;
}
test[key] = (u_short) len;
} }
len = 0; len = 0;
@@ -1254,9 +1254,9 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
case '-': case '-':
state = ssi_error_end0_state; state = ssi_error_end0_state;
ctx->param->key.data[ctx->param->key.len++] = ch;
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"invalid \"%V\" parameter in \"%V\" SSI command", "unexpected \"-\" symbol after \"%V\" "
"parameter in \"%V\" SSI command",
&ctx->param->key, &ctx->command); &ctx->param->key, &ctx->command);
break; break;
@@ -628,7 +628,7 @@ static ngx_int_t
ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx, ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
ngx_array_t *params, ngx_uint_t final) ngx_array_t *params, ngx_uint_t final)
{ {
u_char *p, *last, *value, *dst, *src, **s; u_char *p, *value, *dst, *src, **s;
size_t len; size_t len;
ngx_uint_t i; ngx_uint_t i;
ngx_str_t string; ngx_str_t string;
@@ -698,8 +698,6 @@ ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
ngx_memcpy(p, string.data, string.len + 1); ngx_memcpy(p, string.data, string.len + 1);
} }
last = p + string.len;
while (p && *p) { while (p && *p) {
value = p; value = p;
@@ -729,7 +727,7 @@ ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
*p++ = '\0'; *p++ = '\0';
} else { } else {
len = last - value; len = ngx_strlen(value);
} }
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
-1
View File
@@ -933,7 +933,6 @@ internal_redirect(r, uri)
ngx_http_request_t *r; ngx_http_request_t *r;
ngx_http_perl_ctx_t *ctx; ngx_http_perl_ctx_t *ctx;
SV *uri; SV *uri;
ngx_uint_t i;
ngx_http_perl_set_request(r, ctx); ngx_http_perl_set_request(r, ctx);
+26 -3
View File
@@ -3334,6 +3334,7 @@ ngx_http_upstream_process_upgraded(ngx_http_request_t *r,
size_t size; size_t size;
ssize_t n; ssize_t n;
ngx_buf_t *b; ngx_buf_t *b;
ngx_uint_t flags;
ngx_connection_t *c, *downstream, *upstream, *dst, *src; ngx_connection_t *c, *downstream, *upstream, *dst, *src;
ngx_http_upstream_t *u; ngx_http_upstream_t *u;
ngx_http_core_loc_conf_t *clcf; ngx_http_core_loc_conf_t *clcf;
@@ -3472,7 +3473,14 @@ ngx_http_upstream_process_upgraded(ngx_http_request_t *r,
ngx_del_timer(upstream->write); ngx_del_timer(upstream->write);
} }
if (ngx_handle_read_event(upstream->read, 0) != NGX_OK) { if (upstream->read->eof || upstream->read->error) {
flags = NGX_CLOSE_EVENT;
} else {
flags = 0;
}
if (ngx_handle_read_event(upstream->read, flags) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u, NGX_ERROR); ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return; return;
} }
@@ -3491,7 +3499,14 @@ ngx_http_upstream_process_upgraded(ngx_http_request_t *r,
return; return;
} }
if (ngx_handle_read_event(downstream->read, 0) != NGX_OK) { if (downstream->read->eof || downstream->read->error) {
flags = NGX_CLOSE_EVENT;
} else {
flags = 0;
}
if (ngx_handle_read_event(downstream->read, flags) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u, NGX_ERROR); ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return; return;
} }
@@ -3563,6 +3578,7 @@ ngx_http_upstream_process_non_buffered_request(ngx_http_request_t *r,
ssize_t n; ssize_t n;
ngx_buf_t *b; ngx_buf_t *b;
ngx_int_t rc; ngx_int_t rc;
ngx_uint_t flags;
ngx_connection_t *downstream, *upstream; ngx_connection_t *downstream, *upstream;
ngx_http_upstream_t *u; ngx_http_upstream_t *u;
ngx_http_core_loc_conf_t *clcf; ngx_http_core_loc_conf_t *clcf;
@@ -3666,7 +3682,14 @@ ngx_http_upstream_process_non_buffered_request(ngx_http_request_t *r,
ngx_del_timer(downstream->write); ngx_del_timer(downstream->write);
} }
if (ngx_handle_read_event(upstream->read, 0) != NGX_OK) { if (upstream->read->eof || upstream->read->error) {
flags = NGX_CLOSE_EVENT;
} else {
flags = 0;
}
if (ngx_handle_read_event(upstream->read, flags) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u, NGX_ERROR); ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return; return;
} }
+6
View File
@@ -1420,6 +1420,12 @@ ngx_http_v2_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit)
if (in == NULL || stream->out_closed) { if (in == NULL || stream->out_closed) {
if (size) {
ngx_log_error(NGX_LOG_ERR, fc->log, 0,
"output on closed stream");
return NGX_CHAIN_ERROR;
}
if (stream->queued) { if (stream->queued) {
fc->write->active = 1; fc->write->active = 1;
fc->write->ready = 0; fc->write->ready = 0;