diff options
Diffstat (limited to 'src/http/modules/proxy/ngx_http_event_proxy_handler.h')
-rw-r--r-- | src/http/modules/proxy/ngx_http_event_proxy_handler.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/src/http/modules/proxy/ngx_http_event_proxy_handler.h b/src/http/modules/proxy/ngx_http_event_proxy_handler.h new file mode 100644 index 000000000..9ddf11412 --- /dev/null +++ b/src/http/modules/proxy/ngx_http_event_proxy_handler.h @@ -0,0 +1,146 @@ +#ifndef _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ +#define _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_array.h> +#include <ngx_http.h> + + +#define NGX_HTTP_PROXY_PARSE_NO_HEADER 20 +#define NGX_HTTP_PARSE_TOO_LONG_STATUS_LINE 21 + +typedef struct { + int dummy; +} ngx_http_proxy_headers_in_t; + + +typedef struct { + u_int32_t addr; + ngx_str_t host; + int port; + ngx_str_t addr_port_name; + + int fails; + time_t accessed; +} ngx_http_proxy_upstream_t; + + +typedef struct { + int current; + int number; + int max_fails; + int fail_timeout; + + /* ngx_mutex_t mutex; */ + /* ngx_connection_t *cached; ??? */ + + ngx_http_proxy_upstream_t u[1]; +} ngx_http_proxy_upstreams_t; + + +typedef struct { + ngx_str_t host; + ngx_str_t uri; + ngx_str_t *location; + ngx_str_t host_header; + ngx_str_t port_name; + int port; +} ngx_http_proxy_upstream_url_t; + + +typedef struct { + ngx_http_proxy_upstreams_t *upstreams; + ngx_http_proxy_upstream_url_t *upstream_url; + + int rcvbuf; + int conn_pool_size; + int connect_timeout; + int send_timeout; + int read_timeout; + int header_size; + int large_header; + + int block_size; + int max_block_size; + + int retry_500_error; + +} ngx_http_proxy_loc_conf_t; + + +#if 0 +/* location /one/ { proxy_pass http://localhost:9000/two/; } */ + +typedef struct { + /* "/one/" */ + /* "http://localhost:9000/two/" */ + /* "/two/" */ + *upstream_farm; +} ngx_http_proxy_pass_t; +#endif + + +typedef struct ngx_http_proxy_ctx_s ngx_http_proxy_ctx_t; + +struct ngx_http_proxy_ctx_s { + ngx_chain_t *out; + + int last_hunk; + ngx_array_t hunks; + int hunks_number; + + int hunk_n; + + ngx_connection_t *connection; + ngx_http_request_t *request; + ngx_http_proxy_headers_in_t *headers_in; + + ngx_http_proxy_upstream_url_t *upstream_url; + ngx_http_proxy_upstreams_t *upstreams; + int cur_upstream; + int tries; + + struct sockaddr *sockaddr; + + ngx_http_proxy_loc_conf_t *lcf; + + ngx_log_t *log; + + int method; + + ngx_hunk_t *header_in; + int status; + ngx_str_t status_line; + ngx_str_t full_status_line; + + int state; + int status_count; + char *status_start; + char *status_end; + int (*state_write_upstream_handler) (ngx_http_proxy_ctx_t *p); + int (*state_read_upstream_handler) (ngx_http_proxy_ctx_t *p); + int (*state_handler)(ngx_http_proxy_ctx_t *p); + + int last_error; + + unsigned cached_connection:1; +}; + + +typedef struct { + char *action; + char *upstream; + char *client; + char *url; +} ngx_http_proxy_log_ctx_t; + + +extern ngx_module_t ngx_http_proxy_module; + + +static int ngx_http_proxy_error(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p, + int error); + + +#endif /* _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ */ |