mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
core: axe data_in_in/output_filter from conn_rec.
They were superseded by ap_filter_should_yield() and ap_run_in/output_pending() in r1706669 and had poor semantics since then (we can't maintain pending semantics both by filter and for the whole connection). Register ap_filter_input_pending() as the default input_pending hook (which seems to have been forgotten in the first place). On the MPM event side, we don't need to flush pending output data when the connection has just been processed, ap_filter_should_yield() is lightweight and enough to determine whether we should really enter write completion state or go straight to reading. ap_run_output_pending() is used only when write completion is in place and needs to be completed before more processing. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -585,14 +585,15 @@
|
|||||||
* 20180716.2 (2.5.1-dev) Add read_buf_size member to core_dir_config,
|
* 20180716.2 (2.5.1-dev) Add read_buf_size member to core_dir_config,
|
||||||
* flush_max_threshold and flush_max_pipelined to
|
* flush_max_threshold and flush_max_pipelined to
|
||||||
* core_server_config, and ap_get_read_buf_size().
|
* core_server_config, and ap_get_read_buf_size().
|
||||||
|
* 20180720.1 (2.5.1-dev) Axe data_in_{in,out}put_filter from conn_rec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
|
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
|
||||||
|
|
||||||
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
||||||
#define MODULE_MAGIC_NUMBER_MAJOR 20180716
|
#define MODULE_MAGIC_NUMBER_MAJOR 20180720
|
||||||
#endif
|
#endif
|
||||||
#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
|
#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
||||||
|
@@ -1163,16 +1163,6 @@ struct conn_rec {
|
|||||||
struct apr_bucket_alloc_t *bucket_alloc;
|
struct apr_bucket_alloc_t *bucket_alloc;
|
||||||
/** The current state of this connection; may be NULL if not used by MPM */
|
/** The current state of this connection; may be NULL if not used by MPM */
|
||||||
conn_state_t *cs;
|
conn_state_t *cs;
|
||||||
/** Used internally to force ap_filter_input_pending() decision,
|
|
||||||
* the public interface is ap_filter_should_yield(c->input_filters)
|
|
||||||
* or ap_filter_input_pending().
|
|
||||||
*/
|
|
||||||
int data_in_input_filters;
|
|
||||||
/** Used internally to force ap_filter_output_pending() decision,
|
|
||||||
* the public interface is ap_filter_should_yield(c->output_filters)
|
|
||||||
* or ap_filter_output_pending().
|
|
||||||
*/
|
|
||||||
int data_in_output_filters;
|
|
||||||
|
|
||||||
/** Are there any filters that clogg/buffer the input stream, breaking
|
/** Are there any filters that clogg/buffer the input stream, breaking
|
||||||
* the event mpm.
|
* the event mpm.
|
||||||
|
@@ -350,7 +350,6 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|||||||
apr_bucket_brigade *bb;
|
apr_bucket_brigade *bb;
|
||||||
apr_bucket *b;
|
apr_bucket *b;
|
||||||
conn_rec *c = r->connection;
|
conn_rec *c = r->connection;
|
||||||
apr_status_t rv;
|
|
||||||
ap_filter_t *f;
|
ap_filter_t *f;
|
||||||
|
|
||||||
/* Send an EOR bucket through the output filter chain. When
|
/* Send an EOR bucket through the output filter chain. When
|
||||||
@@ -399,8 +398,7 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|||||||
* without flushing data, and hence possibly delay pending response(s)
|
* without flushing data, and hence possibly delay pending response(s)
|
||||||
* until the next/real request comes in or the keepalive timeout expires.
|
* until the next/real request comes in or the keepalive timeout expires.
|
||||||
*/
|
*/
|
||||||
rv = ap_check_pipeline(c, bb, DEFAULT_LIMIT_BLANK_LINES);
|
(void)ap_check_pipeline(c, bb, DEFAULT_LIMIT_BLANK_LINES);
|
||||||
c->data_in_input_filters = (rv == APR_SUCCESS);
|
|
||||||
apr_brigade_cleanup(bb);
|
apr_brigade_cleanup(bb);
|
||||||
|
|
||||||
if (c->cs) {
|
if (c->cs) {
|
||||||
@@ -413,7 +411,6 @@ AP_DECLARE(void) ap_process_request_after_handler(request_rec *r)
|
|||||||
* to not try another useless/stressful one but to go straight to
|
* to not try another useless/stressful one but to go straight to
|
||||||
* POLLOUT.
|
* POLLOUT.
|
||||||
*/
|
*/
|
||||||
c->data_in_output_filters = ap_filter_should_yield(c->output_filters);
|
|
||||||
c->cs->state = CONN_STATE_WRITE_COMPLETION;
|
c->cs->state = CONN_STATE_WRITE_COMPLETION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -314,8 +314,6 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent)
|
|||||||
c->input_filters = NULL;
|
c->input_filters = NULL;
|
||||||
c->output_filters = NULL;
|
c->output_filters = NULL;
|
||||||
c->bucket_alloc = apr_bucket_alloc_create(pool);
|
c->bucket_alloc = apr_bucket_alloc_create(pool);
|
||||||
c->data_in_input_filters = 0;
|
|
||||||
c->data_in_output_filters = 0;
|
|
||||||
/* prevent mpm_event from making wrong assumptions about this connection,
|
/* prevent mpm_event from making wrong assumptions about this connection,
|
||||||
* like e.g. using its socket for an async read check. */
|
* like e.g. using its socket for an async read check. */
|
||||||
c->clogging_input_filters = 1;
|
c->clogging_input_filters = 1;
|
||||||
|
@@ -5850,6 +5850,9 @@ static void register_hooks(apr_pool_t *p)
|
|||||||
ap_hook_open_htaccess(ap_open_htaccess, NULL, NULL, APR_HOOK_REALLY_LAST);
|
ap_hook_open_htaccess(ap_open_htaccess, NULL, NULL, APR_HOOK_REALLY_LAST);
|
||||||
ap_hook_optional_fn_retrieve(core_optional_fn_retrieve, NULL, NULL,
|
ap_hook_optional_fn_retrieve(core_optional_fn_retrieve, NULL, NULL,
|
||||||
APR_HOOK_MIDDLE);
|
APR_HOOK_MIDDLE);
|
||||||
|
|
||||||
|
ap_hook_input_pending(ap_filter_input_pending, NULL, NULL,
|
||||||
|
APR_HOOK_MIDDLE);
|
||||||
ap_hook_output_pending(ap_filter_output_pending, NULL, NULL,
|
ap_hook_output_pending(ap_filter_output_pending, NULL, NULL,
|
||||||
APR_HOOK_MIDDLE);
|
APR_HOOK_MIDDLE);
|
||||||
|
|
||||||
|
@@ -992,7 +992,7 @@ static void process_socket(apr_thread_t *thd, apr_pool_t * p, apr_socket_t * soc
|
|||||||
{
|
{
|
||||||
conn_rec *c;
|
conn_rec *c;
|
||||||
long conn_id = ID_FROM_CHILD_THREAD(my_child_num, my_thread_num);
|
long conn_id = ID_FROM_CHILD_THREAD(my_child_num, my_thread_num);
|
||||||
int clogging = 0;
|
int clogging = 0, from_wc_q = 0;
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
int rc = OK;
|
int rc = OK;
|
||||||
|
|
||||||
@@ -1094,6 +1094,9 @@ read_request:
|
|||||||
rc = OK;
|
rc = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
|
||||||
|
from_wc_q = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The process_connection hooks above should set the connection state
|
* The process_connection hooks above should set the connection state
|
||||||
@@ -1137,11 +1140,17 @@ read_request:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
|
if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
|
||||||
int pending;
|
int pending = DECLINED;
|
||||||
|
|
||||||
ap_update_child_status(cs->sbh, SERVER_BUSY_WRITE, NULL);
|
ap_update_child_status(cs->sbh, SERVER_BUSY_WRITE, NULL);
|
||||||
|
|
||||||
|
if (from_wc_q) {
|
||||||
|
from_wc_q = 0; /* one shot */
|
||||||
pending = ap_run_output_pending(c);
|
pending = ap_run_output_pending(c);
|
||||||
|
}
|
||||||
|
else if (ap_filter_should_yield(c->output_filters)) {
|
||||||
|
pending = OK;
|
||||||
|
}
|
||||||
if (pending == OK) {
|
if (pending == OK) {
|
||||||
/* Still in WRITE_COMPLETION_STATE:
|
/* Still in WRITE_COMPLETION_STATE:
|
||||||
* Set a write timeout for this connection, and let the
|
* Set a write timeout for this connection, and let the
|
||||||
|
@@ -998,10 +998,6 @@ AP_DECLARE_NONSTD(int) ap_filter_output_pending(conn_rec *c)
|
|||||||
apr_bucket_brigade *bb;
|
apr_bucket_brigade *bb;
|
||||||
ap_filter_t *f;
|
ap_filter_t *f;
|
||||||
|
|
||||||
if (c->data_in_output_filters) {
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!c->pending_filters) {
|
if (!c->pending_filters) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
@@ -1038,10 +1034,6 @@ AP_DECLARE_NONSTD(int) ap_filter_input_pending(conn_rec *c)
|
|||||||
{
|
{
|
||||||
ap_filter_t *f;
|
ap_filter_t *f;
|
||||||
|
|
||||||
if (c->data_in_input_filters) {
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!c->pending_filters) {
|
if (!c->pending_filters) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user