Release - v1.17.7
This commit is contained in:
@@ -238,8 +238,6 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
|
||||
}
|
||||
|
||||
if (!ngx_queue_empty(&ngx_posted_next_events)) {
|
||||
ngx_queue_add(&ngx_posted_events, &ngx_posted_next_events);
|
||||
ngx_queue_init(&ngx_posted_next_events);
|
||||
timer = 0;
|
||||
}
|
||||
|
||||
@@ -263,6 +261,7 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
|
||||
}
|
||||
|
||||
ngx_event_process_posted(cycle, &ngx_posted_events);
|
||||
ngx_event_process_posted_next(cycle, &ngx_posted_next_events);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ static ssize_t ngx_ssl_recv_early(ngx_connection_t *c, u_char *buf,
|
||||
#endif
|
||||
static ngx_int_t ngx_ssl_handle_recv(ngx_connection_t *c, int n);
|
||||
static void ngx_ssl_write_handler(ngx_event_t *wev);
|
||||
static void ngx_ssl_next_read_handler(ngx_event_t *rev);
|
||||
#ifdef SSL_READ_EARLY_DATA_SUCCESS
|
||||
static ssize_t ngx_ssl_write_early(ngx_connection_t *c, u_char *data,
|
||||
size_t size);
|
||||
@@ -2027,11 +2026,6 @@ ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
||||
c->read->available = 0;
|
||||
c->read->ready = 0;
|
||||
|
||||
if (c->ssl->next_read_handler == NULL) {
|
||||
c->ssl->next_read_handler = c->read->handler;
|
||||
c->read->handler = ngx_ssl_next_read_handler;
|
||||
}
|
||||
|
||||
ngx_post_event(c->read, &ngx_posted_next_events);
|
||||
}
|
||||
|
||||
@@ -2337,31 +2331,6 @@ ngx_ssl_write_handler(ngx_event_t *wev)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_ssl_next_read_handler(ngx_event_t *rev)
|
||||
{
|
||||
ngx_connection_t *c;
|
||||
|
||||
c = rev->data;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL next read handler");
|
||||
|
||||
rev->handler = c->ssl->next_read_handler;
|
||||
c->ssl->next_read_handler = NULL;
|
||||
|
||||
if (!rev->ready) {
|
||||
rev->ready = 1;
|
||||
rev->available = -1;
|
||||
}
|
||||
|
||||
if (rev->posted) {
|
||||
ngx_delete_posted_event(rev);
|
||||
}
|
||||
|
||||
rev->handler(rev);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* OpenSSL has no SSL_writev() so we copy several bufs into our 16K buffer
|
||||
* before the SSL_write() call to decrease a SSL overhead.
|
||||
|
||||
@@ -95,7 +95,6 @@ struct ngx_ssl_connection_s {
|
||||
|
||||
ngx_event_handler_pt saved_read_handler;
|
||||
ngx_event_handler_pt saved_write_handler;
|
||||
ngx_event_handler_pt next_read_handler;
|
||||
|
||||
u_char early_buf;
|
||||
|
||||
|
||||
@@ -34,3 +34,29 @@ ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted)
|
||||
ev->handler(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ngx_event_process_posted_next(ngx_cycle_t *cycle, ngx_queue_t *posted)
|
||||
{
|
||||
ngx_queue_t *q;
|
||||
ngx_event_t *ev;
|
||||
|
||||
while (!ngx_queue_empty(posted)) {
|
||||
|
||||
q = ngx_queue_head(posted);
|
||||
ev = ngx_queue_data(q, ngx_event_t, queue);
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
||||
"posted next event %p", ev);
|
||||
|
||||
ngx_delete_posted_event(ev);
|
||||
|
||||
if (!ev->ready) {
|
||||
ev->ready = 1;
|
||||
ev->available = -1;
|
||||
}
|
||||
|
||||
ev->handler(ev);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
|
||||
void ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted);
|
||||
void ngx_event_process_posted_next(ngx_cycle_t *cycle, ngx_queue_t *posted);
|
||||
|
||||
|
||||
extern ngx_queue_t ngx_posted_accept_events;
|
||||
|
||||
@@ -56,7 +56,7 @@ static ngx_int_t ngx_http_dav_copy_tree_file(ngx_tree_ctx_t *ctx,
|
||||
static ngx_int_t ngx_http_dav_depth(ngx_http_request_t *r, ngx_int_t dflt);
|
||||
static ngx_int_t ngx_http_dav_error(ngx_log_t *log, ngx_err_t err,
|
||||
ngx_int_t not_found, char *failed, u_char *path);
|
||||
static ngx_int_t ngx_http_dav_location(ngx_http_request_t *r, u_char *path);
|
||||
static ngx_int_t ngx_http_dav_location(ngx_http_request_t *r);
|
||||
static void *ngx_http_dav_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_dav_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
@@ -285,7 +285,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
if (status == NGX_HTTP_CREATED) {
|
||||
if (ngx_http_dav_location(r, path.data) != NGX_OK) {
|
||||
if (ngx_http_dav_location(r) != NGX_OK) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ ngx_http_dav_delete_handler(ngx_http_request_t *r)
|
||||
ngx_file_info_t fi;
|
||||
ngx_http_dav_loc_conf_t *dlcf;
|
||||
|
||||
if (r->headers_in.content_length_n > 0) {
|
||||
if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"DELETE with body is unsupported");
|
||||
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
|
||||
@@ -495,7 +495,7 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf)
|
||||
size_t root;
|
||||
ngx_str_t path;
|
||||
|
||||
if (r->headers_in.content_length_n > 0) {
|
||||
if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"MKCOL with body is unsupported");
|
||||
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
|
||||
@@ -513,7 +513,6 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf)
|
||||
}
|
||||
|
||||
*(p - 1) = '\0';
|
||||
r->uri.len--;
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"http mkcol path: \"%s\"", path.data);
|
||||
@@ -521,7 +520,7 @@ ngx_http_dav_mkcol_handler(ngx_http_request_t *r, ngx_http_dav_loc_conf_t *dlcf)
|
||||
if (ngx_create_dir(path.data, ngx_dir_access(dlcf->access))
|
||||
!= NGX_FILE_ERROR)
|
||||
{
|
||||
if (ngx_http_dav_location(r, path.data) != NGX_OK) {
|
||||
if (ngx_http_dav_location(r) != NGX_OK) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@@ -550,7 +549,9 @@ ngx_http_dav_copy_move_handler(ngx_http_request_t *r)
|
||||
ngx_http_dav_copy_ctx_t copy;
|
||||
ngx_http_dav_loc_conf_t *dlcf;
|
||||
|
||||
if (r->headers_in.content_length_n > 0) {
|
||||
if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"COPY and MOVE with body are unsupported");
|
||||
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
|
||||
}
|
||||
|
||||
@@ -1069,35 +1070,16 @@ ngx_http_dav_error(ngx_log_t *log, ngx_err_t err, ngx_int_t not_found,
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_dav_location(ngx_http_request_t *r, u_char *path)
|
||||
ngx_http_dav_location(ngx_http_request_t *r)
|
||||
{
|
||||
u_char *location;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
|
||||
if (r->headers_out.location == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
if (!clcf->alias && clcf->root_lengths == NULL) {
|
||||
location = path + clcf->root.len;
|
||||
|
||||
} else {
|
||||
location = ngx_pnalloc(r->pool, r->uri.len);
|
||||
if (location == NULL) {
|
||||
ngx_http_clear_location(r);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_memcpy(location, r->uri.data, r->uri.len);
|
||||
}
|
||||
|
||||
r->headers_out.location->hash = 1;
|
||||
ngx_str_set(&r->headers_out.location->key, "Location");
|
||||
r->headers_out.location->value.len = r->uri.len;
|
||||
r->headers_out.location->value.data = location;
|
||||
r->headers_out.location->value = r->uri;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
|
||||
|
||||
name = ngx_http_map_uri_to_path(r, &path, &root, reserve);
|
||||
if (name == NULL) {
|
||||
return NGX_ERROR;
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
allocated = path.data + path.len - name;
|
||||
|
||||
@@ -318,6 +318,11 @@ ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
value = cf->args->elts;
|
||||
|
||||
if (value[2].len == 0) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty replacement");
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
|
||||
|
||||
rc.pattern = value[1];
|
||||
|
||||
@@ -157,8 +157,8 @@ ngx_http_static_handler(ngx_http_request_t *r)
|
||||
|
||||
len = r->uri.len + 1;
|
||||
|
||||
if (!clcf->alias && clcf->root_lengths == NULL && r->args.len == 0) {
|
||||
location = path.data + clcf->root.len;
|
||||
if (!clcf->alias && r->args.len == 0) {
|
||||
location = path.data + root;
|
||||
|
||||
*last = '/';
|
||||
|
||||
|
||||
@@ -1857,7 +1857,8 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
|
||||
}
|
||||
}
|
||||
|
||||
last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
|
||||
last = ngx_copy(last, r->uri.data + alias, r->uri.len - alias);
|
||||
*last = '\0';
|
||||
|
||||
return last;
|
||||
}
|
||||
|
||||
@@ -1470,7 +1470,14 @@ ngx_http_script_return_code(ngx_http_script_engine_t *e)
|
||||
void
|
||||
ngx_http_script_break_code(ngx_http_script_engine_t *e)
|
||||
{
|
||||
e->request->uri_changed = 0;
|
||||
ngx_http_request_t *r;
|
||||
|
||||
r = e->request;
|
||||
|
||||
if (r->uri_changed) {
|
||||
r->valid_location = 0;
|
||||
r->uri_changed = 0;
|
||||
}
|
||||
|
||||
e->ip = ngx_http_script_exit;
|
||||
}
|
||||
|
||||
@@ -622,6 +622,12 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
|
||||
return ngx_http_named_location(r, &uri);
|
||||
}
|
||||
|
||||
r->expect_tested = 1;
|
||||
|
||||
if (ngx_http_discard_request_body(r) != NGX_OK) {
|
||||
r->keepalive = 0;
|
||||
}
|
||||
|
||||
location = ngx_list_push(&r->headers_out.headers);
|
||||
|
||||
if (location == NULL) {
|
||||
|
||||
@@ -178,6 +178,7 @@ static void ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r);
|
||||
static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c,
|
||||
ngx_http_v2_stream_t *stream, ngx_uint_t status);
|
||||
static void ngx_http_v2_close_stream_handler(ngx_event_t *ev);
|
||||
static void ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev);
|
||||
static void ngx_http_v2_handle_connection_handler(ngx_event_t *rev);
|
||||
static void ngx_http_v2_idle_handler(ngx_event_t *rev);
|
||||
static void ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c,
|
||||
@@ -4298,8 +4299,9 @@ ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc)
|
||||
fc = stream->request->connection;
|
||||
|
||||
if (stream->queued) {
|
||||
fc->write->handler = ngx_http_v2_close_stream_handler;
|
||||
fc->read->handler = ngx_http_empty_handler;
|
||||
fc->error = 1;
|
||||
fc->write->handler = ngx_http_v2_retry_close_stream_handler;
|
||||
fc->read->handler = ngx_http_v2_retry_close_stream_handler;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4421,6 +4423,22 @@ ngx_http_v2_close_stream_handler(ngx_event_t *ev)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev)
|
||||
{
|
||||
ngx_connection_t *fc;
|
||||
ngx_http_request_t *r;
|
||||
|
||||
fc = ev->data;
|
||||
r = fc->data;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0,
|
||||
"http2 retry close stream handler");
|
||||
|
||||
ngx_http_v2_close_stream(r->stream, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_v2_handle_connection_handler(ngx_event_t *rev)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user