2003-04-15 01:04:58 +08:00
|
|
|
#ifndef _NGX_EVENT_PROXY_H_INCLUDED_
|
|
|
|
#define _NGX_EVENT_PROXY_H_INCLUDED_
|
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
2003-10-07 23:30:05 +08:00
|
|
|
#include <ngx_event.h>
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct ngx_event_proxy_s ngx_event_proxy_t;
|
|
|
|
|
2003-04-15 23:06:52 +08:00
|
|
|
typedef int (*ngx_event_proxy_input_filter_pt)(ngx_event_proxy_t *p,
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_hunk_t *hunk);
|
2003-04-15 01:04:58 +08:00
|
|
|
typedef int (*ngx_event_proxy_output_filter_pt)(void *data, ngx_hunk_t *hunk);
|
|
|
|
|
|
|
|
|
|
|
|
struct ngx_event_proxy_s {
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *free_raw_hunks;
|
|
|
|
ngx_chain_t *in;
|
|
|
|
ngx_chain_t **last_in;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *out;
|
|
|
|
ngx_chain_t **last_out;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *free;
|
|
|
|
ngx_chain_t *busy;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
/*
|
|
|
|
* the input filter i.e. that moves HTTP/1.1 chunks
|
|
|
|
* from the raw hunks to an incoming chain
|
|
|
|
*/
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_event_proxy_input_filter_pt input_filter;
|
|
|
|
void *input_ctx;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_event_proxy_output_filter_pt output_filter;
|
|
|
|
void *output_ctx;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-20 03:57:23 +08:00
|
|
|
unsigned read:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
unsigned cachable:1;
|
2003-10-17 04:19:16 +08:00
|
|
|
unsigned upstream_done:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
unsigned upstream_eof:1;
|
|
|
|
unsigned upstream_error:1;
|
2003-10-17 04:19:16 +08:00
|
|
|
unsigned downstream_done:1;
|
2003-04-18 01:59:35 +08:00
|
|
|
unsigned downstream_error:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-14 00:32:29 +08:00
|
|
|
int hunks;
|
|
|
|
ngx_bufs_t bufs;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
size_t max_busy_len;
|
|
|
|
|
2003-04-15 01:04:58 +08:00
|
|
|
off_t temp_offset;
|
2003-04-18 01:59:35 +08:00
|
|
|
off_t max_temp_file_size;
|
|
|
|
int temp_file_write_size;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
ngx_connection_t *upstream;
|
2003-04-18 01:59:35 +08:00
|
|
|
ngx_connection_t *downstream;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
ngx_pool_t *pool;
|
|
|
|
ngx_log_t *log;
|
|
|
|
|
2003-04-18 01:59:35 +08:00
|
|
|
ngx_chain_t *preread_hunks;
|
|
|
|
int preread_size;
|
|
|
|
|
2003-04-15 01:04:58 +08:00
|
|
|
ngx_file_t *temp_file;
|
|
|
|
ngx_path_t *temp_path;
|
|
|
|
char *temp_file_warn;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-10-20 03:57:23 +08:00
|
|
|
int ngx_event_proxy(ngx_event_proxy_t *p, int do_write);
|
|
|
|
int ngx_event_proxy_copy_input_filter(ngx_event_proxy_t *p, ngx_hunk_t *hunk);
|
|
|
|
|
|
|
|
/* STUB */
|
2003-04-15 01:04:58 +08:00
|
|
|
int ngx_event_proxy_read_upstream(ngx_event_proxy_t *p);
|
2003-04-18 01:59:35 +08:00
|
|
|
int ngx_event_proxy_write_to_downstream(ngx_event_proxy_t *p);
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* _NGX_EVENT_PROXY_H_INCLUDED_ */
|