Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for max_input_time #874

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions frankenphp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
ZEND_TSRMLS_CACHE_DEFINE()
#endif

/* Timeouts are currently fundamentally broken with ZTS except on Linux:
* https://bugs.php.net/bug.php?id=79464 */
/* Timeouts are currently fundamentally broken with ZTS except on Linux and
* FreeBSD: https://bugs.php.net/bug.php?id=79464 */
#ifndef ZEND_MAX_EXECUTION_TIMERS
static const char HARDCODED_INI[] = "max_execution_time=0\n"
"max_input_time=-1\n\0";
Expand Down Expand Up @@ -157,16 +157,13 @@ static int frankenphp_worker_request_startup() {
/* Keep the current execution context */
sapi_activate();

/*
* Timeouts are currently fundamentally broken with ZTS:
* https://bugs.php.net/bug.php?id=79464
*
*if (PG(max_input_time) == -1) {
* zend_set_timeout(EG(timeout_seconds), 1);
*} else {
* zend_set_timeout(PG(max_input_time), 1);
*}
*/
#ifdef ZEND_MAX_EXECUTION_TIMERS
if (PG(max_input_time) == -1) {
zend_set_timeout(EG(timeout_seconds), 1);
} else {
zend_set_timeout(PG(max_input_time), 1);
}
#endif

if (PG(expose_php)) {
sapi_add_header(SAPI_PHP_VERSION_HEADER,
Expand Down Expand Up @@ -358,9 +355,10 @@ PHP_FUNCTION(frankenphp_handle_request) {
#ifdef ZEND_MAX_EXECUTION_TIMERS
/*
* Reset default timeout
* TODO: add support for max_input_time
*/
zend_set_timeout(INI_INT("max_execution_time"), 0);
if (PG(max_input_time) != -1) {
zend_set_timeout(INI_INT("max_execution_time"), 0);
}
#endif

/* Call the PHP func */
Expand Down
Loading