Request body: filters support.
Maxim Dounin
7 years ago
68 | 68 |
ngx_uint_t ngx_http_max_module;
|
69 | 69 |
|
70 | 70 |
|
71 | |
ngx_int_t (*ngx_http_top_header_filter) (ngx_http_request_t *r);
|
72 | |
ngx_int_t (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
|
|
71 |
ngx_http_output_header_filter_pt ngx_http_top_header_filter;
|
|
72 |
ngx_http_output_body_filter_pt ngx_http_top_body_filter;
|
|
73 |
ngx_http_request_body_filter_pt ngx_http_top_request_body_filter;
|
73 | 74 |
|
74 | 75 |
|
75 | 76 |
ngx_str_t ngx_http_html_default_types[] = {
|
176 | 176 |
|
177 | 177 |
extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
|
178 | 178 |
extern ngx_http_output_body_filter_pt ngx_http_top_body_filter;
|
|
179 |
extern ngx_http_request_body_filter_pt ngx_http_top_request_body_filter;
|
179 | 180 |
|
180 | 181 |
|
181 | 182 |
#endif /* _NGX_HTTP_H_INCLUDED_ */
|
25 | 25 |
ngx_http_location_tree_node_t *node);
|
26 | 26 |
|
27 | 27 |
static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf);
|
|
28 |
static ngx_int_t ngx_http_core_postconfiguration(ngx_conf_t *cf);
|
28 | 29 |
static void *ngx_http_core_create_main_conf(ngx_conf_t *cf);
|
29 | 30 |
static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf);
|
30 | 31 |
static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf);
|
|
778 | 779 |
|
779 | 780 |
static ngx_http_module_t ngx_http_core_module_ctx = {
|
780 | 781 |
ngx_http_core_preconfiguration, /* preconfiguration */
|
781 | |
NULL, /* postconfiguration */
|
|
782 |
ngx_http_core_postconfiguration, /* postconfiguration */
|
782 | 783 |
|
783 | 784 |
ngx_http_core_create_main_conf, /* create main configuration */
|
784 | 785 |
ngx_http_core_init_main_conf, /* init main configuration */
|
|
3416 | 3417 |
ngx_http_core_preconfiguration(ngx_conf_t *cf)
|
3417 | 3418 |
{
|
3418 | 3419 |
return ngx_http_variables_add_core_vars(cf);
|
|
3420 |
}
|
|
3421 |
|
|
3422 |
|
|
3423 |
static ngx_int_t
|
|
3424 |
ngx_http_core_postconfiguration(ngx_conf_t *cf)
|
|
3425 |
{
|
|
3426 |
ngx_http_top_request_body_filter = ngx_http_request_body_save_filter;
|
|
3427 |
|
|
3428 |
return NGX_OK;
|
3419 | 3429 |
}
|
3420 | 3430 |
|
3421 | 3431 |
|
532 | 532 |
typedef ngx_int_t (*ngx_http_output_header_filter_pt)(ngx_http_request_t *r);
|
533 | 533 |
typedef ngx_int_t (*ngx_http_output_body_filter_pt)
|
534 | 534 |
(ngx_http_request_t *r, ngx_chain_t *chain);
|
|
535 |
typedef ngx_int_t (*ngx_http_request_body_filter_pt)
|
|
536 |
(ngx_http_request_t *r, ngx_chain_t *chain);
|
535 | 537 |
|
536 | 538 |
|
537 | 539 |
ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
538 | 540 |
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
|
541 |
ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r,
|
|
542 |
ngx_chain_t *chain);
|
539 | 543 |
|
540 | 544 |
|
541 | 545 |
ngx_int_t ngx_http_set_disable_symlinks(ngx_http_request_t *r,
|
22 | 22 |
static ngx_int_t ngx_http_request_body_length_filter(ngx_http_request_t *r,
|
23 | 23 |
ngx_chain_t *in);
|
24 | 24 |
static ngx_int_t ngx_http_request_body_chunked_filter(ngx_http_request_t *r,
|
25 | |
ngx_chain_t *in);
|
26 | |
static ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r,
|
27 | 25 |
ngx_chain_t *in);
|
28 | 26 |
|
29 | 27 |
|
|
882 | 880 |
ll = &tl->next;
|
883 | 881 |
}
|
884 | 882 |
|
885 | |
rc = ngx_http_request_body_save_filter(r, out);
|
|
883 |
rc = ngx_http_top_request_body_filter(r, out);
|
886 | 884 |
|
887 | 885 |
ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
|
888 | 886 |
(ngx_buf_tag_t) &ngx_http_read_client_request_body);
|
|
1034 | 1032 |
}
|
1035 | 1033 |
}
|
1036 | 1034 |
|
1037 | |
rc = ngx_http_request_body_save_filter(r, out);
|
|
1035 |
rc = ngx_http_top_request_body_filter(r, out);
|
1038 | 1036 |
|
1039 | 1037 |
ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
|
1040 | 1038 |
(ngx_buf_tag_t) &ngx_http_read_client_request_body);
|
|
1043 | 1041 |
}
|
1044 | 1042 |
|
1045 | 1043 |
|
1046 | |
static ngx_int_t
|
|
1044 |
ngx_int_t
|
1047 | 1045 |
ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
1048 | 1046 |
{
|
1049 | 1047 |
#if (NGX_DEBUG)
|