diff options
Diffstat (limited to 'src/http/modules/proxy')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 66 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.h | 54 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_header.c | 4 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_parse.c | 4 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_upstream.c | 2 |
5 files changed, 67 insertions, 63 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index e382f05e2..d36867dba 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -7,12 +7,12 @@ static int ngx_http_proxy_handler(ngx_http_request_t *r); -static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, - uintptr_t data); -static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf, - uintptr_t data); -static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf, - uintptr_t data); +static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, + u_char *buf, uintptr_t data); +static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, + u_char *buf, uintptr_t data); +static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, + uintptr_t data); static int ngx_http_proxy_pre_conf(ngx_conf_t *cf); static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); @@ -146,7 +146,7 @@ static ngx_command_t ngx_http_proxy_commands[] = { ngx_conf_set_path_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_proxy_loc_conf_t, temp_path), - ngx_garbage_collector_temp_handler }, + (void *) ngx_garbage_collector_temp_handler }, { ngx_string("proxy_temp_file_write_size"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, @@ -591,7 +591,7 @@ void ngx_http_proxy_close_connection(ngx_http_proxy_ctx_t *p) ngx_close_socket_n " failed"); } - c->fd = -1; + c->fd = (ngx_socket_t) -1; } @@ -614,12 +614,12 @@ size_t ngx_http_proxy_log_error(void *data, char *buf, size_t len) ctx->proxy->lcf->upstream->uri.data, r->uri.data + ctx->proxy->lcf->upstream->location->len, r->args.len ? "?" : "", - r->args.len ? r->args.data : ""); + r->args.len ? r->args.data : (u_char *) ""); } -static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, - uintptr_t data) +static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, + u_char *buf, uintptr_t data) { ngx_http_proxy_ctx_t *p; @@ -644,7 +644,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, *buf++ = '-'; } else { - buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->expired); + buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN, + TIME_T_FMT, p->state->expired); } *buf++ = '/'; @@ -653,7 +654,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, *buf++ = '-'; } else { - buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->bl_time); + buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN, + TIME_T_FMT, p->state->bl_time); } *buf++ = '/'; @@ -666,7 +668,7 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, *buf++ = '-'; } else { - buf += ngx_snprintf(buf, 4, "%d", p->state->status); + buf += ngx_snprintf((char *) buf, 4, "%d", p->state->status); } *buf++ = '/'; @@ -685,7 +687,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, *buf++ = '-'; } else { - buf += ngx_snprintf(buf, NGX_TIME_T_LEN, TIME_T_FMT, p->state->expires); + buf += ngx_snprintf((char *) buf, NGX_TIME_T_LEN, + TIME_T_FMT, p->state->expires); } *buf++ = ' '; @@ -695,8 +698,8 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, } -static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf, - uintptr_t data) +static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, + u_char *buf, uintptr_t data) { ngx_http_proxy_ctx_t *p; @@ -712,8 +715,8 @@ static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf, } -static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf, - uintptr_t data) +static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, + uintptr_t data) { ngx_http_proxy_ctx_t *p; @@ -777,17 +780,17 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) */ - conf->request_buffer_size = NGX_CONF_UNSET; - conf->connect_timeout = NGX_CONF_UNSET; - conf->send_timeout = NGX_CONF_UNSET; + conf->request_buffer_size = NGX_CONF_UNSET_SIZE; + conf->connect_timeout = NGX_CONF_UNSET_MSEC; + conf->send_timeout = NGX_CONF_UNSET_MSEC; conf->preserve_host = NGX_CONF_UNSET; conf->set_x_real_ip = NGX_CONF_UNSET; conf->add_x_forwarded_for = NGX_CONF_UNSET; - conf->header_buffer_size = NGX_CONF_UNSET; - conf->read_timeout = NGX_CONF_UNSET; - conf->busy_buffers_size = NGX_CONF_UNSET; + conf->header_buffer_size = NGX_CONF_UNSET_SIZE; + conf->read_timeout = NGX_CONF_UNSET_MSEC; + conf->busy_buffers_size = NGX_CONF_UNSET_SIZE; /* * "proxy_max_temp_file_size" is hardcoded to 1G for reverse proxy, @@ -795,7 +798,7 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) */ conf->max_temp_file_size = 1024 * 1024 * 1024; - conf->temp_file_write_size = NGX_CONF_UNSET; + conf->temp_file_write_size = NGX_CONF_UNSET_SIZE; /* "proxy_cyclic_temp_file" is disabled */ conf->cyclic_temp_file = 0; @@ -906,8 +909,9 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, { ngx_http_proxy_loc_conf_t *lcf = conf; - int i, len; - char *err, *host; + ngx_uint_t i, len; + char *err; + u_char *host; in_addr_t addr; ngx_str_t *value; struct hostent *h; @@ -946,10 +950,10 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, /* AF_INET only */ - addr = inet_addr(host); + addr = inet_addr((char *) host); if (addr == INADDR_NONE) { - h = gethostbyname(host); + h = gethostbyname((char *) host); if (h == NULL || h->h_addr_list[0] == NULL) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "host %s not found", host); @@ -980,7 +984,7 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, NGX_CONF_ERROR); len = ngx_inet_ntop(AF_INET, - (char *) &lcf->peers->peers[i].addr, + (u_char *) &lcf->peers->peers[i].addr, lcf->peers->peers[i].addr_port_text.data, len); diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h index dd9cd15fc..2e6cb8473 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.h +++ b/src/http/modules/proxy/ngx_http_proxy_handler.h @@ -40,40 +40,40 @@ typedef struct { ngx_str_t host_header; ngx_str_t port_text; ngx_str_t *location; - int port; + + ngx_int_t port; + unsigned default_port:1; } ngx_http_proxy_upstream_conf_t; typedef struct { - ssize_t request_buffer_size; + size_t request_buffer_size; + size_t header_buffer_size; + size_t busy_buffers_size; + size_t max_temp_file_size; + size_t temp_file_write_size; + ngx_msec_t connect_timeout; ngx_msec_t send_timeout; - ssize_t header_buffer_size; ngx_msec_t read_timeout; + time_t default_expires; + + ngx_int_t lm_factor; + + ngx_uint_t next_upstream; + ngx_uint_t use_stale; ngx_bufs_t bufs; - ssize_t busy_buffers_size; - ssize_t max_temp_file_size; - ssize_t temp_file_write_size; ngx_flag_t cyclic_temp_file; - ngx_flag_t cache; - ngx_flag_t preserve_host; ngx_flag_t set_x_real_ip; ngx_flag_t add_x_forwarded_for; - ngx_flag_t pass_server; ngx_flag_t pass_x_accel_expires; - ngx_flag_t ignore_expires; - int lm_factor; - time_t default_expires; - - u_int next_upstream; - u_int use_stale; ngx_path_t *cache_path; ngx_path_t *temp_path; @@ -96,9 +96,9 @@ typedef struct { ngx_http_proxy_state_e cache_state; time_t expired; time_t bl_time; - int bl_state; + ngx_uint_t bl_state; - int status; + ngx_uint_t status; ngx_http_proxy_reason_e reason; time_t time; time_t expires; @@ -130,7 +130,7 @@ typedef struct { typedef struct { ngx_http_cache_ctx_t ctx; - int status; + ngx_uint_t status; ngx_str_t status_line; ngx_http_proxy_headers_in_t headers_in; @@ -139,9 +139,9 @@ typedef struct { typedef struct { ngx_peer_connection_t peer; - int status; + ngx_uint_t status; ngx_str_t status_line; - int method; + ngx_uint_t method; ngx_output_chain_ctx_t *output_chain_ctx; ngx_event_pipe_t *event_pipe; @@ -175,23 +175,23 @@ struct ngx_http_proxy_ctx_s { /* used to parse an upstream HTTP header */ - int status; - char *status_start; - char *status_end; - int status_count; - int parse_state; + ngx_uint_t status; + u_char *status_start; + u_char *status_end; + ngx_uint_t status_count; + ngx_uint_t parse_state; ngx_http_proxy_state_t *state; ngx_array_t states; /* of ngx_http_proxy_state_t */ - char *action; + u_char *action; ngx_http_log_ctx_t *saved_ctx; ngx_log_handler_pt saved_handler; }; typedef struct { - u_int connection; + ngx_uint_t connection; ngx_http_proxy_ctx_t *proxy; } ngx_http_proxy_log_ctx_t; diff --git a/src/http/modules/proxy/ngx_http_proxy_header.c b/src/http/modules/proxy/ngx_http_proxy_header.c index 0c44a5248..66a6bfe01 100644 --- a/src/http/modules/proxy/ngx_http_proxy_header.c +++ b/src/http/modules/proxy/ngx_http_proxy_header.c @@ -11,7 +11,7 @@ static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p, int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p, ngx_http_proxy_headers_in_t *headers_in) { - int i; + ngx_uint_t i; ngx_table_elt_t *ho, *h; ngx_http_request_t *r; @@ -97,7 +97,7 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p, static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p, ngx_table_elt_t *loc) { - char *last; + u_char *last; ngx_http_request_t *r; ngx_http_proxy_upstream_conf_t *uc; diff --git a/src/http/modules/proxy/ngx_http_proxy_parse.c b/src/http/modules/proxy/ngx_http_proxy_parse.c index a69795850..5e76dc043 100644 --- a/src/http/modules/proxy/ngx_http_proxy_parse.c +++ b/src/http/modules/proxy/ngx_http_proxy_parse.c @@ -7,8 +7,8 @@ int ngx_http_proxy_parse_status_line(ngx_http_proxy_ctx_t *p) { - char ch; - char *pos; + u_char ch; + u_char *pos; enum { sw_start = 0, sw_H, diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c index dc55050bf..7704cb1ce 100644 --- a/src/http/modules/proxy/ngx_http_proxy_upstream.c +++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c @@ -98,8 +98,8 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p) static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) { - int i; size_t len; + ngx_uint_t i; ngx_hunk_t *h; ngx_chain_t *chain; ngx_table_elt_t *header; |