ASF Bugzilla – Attachment 32879 Details for
Bug 56729
Can't use HTTP 1.1 Keep-Alive with mod_reqtimeout if POST request with POST-DATA respond during more than ->RequestReadTimeout body=[timeout]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Use reqtimeout_before_headers instead of reqtimeout_after_body for the HTTP header state
httpd-trunk-reqtimeout_in_keep_alive-v2.patch (text/plain), 4.39 KB, created by
Yann Ylavic
on 2015-07-02 15:41:22 UTC
(
hide
)
Description:
Use reqtimeout_before_headers instead of reqtimeout_after_body for the HTTP header state
Filename:
MIME Type:
Creator:
Yann Ylavic
Created:
2015-07-02 15:41:22 UTC
Size:
4.39 KB
patch
obsolete
>Index: modules/filters/mod_reqtimeout.c >=================================================================== >--- modules/filters/mod_reqtimeout.c (revision 1688475) >+++ modules/filters/mod_reqtimeout.c (working copy) >@@ -163,7 +163,6 @@ static apr_status_t brigade_append(apr_bucket_brig > return APR_SUCCESS; > } > >- > #define MIN(x,y) ((x) < (y) ? (x) : (y)) > static apr_status_t reqtimeout_filter(ap_filter_t *f, > apr_bucket_brigade *bb, >@@ -178,9 +177,15 @@ static apr_status_t reqtimeout_filter(ap_filter_t > reqtimeout_con_cfg *ccfg = f->ctx; > > if (ccfg->in_keep_alive) { >- /* For this read, the normal keep-alive timeout must be used */ >+ /* For this read_request_line(), wait for the first byte >+ * using the normal keep-alive timeout, before proceeding. >+ */ > ccfg->in_keep_alive = 0; >- return ap_get_brigade(f->next, bb, mode, block, readbytes); >+ rv = ap_get_brigade(f->next, bb, AP_MODE_SPECULATIVE, block, 1); >+ if (rv != APR_SUCCESS || APR_BRIGADE_EMPTY(bb)) { >+ return rv; >+ } >+ apr_brigade_cleanup(bb); > } > > if (block == APR_NONBLOCK_READ && mode == AP_MODE_SPECULATIVE) { >@@ -369,6 +374,29 @@ static int reqtimeout_init(conn_rec *c) > memset(ccfg, 0, sizeof(reqtimeout_con_cfg)); > } > >+ /* we are not handling the connection, we just do initialization */ >+ return DECLINED; >+} >+ >+static void reqtimeout_before_headers(request_rec *r, conn_rec *c) >+{ >+ reqtimeout_srv_cfg *cfg; >+ reqtimeout_con_cfg *ccfg = >+ ap_get_module_config(c->conn_config, &reqtimeout_module); >+ >+ if (ccfg == NULL) { >+ /* not configured for this connection */ >+ return; >+ } >+ >+ cfg = ap_get_module_config(c->base_server->module_config, >+ &reqtimeout_module); >+ AP_DEBUG_ASSERT(cfg != NULL); >+ >+ ccfg->timeout_at = 0; >+ ccfg->max_timeout_at = 0; >+ ccfg->in_keep_alive = (c->keepalives > 0); >+ > ccfg->type = "header"; > if (cfg->header_timeout != UNSET) { > ccfg->new_timeout = cfg->header_timeout; >@@ -382,9 +410,6 @@ static int reqtimeout_init(conn_rec *c) > ccfg->min_rate = MRT_DEFAULT_HEADER_MIN_RATE; > ccfg->rate_factor = default_header_rate_factor; > } >- >- /* we are not handling the connection, we just do initialization */ >- return DECLINED; > } > > static int reqtimeout_after_headers(request_rec *r) >@@ -419,41 +444,6 @@ static int reqtimeout_after_headers(request_rec *r > return OK; > } > >-static int reqtimeout_after_body(request_rec *r) >-{ >- reqtimeout_srv_cfg *cfg; >- reqtimeout_con_cfg *ccfg = >- ap_get_module_config(r->connection->conn_config, &reqtimeout_module); >- >- if (ccfg == NULL) { >- /* not configured for this connection */ >- return OK; >- } >- >- cfg = ap_get_module_config(r->connection->base_server->module_config, >- &reqtimeout_module); >- AP_DEBUG_ASSERT(cfg != NULL); >- >- ccfg->timeout_at = 0; >- ccfg->max_timeout_at = 0; >- ccfg->in_keep_alive = 1; >- ccfg->type = "header"; >- if (ccfg->new_timeout != UNSET) { >- ccfg->new_timeout = cfg->header_timeout; >- ccfg->new_max_timeout = cfg->header_max_timeout; >- ccfg->min_rate = cfg->header_min_rate; >- ccfg->rate_factor = cfg->header_rate_factor; >- } >- else { >- ccfg->new_timeout = MRT_DEFAULT_HEADER_TIMEOUT; >- ccfg->new_max_timeout = MRT_DEFAULT_HEADER_MAX_TIMEOUT; >- ccfg->min_rate = MRT_DEFAULT_HEADER_MIN_RATE; >- ccfg->rate_factor = default_header_rate_factor; >- } >- >- return OK; >-} >- > static void *reqtimeout_create_srv_config(apr_pool_t *p, server_rec *s) > { > reqtimeout_srv_cfg *cfg = apr_pcalloc(p, sizeof(reqtimeout_srv_cfg)); >@@ -624,10 +614,10 @@ static void reqtimeout_hooks(apr_pool_t *pool) > */ > ap_hook_process_connection(reqtimeout_init, NULL, NULL, APR_HOOK_LAST); > >+ ap_hook_pre_read_request(reqtimeout_before_headers, NULL, NULL, >+ APR_HOOK_MIDDLE); > ap_hook_post_read_request(reqtimeout_after_headers, NULL, NULL, > APR_HOOK_MIDDLE); >- ap_hook_log_transaction(reqtimeout_after_body, NULL, NULL, >- APR_HOOK_MIDDLE); > > #if MRT_DEFAULT_HEADER_MIN_RATE > 0 > default_header_rate_factor = apr_time_from_sec(1) / MRT_DEFAULT_HEADER_MIN_RATE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 56729
:
31817
|
31818
|
32863
|
32866
|
32867
|
32872
|
32873
|
32874
|
32875
|
32876
|
32877
| 32879