diff options
author | Yann Ylavic <ylavic@apache.org> | 2024-06-11 16:46:29 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2024-06-11 16:46:29 +0200 |
commit | 0d71da4bdfff4c18abcea77ffa76227f70be0f73 (patch) | |
tree | 86b029a563a1184b7f360049ece10348cc02f963 /include | |
parent | CI: Set the path to php-fpm so it's found by proxy_fcgi.t (after r1918149). (diff) | |
download | apache2-0d71da4bdfff4c18abcea77ffa76227f70be0f73.tar.xz apache2-0d71da4bdfff4c18abcea77ffa76227f70be0f73.zip |
mpm_event,mod_http2: Keep compatibility with CONN_STATE_PROCESSING + OK
Before r1918022, returning OK with CONN_STATE_PROCESSING to mpm_event was
handled like/by CONN_STATE_LINGER "to not break old or third-party modules
which might return OK w/o touching the state and expect lingering close,
like with worker or prefork MPMs".
So we need a new return code to be allowed to apply the new POLLIN/POLLOUT
behaviour for CONN_STATE_PROCESSING, thus revive AGAIN as introduced by
Graham some times ago for a nonblocking WIP (moved to a branch/PR since then).
MPM event will advertise its ability to handle CONN_STATE_PROCESSING + AGAIN
with AP_MPMQ_CAN_AGAIN, and mod_http2 can use that to know how to return to
the MPM as expected. When !AP_MPMQ_CAN_AGAIN modules/mod_http2 can still use
CONN_STATE_WRITE_COMPLETION + CONN_SENSE_WANT_READ + c->clogging_input_filters
which will work in mpm_even-2.4.x still.
* include/ap_mmn.h:
Bump MMN minor for AP_MPMQ_CAN_AGAIN and AGAIN.
* include/ap_mpm.h:
Define AP_MPMQ_CAN_AGAIN.
* include/httpd.h:
Define AGAIN.
* modules/http2/h2.h:
No need for H2_USE_STATE_PROCESSING anymore with AP_MPMQ_CAN_AGAIN.
* modules/http2/h2_c1.c:
For !keepalive case return to the MPM using CONN_STATE_PROCESSING + AGAIN
or CONN_STATE_WRITE_COMPLETION + c->clogging_input_filters depending on
AP_MPMQ_CAN_AGAIN only.
* modules/http2/h2_session.c:
Can return to the MPM for h2_send_flow_blocked() provided it's async only.
* server/mpm/event/event.c:
Rework process_socket()'s CONN_STATE_PROCESSING to handle AGAIN and preserve
compatibility. Have a lingering_close label to goto there faster when
process_lingering_close() is to be called. Improve relevant comments.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918257 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/ap_mmn.h | 3 | ||||
-rw-r--r-- | include/ap_mpm.h | 2 | ||||
-rw-r--r-- | include/httpd.h | 24 |
3 files changed, 19 insertions, 10 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 34abf61654..fcf98e8908 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -725,6 +725,7 @@ * 20211221.19 (2.5.1-dev) Add AP_REG_NOTEMPTY_ATSTART * 20211221.20 (2.5.1-dev) Add CONN_STATE_KEEPALIVE and CONN_STATE_PROCESSING * 20211221.21 (2.5.1-dev) Add processing field struct process_score + * 20211221.22 (2.5.1-dev) Add AGAIN, AP_MPMQ_CAN_AGAIN. */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ @@ -732,7 +733,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20211221 #endif -#define MODULE_MAGIC_NUMBER_MINOR 21 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 22 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/ap_mpm.h b/include/ap_mpm.h index 6698d0e7c6..82075a4488 100644 --- a/include/ap_mpm.h +++ b/include/ap_mpm.h @@ -182,6 +182,8 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process( #define AP_MPMQ_CAN_SUSPEND 17 /** MPM supports additional pollfds */ #define AP_MPMQ_CAN_POLL 18 +/** MPM reacts to AGAIN response */ +#define AP_MPMQ_CAN_AGAIN 19 /** @} */ /** diff --git a/include/httpd.h b/include/httpd.h index f2e3795f5a..588e092c48 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -458,13 +458,16 @@ AP_DECLARE(const char *) ap_get_server_built(void); /* non-HTTP status codes returned by hooks */ -#define OK 0 /**< Module has handled this stage. */ -#define DECLINED -1 /**< Module declines to handle */ -#define DONE -2 /**< Module has served the response completely - * - it's safe to die() with no more output - */ -#define SUSPENDED -3 /**< Module will handle the remainder of the request. - * The core will never invoke the request again, */ +#define OK 0 /**< Module has handled this stage. */ +#define DECLINED -1 /**< Module declines to handle */ +#define DONE -2 /**< Module has served the response completely + * - it's safe to die() with no more output + */ +#define SUSPENDED -3 /**< Module will handle the remainder of the request. + * The core will never invoke the request again */ +#define AGAIN -4 /**< Module wants to be called again when more + * data is available. + */ /** Returned by the bottom-most filter if no data was written. * @see ap_pass_brigade(). */ @@ -1319,8 +1322,11 @@ struct conn_slave_rec { */ typedef enum { CONN_STATE_KEEPALIVE, /* Kept alive in the MPM (using KeepAliveTimeout) */ - CONN_STATE_PROCESSING, /* Handled by process_connection() hooks, may be returned - to the MPM for POLLIN/POLLOUT (using Timeout) */ + CONN_STATE_PROCESSING, /* Processed by process_connection() hooks, returning + * AGAIN to the MPM in this state will make it wait for + * the connection to be readable or writable according to + * CONN_SENSE_WANT_READ or CONN_SENSE_WANT_WRITE respectively, + * where Timeout applies */ CONN_STATE_HANDLER, /* Processed by the modules handlers */ CONN_STATE_WRITE_COMPLETION, /* Flushed by the MPM before entering CONN_STATE_KEEPALIVE */ CONN_STATE_SUSPENDED, /* Suspended in the MPM until ap_run_resume_suspended() */ |