diff options
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/modules/proxy/ngx_http_event_proxy_handler.c | 41 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.c | 12 |
2 files changed, 24 insertions, 29 deletions
diff --git a/src/http/modules/proxy/ngx_http_event_proxy_handler.c b/src/http/modules/proxy/ngx_http_event_proxy_handler.c index 9b1ddc4e3..cb48deb66 100644 --- a/src/http/modules/proxy/ngx_http_event_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_event_proxy_handler.c @@ -298,41 +298,36 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) /* the request line */ - ngx_memcpy(hunk->last, http_methods[p->method - 1].data, - http_methods[p->method - 1].len); - hunk->last += http_methods[p->method - 1].len; + hunk->last = ngx_cpymem(hunk->last, http_methods[p->method - 1].data, + http_methods[p->method - 1].len); - ngx_memcpy(hunk->last, p->upstream_url->uri.data, p->upstream_url->uri.len); - hunk->last += p->upstream_url->uri.len; + hunk->last = ngx_cpymem(hunk->last, p->upstream_url->uri.data, + p->upstream_url->uri.len); - ngx_memcpy(hunk->last, r->uri.data + p->upstream_url->location->len, - r->uri.len - p->upstream_url->location->len); - hunk->last += r->uri.len - p->upstream_url->location->len; + hunk->last = ngx_cpymem(hunk->last, + r->uri.data + p->upstream_url->location->len, + r->uri.len - p->upstream_url->location->len); if (r->args.len > 0) { *(hunk->last++) = '?'; - ngx_memcpy(hunk->last, r->args.data, r->args.len); - hunk->last += r->args.len; + hunk->last = ngx_cpymem(hunk->last, r->args.data, r->args.len); } - ngx_memcpy(hunk->last, http_version, sizeof(http_version) - 1); - hunk->last += sizeof(http_version) - 1; + hunk->last = ngx_cpymem(hunk->last, http_version, sizeof(http_version) - 1); /* the "Host" header */ - ngx_memcpy(hunk->last, host_header, sizeof(host_header) - 1); - hunk->last += sizeof(host_header) - 1; + hunk->last = ngx_cpymem(hunk->last, host_header, sizeof(host_header) - 1); - ngx_memcpy(hunk->last, p->upstream_url->host.data, - p->upstream_url->host.len); - hunk->last += p->upstream_url->host.len; + hunk->last = ngx_cpymem(hunk->last, p->upstream_url->host.data, + p->upstream_url->host.len); *(hunk->last++) = CR; *(hunk->last++) = LF; /* the "Connection: close" header */ - ngx_memcpy(hunk->last, conn_close_header, sizeof(conn_close_header) - 1); - hunk->last += sizeof(conn_close_header) - 1; + hunk->last = ngx_cpymem(hunk->last, conn_close_header, + sizeof(conn_close_header) - 1); for (i = 0; i < r->headers_in.headers->nelts; i++) { @@ -344,13 +339,13 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) continue; } - ngx_memcpy(hunk->last, header[i].key.data, header[i].key.len); - hunk->last += header[i].key.len; + hunk->last = ngx_cpymem(hunk->last, header[i].key.data, + header[i].key.len); *(hunk->last++) = ':'; *(hunk->last++) = ' '; - ngx_memcpy(hunk->last, header[i].value.data, header[i].value.len); - hunk->last += header[i].value.len; + hunk->last = ngx_cpymem(hunk->last, header[i].value.data, + header[i].value.len); *(hunk->last++) = CR; *(hunk->last++) = LF; diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 9eab6ad08..0e67f3358 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -43,7 +43,7 @@ static ngx_command_t ngx_http_core_commands[] = { {ngx_string("post_accept_timeout"), NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, - ngx_conf_set_time_slot, + ngx_conf_set_msec_slot, 0, addressof(ngx_http_post_accept_timeout)}, @@ -61,7 +61,7 @@ static ngx_command_t ngx_http_core_commands[] = { {ngx_string("client_header_timeout"), NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, - ngx_conf_set_time_slot, + ngx_conf_set_msec_slot, 0, addressof(ngx_http_client_header_timeout)}, @@ -103,19 +103,19 @@ static ngx_command_t ngx_http_core_commands[] = { {ngx_string("send_timeout"), NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_conf_set_time_slot, + ngx_conf_set_msec_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_core_loc_conf_t, send_timeout)}, {ngx_string("lingering_time"), NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_conf_set_time_slot, + ngx_conf_set_msec_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_core_loc_conf_t, lingering_time)}, {ngx_string("lingering_timeout"), NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_conf_set_time_slot, + ngx_conf_set_msec_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_core_loc_conf_t, lingering_timeout)}, @@ -239,7 +239,7 @@ ngx_log_debug(r->connection->log, "trans: %s" _ plcf[i]->name.data); continue; } - rc = ngx_strncmp(r->uri.data, plcf[i]->name.data, plcf[i]->name.len); + rc = ngx_rstrncmp(r->uri.data, plcf[i]->name.data, plcf[i]->name.len); if (rc < 0) { break; |
