summaryrefslogtreecommitdiff
path: root/sapi/litespeed
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/litespeed')
-rw-r--r--sapi/litespeed/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c106
-rw-r--r--sapi/litespeed/lsapi_main.stub.php20
-rw-r--r--sapi/litespeed/lsapi_main_arginfo.h37
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c6
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/litespeed/lscriu.c2
-rw-r--r--sapi/litespeed/lscriu.h2
9 files changed, 97 insertions, 82 deletions
diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4
index 3a816a19bf..8907405385 100644
--- a/sapi/litespeed/config.m4
+++ b/sapi/litespeed/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_LITESPEED" != "no"; then
BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
*)
- BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
+ BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_LITESPEED_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
esac
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index a84c9b2677..f7158e9ee9 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -26,6 +24,7 @@
#include "ext/standard/basic_functions.h"
#include "ext/standard/info.h"
#include "lsapilib.h"
+#include "lsapi_main_arginfo.h"
#include <stdio.h>
#include <stdlib.h>
@@ -94,8 +93,7 @@ static void init_sapi_from_env(sapi_module_struct *sapi_module)
sapi_module->php_ini_path_override = p;
}
-/* {{{ php_lsapi_startup
- */
+/* {{{ php_lsapi_startup */
static int php_lsapi_startup(sapi_module_struct *sapi_module)
{
if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
@@ -108,7 +106,7 @@ static int php_lsapi_startup(sapi_module_struct *sapi_module)
/* {{{ sapi_lsapi_ini_defaults */
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
+/* overwritable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
ZVAL_STRING(tmp, value, 0);\
zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
@@ -132,8 +130,7 @@ static void sapi_lsapi_ini_defaults(HashTable *configuration_hash)
/* }}} */
-/* {{{ sapi_lsapi_ub_write
- */
+/* {{{ sapi_lsapi_ub_write */
static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
{
int ret;
@@ -161,8 +158,7 @@ static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
/* }}} */
-/* {{{ sapi_lsapi_flush
- */
+/* {{{ sapi_lsapi_flush */
static void sapi_lsapi_flush(void * server_context)
{
if ( lsapi_mode ) {
@@ -174,8 +170,7 @@ static void sapi_lsapi_flush(void * server_context)
/* }}} */
-/* {{{ sapi_lsapi_deactivate
- */
+/* {{{ sapi_lsapi_deactivate */
static int sapi_lsapi_deactivate(void)
{
if ( SG(request_info).path_translated ) {
@@ -190,9 +185,8 @@ static int sapi_lsapi_deactivate(void)
-/* {{{ sapi_lsapi_getenv
- */
-static char *sapi_lsapi_getenv( char * name, size_t name_len )
+/* {{{ sapi_lsapi_getenv */
+static char *sapi_lsapi_getenv(const char * name, size_t name_len )
{
if ( lsapi_mode ) {
return LSAPI_GetEnv( name );
@@ -261,8 +255,7 @@ static void litespeed_php_import_environment_variables(zval *array_ptr)
}
}
-/* {{{ sapi_lsapi_register_variables
- */
+/* {{{ sapi_lsapi_register_variables */
static void sapi_lsapi_register_variables(zval *track_vars_array)
{
char * php_self = "";
@@ -289,8 +282,7 @@ static void sapi_lsapi_register_variables(zval *track_vars_array)
/* }}} */
-/* {{{ sapi_lsapi_read_post
- */
+/* {{{ sapi_lsapi_read_post */
static size_t sapi_lsapi_read_post(char *buffer, size_t count_bytes)
{
if ( lsapi_mode ) {
@@ -305,8 +297,7 @@ static size_t sapi_lsapi_read_post(char *buffer, size_t count_bytes)
-/* {{{ sapi_lsapi_read_cookies
- */
+/* {{{ sapi_lsapi_read_cookies */
static char *sapi_lsapi_read_cookies(void)
{
if ( lsapi_mode ) {
@@ -464,8 +455,7 @@ static int sapi_lsapi_send_headers_like_cgi(sapi_headers_struct *sapi_headers)
static int mod_lsapi_mode = 0;
-/* {{{ sapi_lsapi_send_headers
- */
+/* {{{ sapi_lsapi_send_headers */
static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers)
{
sapi_header_struct *h;
@@ -508,9 +498,8 @@ static int sapi_lsapi_send_headers(sapi_headers_struct *sapi_headers)
/* }}} */
-/* {{{ sapi_lsapi_send_headers
- */
-static void sapi_lsapi_log_message(char *message, int syslog_type_int)
+/* {{{ sapi_lsapi_send_headers */
+static void sapi_lsapi_log_message(const char *message, int syslog_type_int)
{
char buf[8192];
int len = strlen( message );
@@ -522,7 +511,7 @@ static void sapi_lsapi_log_message(char *message, int syslog_type_int)
len = 8191;
++len;
}
- LSAPI_Write_Stderr( message, len);
+ LSAPI_Write_Stderr( message, len );
}
/* }}} */
@@ -598,8 +587,7 @@ static int sapi_lsapi_activate()
}
return SUCCESS;
}
-/* {{{ sapi_module_struct cgi_sapi_module
- */
+/* {{{ sapi_module_struct cgi_sapi_module */
static sapi_module_struct lsapi_sapi_module =
{
"litespeed",
@@ -806,7 +794,7 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
Use ACTIVATE stage in legacy mode only.
RUNTIME stage should be used here,
- as with ACTIVATE it's impossible to change the option from script with ini_set
+ as with ACTIVATE it's impossible to change the option from script with ini_set
*/
if(!mod_lsapi_mode)
{
@@ -1617,11 +1605,6 @@ int main( int argc, char * argv[] )
/* LiteSpeed PHP module starts here */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_litespeed__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
PHP_FUNCTION(litespeed_request_headers);
PHP_FUNCTION(litespeed_response_headers);
PHP_FUNCTION(apache_get_modules);
@@ -1629,17 +1612,6 @@ PHP_FUNCTION(litespeed_finish_request);
PHP_MINFO_FUNCTION(litespeed);
-static const zend_function_entry litespeed_functions[] = {
- PHP_FE(litespeed_request_headers, arginfo_litespeed__void)
- PHP_FE(litespeed_response_headers, arginfo_litespeed__void)
- PHP_FE(apache_get_modules, arginfo_litespeed__void)
- PHP_FE(litespeed_finish_request, arginfo_litespeed__void)
- PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
- PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
- {NULL, NULL, NULL}
-};
-
static PHP_MINIT_FUNCTION(litespeed)
{
user_config_cache_init();
@@ -1657,7 +1629,7 @@ static PHP_MINIT_FUNCTION(litespeed)
}
/*
* mod_lsapi always sets this env var,
- * so we can detect mod_lsapi mode with its presense.
+ * so we can detect mod_lsapi mode with its presence.
*/
mod_lsapi_mode = ( getenv("LSAPI_DISABLE_CPAN_BEHAV") != NULL );
@@ -1677,7 +1649,7 @@ static PHP_MSHUTDOWN_FUNCTION(litespeed)
zend_module_entry litespeed_module_entry = {
STANDARD_MODULE_HEADER,
"litespeed",
- litespeed_functions,
+ ext_functions,
PHP_MINIT(litespeed),
PHP_MSHUTDOWN(litespeed),
NULL,
@@ -1695,25 +1667,22 @@ static int add_associate_array( const char * pKey, int keyLen, const char * pVal
}
-/* {{{ proto array litespeed_request_headers(void)
- Fetch all HTTP request headers */
+/* {{{ Fetch all HTTP request headers */
PHP_FUNCTION(litespeed_request_headers)
{
- /* TODO: */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
+
array_init(return_value);
LSAPI_ForeachOrgHeader( add_associate_array, return_value );
-
}
/* }}} */
-/* {{{ proto array litespeed_response_headers(void)
- Fetch all HTTP response headers */
+/* {{{ Fetch all HTTP response headers */
PHP_FUNCTION(litespeed_response_headers)
{
sapi_header_struct *h;
@@ -1722,9 +1691,9 @@ PHP_FUNCTION(litespeed_response_headers)
int len;
char headerBuf[SAPI_LSAPI_MAX_HEADER_LENGTH];
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
if (!&SG(sapi_headers).headers) {
RETURN_FALSE;
@@ -1755,8 +1724,7 @@ PHP_FUNCTION(litespeed_response_headers)
/* }}} */
-/* {{{ proto array apache_get_modules(void)
- Fetch all loaded module names */
+/* {{{ Fetch all loaded module names */
PHP_FUNCTION(apache_get_modules)
{
static const char * mod_names[] =
@@ -1764,10 +1732,11 @@ PHP_FUNCTION(apache_get_modules)
"mod_rewrite", "mod_mime", "mod_headers", "mod_expires", "mod_auth_basic", NULL
};
const char **name = mod_names;
- /* TODO: */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
array_init(return_value);
while( *name )
{
@@ -1778,13 +1747,12 @@ PHP_FUNCTION(apache_get_modules)
/* }}} */
-/* {{{ proto array litespeed_finish_request(void)
- Flushes all response data to the client */
+/* {{{ Flushes all response data to the client */
PHP_FUNCTION(litespeed_finish_request)
{
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
php_output_end_all();
php_header();
diff --git a/sapi/litespeed/lsapi_main.stub.php b/sapi/litespeed/lsapi_main.stub.php
new file mode 100644
index 0000000000..396cb86385
--- /dev/null
+++ b/sapi/litespeed/lsapi_main.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+/** @generate-function-entries */
+
+function litespeed_request_headers(): array {}
+
+/** @alias litespeed_request_headers */
+function getallheaders(): array {}
+
+/** @alias litespeed_request_headers */
+function apache_request_headers(): array {}
+
+function litespeed_response_headers(): array|false {}
+
+/** @alias litespeed_response_headers */
+function apache_response_headers(): array|false {}
+
+function apache_get_modules(): array {}
+
+function litespeed_finish_request(): bool {}
diff --git a/sapi/litespeed/lsapi_main_arginfo.h b/sapi/litespeed/lsapi_main_arginfo.h
new file mode 100644
index 0000000000..2b7e862435
--- /dev/null
+++ b/sapi/litespeed/lsapi_main_arginfo.h
@@ -0,0 +1,37 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 6b6b8e58c728236218c31addc4d855e87d645178 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_litespeed_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_litespeed_request_headers
+
+#define arginfo_apache_request_headers arginfo_litespeed_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_litespeed_response_headers, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_response_headers arginfo_litespeed_response_headers
+
+#define arginfo_apache_get_modules arginfo_litespeed_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_litespeed_finish_request, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(litespeed_request_headers);
+ZEND_FUNCTION(litespeed_response_headers);
+ZEND_FUNCTION(apache_get_modules);
+ZEND_FUNCTION(litespeed_finish_request);
+
+
+static const zend_function_entry ext_functions[] = {
+ ZEND_FE(litespeed_request_headers, arginfo_litespeed_request_headers)
+ ZEND_FALIAS(getallheaders, litespeed_request_headers, arginfo_getallheaders)
+ ZEND_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_apache_request_headers)
+ ZEND_FE(litespeed_response_headers, arginfo_litespeed_response_headers)
+ ZEND_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_apache_response_headers)
+ ZEND_FE(apache_get_modules, arginfo_apache_get_modules)
+ ZEND_FE(litespeed_finish_request, arginfo_litespeed_finish_request)
+ ZEND_FE_END
+};
diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index c909b5f986..1374db0ab1 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 116b3ca57b..4054f28a2f 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -939,7 +937,7 @@ static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid )
ret = (*fp_lve_enter)(s_lve, uid, -1, -1, &cookie);
if ( ret < 0 )
{
- lsapi_log("enter LVE (%d) : ressult: %d !\n", uid, ret );
+ lsapi_log("enter LVE (%d) : result: %d !\n", uid, ret );
LSAPI_perror_r(pReq, "LSAPI: lve_enter() failure, reached resource limit.", NULL );
lsapi_lve_error( pReq );
return -1;
@@ -959,7 +957,7 @@ static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw )
ret = (*fp_lve_jail)( pw, error_msg );
if ( ret < 0 )
{
- lsapi_log("LSAPI: LVE jail(%d) ressult: %d, error: %s !\n",
+ lsapi_log("LSAPI: LVE jail(%d) result: %d, error: %s !\n",
uid, ret, error_msg );
LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL );
return -1;
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 3e32c4a4e8..c2562484ee 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lscriu.c b/sapi/litespeed/lscriu.c
index 7c5bda7e88..f9659b332a 100644
--- a/sapi/litespeed/lscriu.c
+++ b/sapi/litespeed/lscriu.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h
index e7618114cc..0b631aeaa7 100644
--- a/sapi/litespeed/lscriu.h
+++ b/sapi/litespeed/lscriu.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |