aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/proxy/ngx_http_proxy_handler.h
blob: 9aeb965a038a5625825cc02d59f57f1fa8a11fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
#define _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_http.h>


typedef struct {
    ngx_msec_t    connect_timeout;
    ngx_msec_t    send_timeout;
    ssize_t       header_size;
    ngx_msec_t    read_timeout;

    ngx_peers_t  *peers;
} ngx_http_proxy_loc_conf_t;


typedef struct {
    ngx_table_elt_t  *date;
    ngx_table_elt_t  *server;
    ngx_table_elt_t  *connection;
    ngx_table_elt_t  *content_type;
    ngx_table_elt_t  *content_length;
    ngx_table_elt_t  *last_modified;

    ngx_table_t      *headers;
} ngx_http_proxy_headers_in_t;


typedef struct ngx_http_proxy_ctx_s  ngx_http_proxy_ctx_t;

struct ngx_http_proxy_ctx_s {
    ngx_peer_connection_t         upstream;
    ngx_peer_t                   *peer;

    ngx_http_request_t           *request;
    ngx_http_proxy_loc_conf_t    *lcf;
    ngx_http_proxy_headers_in_t   headers_in;

    ngx_hunk_t                 *header_in;
    int                         status;
    ngx_str_t                   status_line;

    ngx_chain_t                *work_request_hunks;
    ngx_chain_t                *request_hunks;

    int                         method;
    ngx_str_t                   uri;
    int                         location_len;
    ngx_str_t                   host_header;

    /* used to parse an upstream HTTP header */
    char                       *status_start;
    char                       *status_end;
    int                         status_count;
    int                         state;

    char                       *action;
};


#define NGX_HTTP_PROXY_PARSE_NO_HEADER  20


#endif /* _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_ */