Klaus Demo nginx / d02d2cf
Request body: filters support. Maxim Dounin 7 years ago
5 changed file(s) with 22 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
6868 ngx_uint_t ngx_http_max_module;
6969
7070
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;
7374
7475
7576 ngx_str_t ngx_http_html_default_types[] = {
176176
177177 extern ngx_http_output_header_filter_pt ngx_http_top_header_filter;
178178 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;
179180
180181
181182 #endif /* _NGX_HTTP_H_INCLUDED_ */
2525 ngx_http_location_tree_node_t *node);
2626
2727 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);
2829 static void *ngx_http_core_create_main_conf(ngx_conf_t *cf);
2930 static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf);
3031 static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf);
778779
779780 static ngx_http_module_t ngx_http_core_module_ctx = {
780781 ngx_http_core_preconfiguration, /* preconfiguration */
781 NULL, /* postconfiguration */
782 ngx_http_core_postconfiguration, /* postconfiguration */
782783
783784 ngx_http_core_create_main_conf, /* create main configuration */
784785 ngx_http_core_init_main_conf, /* init main configuration */
34163417 ngx_http_core_preconfiguration(ngx_conf_t *cf)
34173418 {
34183419 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;
34193429 }
34203430
34213431
532532 typedef ngx_int_t (*ngx_http_output_header_filter_pt)(ngx_http_request_t *r);
533533 typedef ngx_int_t (*ngx_http_output_body_filter_pt)
534534 (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);
535537
536538
537539 ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
538540 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);
539543
540544
541545 ngx_int_t ngx_http_set_disable_symlinks(ngx_http_request_t *r,
2222 static ngx_int_t ngx_http_request_body_length_filter(ngx_http_request_t *r,
2323 ngx_chain_t *in);
2424 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,
2725 ngx_chain_t *in);
2826
2927
882880 ll = &tl->next;
883881 }
884882
885 rc = ngx_http_request_body_save_filter(r, out);
883 rc = ngx_http_top_request_body_filter(r, out);
886884
887885 ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
888886 (ngx_buf_tag_t) &ngx_http_read_client_request_body);
10341032 }
10351033 }
10361034
1037 rc = ngx_http_request_body_save_filter(r, out);
1035 rc = ngx_http_top_request_body_filter(r, out);
10381036
10391037 ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
10401038 (ngx_buf_tag_t) &ngx_http_read_client_request_body);
10431041 }
10441042
10451043
1046 static ngx_int_t
1044 ngx_int_t
10471045 ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
10481046 {
10491047 #if (NGX_DEBUG)