summaryrefslogtreecommitdiff
path: root/sapi/apache2handler
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/apache2handler')
-rw-r--r--sapi/apache2handler/apache_config.c4
-rw-r--r--sapi/apache2handler/config.m46
-rw-r--r--sapi/apache2handler/config.w3210
-rw-r--r--sapi/apache2handler/mod_php5.c2
-rw-r--r--sapi/apache2handler/php_apache.h7
-rw-r--r--sapi/apache2handler/php_functions.c177
-rw-r--r--sapi/apache2handler/sapi_apache2.c101
7 files changed, 182 insertions, 125 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index aeafa3328..8057050e4 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apache_config.c 272374 2008-12-31 11:17:49Z sebastian $ */
+/* $Id: apache_config.c 272413 2008-12-31 14:45:14Z bjori $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -138,11 +138,13 @@ static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_dir_en
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
{
php_conf_rec *d = base_conf, *e = new_conf, *n = NULL;
+#if STAS_0
php_dir_entry *pe;
php_dir_entry *data;
char *str;
uint str_len;
ulong num_index;
+#endif
n = create_php_config(p, "merge_php_config");
/* copy old config */
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 6238470aa..2cb3313f7 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4 239540 2007-07-11 23:20:37Z jani $
+dnl $Id: config.m4 254930 2008-03-11 22:47:39Z lstrojny $
dnl
PHP_ARG_WITH(apxs2,,
@@ -109,7 +109,7 @@ if test "$PHP_APXS2" != "no"; then
`ln -s $APXS_BINDIR/httpd _APP_`
EXTRA_LIBS="$EXTRA_LIBS _APP_"
PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
+ INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*)
PHP_SELECT_SAPI(apache2handler, shared, mod_php5.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
@@ -117,7 +117,7 @@ if test "$PHP_APXS2" != "no"; then
;;
esac
- if test "$APXS_MPM" != "prefork"; then
+ if test "$APXS_MPM" != "prefork" && test "$APXS_MPM" != "peruser" && test "$APXS_MPM" != "itk"; then
PHP_BUILD_THREAD_SAFE
fi
AC_MSG_RESULT(yes)
diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32
index 4ccf57a97..ad3191823 100644
--- a/sapi/apache2handler/config.w32
+++ b/sapi/apache2handler/config.w32
@@ -1,10 +1,12 @@
// vim:ft=javascript
-// $Id: config.w32 234960 2007-05-04 18:17:55Z edink $
+// $Id: config.w32 259731 2008-05-14 03:13:17Z auroraeosrose $
ARG_ENABLE('apache2handler', 'Build Apache 2.x handler', 'no');
if (PHP_APACHE2HANDLER != "no") {
- if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2HANDLER", PHP_PHP_BUILD + "\\include\\apache2") &&
+ if (PHP_ZTS == "no") {
+ WARNING("Apache2 module requires an --enable-zts build of PHP on windows");
+ } else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2HANDLER", PHP_PHP_BUILD + "\\include\\apache2") &&
CHECK_LIB("libhttpd.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
@@ -20,7 +22,9 @@ if (PHP_APACHE2HANDLER != "no") {
ARG_ENABLE('apache2-2handler', 'Build Apache 2.2.x handler', 'no');
if (PHP_APACHE2_2HANDLER != "no") {
- if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2_2HANDLER", PHP_PHP_BUILD + "\\include\\apache2_2") &&
+ if (PHP_ZTS == "no") {
+ WARNING("Apache2 module requires an --enable-zts build of PHP on windows");
+ } else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2_2HANDLER", PHP_PHP_BUILD + "\\include\\apache2_2") &&
CHECK_LIB("libhttpd.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
diff --git a/sapi/apache2handler/mod_php5.c b/sapi/apache2handler/mod_php5.c
index 8111c8897..038a7122a 100644
--- a/sapi/apache2handler/mod_php5.c
+++ b/sapi/apache2handler/mod_php5.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c 272374 2008-12-31 11:17:49Z sebastian $ */
+/* $Id: mod_php5.c 272370 2008-12-31 11:15:49Z sebastian $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 8b1ddd60a..8573967a9 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_apache.h 272374 2008-12-31 11:17:49Z sebastian $ */
+/* $Id: php_apache.h 272370 2008-12-31 11:15:49Z sebastian $ */
#ifndef PHP_APACHE_H
#define PHP_APACHE_H
@@ -82,5 +82,10 @@ extern php_apache2_info_struct php_apache2_info;
#define AP2(v) (php_apache2_info.v)
#endif
+/* fix for gcc4 visibility patch */
+#ifndef PHP_WIN32
+# undef AP_MODULE_DECLARE_DATA
+# define AP_MODULE_DECLARE_DATA PHPAPI
+#endif
#endif /* PHP_APACHE_H */
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 673d8e03a..87bed1113 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_functions.c 272374 2008-12-31 11:17:49Z sebastian $ */
+/* $Id: php_functions.c 273971 2009-01-19 19:32:40Z scottmac $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -71,23 +71,21 @@ static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC)
Perform an apache sub-request */
PHP_FUNCTION(virtual)
{
- zval **filename;
+ char *filename;
+ int filename_len;
request_rec *rr;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(filename);
-
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
+ if (!(rr = php_apache_lookup_uri(filename TSRMLS_CC))) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", filename);
RETURN_FALSE;
}
if (rr->status != HTTP_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", filename);
ap_destroy_sub_req(rr);
RETURN_FALSE;
}
@@ -101,7 +99,7 @@ PHP_FUNCTION(virtual)
ap_rflush(rr->main);
if (ap_run_sub_req(rr)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", Z_STRVAL_PP(filename));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", filename);
ap_destroy_sub_req(rr);
RETURN_FALSE;
}
@@ -120,16 +118,15 @@ PHP_FUNCTION(virtual)
PHP_FUNCTION(apache_lookup_uri)
{
request_rec *rr;
- zval **filename;
+ char *filename;
+ int filename_len;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(filename);
-
- if (!(rr = php_apache_lookup_uri(Z_STRVAL_PP(filename) TSRMLS_CC))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", Z_STRVAL_PP(filename));
+ if (!(rr = php_apache_lookup_uri(filename TSRMLS_CC))) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", filename);
RETURN_FALSE;
}
@@ -166,7 +163,7 @@ PHP_FUNCTION(apache_lookup_uri)
return;
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", Z_STRVAL_PP(filename));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", filename);
ap_destroy_sub_req(rr);
RETURN_FALSE;
}
@@ -179,8 +176,8 @@ PHP_FUNCTION(apache_request_headers)
const apr_array_header_t *arr;
char *key, *val;
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
}
array_init(return_value);
@@ -203,8 +200,8 @@ PHP_FUNCTION(apache_response_headers)
const apr_array_header_t *arr;
char *key, *val;
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
}
array_init(return_value);
@@ -224,31 +221,27 @@ PHP_FUNCTION(apache_response_headers)
PHP_FUNCTION(apache_note)
{
php_struct *ctx;
- zval **note_name, **note_val;
+ char *note_name, *note_val = NULL;
+ int note_name_len, note_val_len;
char *old_note_val=NULL;
- int arg_count = ZEND_NUM_ARGS();
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &note_name, &note_val) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &note_name, &note_name_len, &note_val, &note_val_len) == FAILURE) {
+ return;
}
-
+
ctx = SG(server_context);
-
- convert_to_string_ex(note_name);
- old_note_val = (char *) apr_table_get(ctx->r->notes, Z_STRVAL_PP(note_name));
-
- if (arg_count == 2) {
- convert_to_string_ex(note_val);
- apr_table_set(ctx->r->notes, Z_STRVAL_PP(note_name), Z_STRVAL_PP(note_val));
+ old_note_val = (char *) apr_table_get(ctx->r->notes, note_name);
+
+ if (note_val) {
+ apr_table_set(ctx->r->notes, note_name, note_val);
}
if (old_note_val) {
RETURN_STRING(old_note_val, 1);
- } else {
- RETURN_FALSE;
}
+
+ RETURN_FALSE;
}
/* }}} */
@@ -260,31 +253,28 @@ PHP_FUNCTION(apache_note)
PHP_FUNCTION(apache_setenv)
{
php_struct *ctx;
- zval **variable=NULL, **string_val=NULL, **walk_to_top=NULL;
+ char *variable=NULL, *string_val=NULL;
+ int variable_len, string_val_len;
+ zend_bool walk_to_top = 0;
int arg_count = ZEND_NUM_ARGS();
request_rec *r;
- if (arg_count < 2 || arg_count > 3 ||
- zend_get_parameters_ex(arg_count, &variable, &string_val, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(arg_count TSRMLS_CC, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) {
+ return;
}
ctx = SG(server_context);
r = ctx->r;
if (arg_count == 3) {
- convert_to_boolean_ex(walk_to_top);
- if (Z_LVAL_PP(walk_to_top)) {
+ if (walk_to_top) {
while(r->prev) {
r = r->prev;
}
}
}
- convert_to_string_ex(variable);
- convert_to_string_ex(string_val);
-
- apr_table_set(r->subprocess_env, Z_STRVAL_PP(variable), Z_STRVAL_PP(string_val));
+ apr_table_set(r->subprocess_env, variable, string_val);
RETURN_TRUE;
}
@@ -298,36 +288,35 @@ PHP_FUNCTION(apache_setenv)
PHP_FUNCTION(apache_getenv)
{
php_struct *ctx;
- zval **variable=NULL, **walk_to_top=NULL;
+ char *variable=NULL;
+ int variable_len;
+ zend_bool walk_to_top = 0;
int arg_count = ZEND_NUM_ARGS();
char *env_val=NULL;
request_rec *r;
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count, &variable, &walk_to_top) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(arg_count TSRMLS_CC, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) {
+ return;
}
ctx = SG(server_context);
r = ctx->r;
if (arg_count == 2) {
- convert_to_boolean_ex(walk_to_top);
- if (Z_LVAL_PP(walk_to_top)) {
+ if (walk_to_top) {
while(r->prev) {
r = r->prev;
}
}
}
- convert_to_string_ex(variable);
-
- env_val = (char*) apr_table_get(r->subprocess_env, Z_STRVAL_PP(variable));
+ env_val = (char*) apr_table_get(r->subprocess_env, variable);
+
if (env_val != NULL) {
RETURN_STRING(env_val, 1);
- } else {
- RETURN_FALSE;
- }
+ }
+
+ RETURN_FALSE;
}
/* }}} */
@@ -383,8 +372,12 @@ PHP_MINFO_FUNCTION(apache)
char *p;
server_rec *serv = ((php_struct *) SG(server_context))->r->server;
#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
+#if MODULE_MAGIC_NUMBER_MAJOR >= 20081201
+ AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
+#else
AP_DECLARE_DATA extern unixd_config_rec unixd_config;
#endif
+#endif
for (n = 0; ap_loaded_modules[n]; ++n) {
char *s = (char *) ap_loaded_modules[n]->name;
@@ -414,7 +407,11 @@ PHP_MINFO_FUNCTION(apache)
php_info_print_table_row(2, "Hostname:Port", tmp);
#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
+#if MODULE_MAGIC_NUMBER_MAJOR >= 20081201
+ snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
+#else
snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
+#endif
php_info_print_table_row(2, "User/Group", tmp);
#endif
@@ -478,17 +475,55 @@ PHP_MINFO_FUNCTION(apache)
}
}
-static zend_function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(virtual, NULL)
- PHP_FE(apache_request_headers, NULL)
- PHP_FE(apache_response_headers, NULL)
- PHP_FE(apache_setenv, NULL)
- PHP_FE(apache_getenv, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_get_version, NULL)
- PHP_FE(apache_get_modules, NULL)
- PHP_FALIAS(getallheaders, apache_request_headers, NULL)
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_lookup_uri, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_virtual, 0, 0, 1)
+ ZEND_ARG_INFO(0, uri)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_response_headers, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_getallheaders, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_note, 0, 0, 1)
+ ZEND_ARG_INFO(0, note_name)
+ ZEND_ARG_INFO(0, note_value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_setenv, 0, 0, 2)
+ ZEND_ARG_INFO(0, variable)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_INFO(0, walk_to_top)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_getenv, 0, 0, 1)
+ ZEND_ARG_INFO(0, variable)
+ ZEND_ARG_INFO(0, walk_to_top)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_version, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_modules, 0)
+ZEND_END_ARG_INFO()
+/* }}} */
+
+static const zend_function_entry apache_functions[] = {
+ PHP_FE(apache_lookup_uri, arginfo_apache2handler_lookup_uri)
+ PHP_FE(virtual, arginfo_apache2handler_virtual)
+ PHP_FE(apache_request_headers, arginfo_apache2handler_getallheaders)
+ PHP_FE(apache_response_headers, arginfo_apache2handler_response_headers)
+ PHP_FE(apache_setenv, arginfo_apache2handler_setenv)
+ PHP_FE(apache_getenv, arginfo_apache2handler_getenv)
+ PHP_FE(apache_note, arginfo_apache2handler_note)
+ PHP_FE(apache_get_version, arginfo_apache2handler_get_version)
+ PHP_FE(apache_get_modules, arginfo_apache2handler_get_modules)
+ PHP_FALIAS(getallheaders, apache_request_headers, arginfo_apache2handler_getallheaders)
{NULL, NULL, NULL}
};
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 679a30fc0..62504af42 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sapi_apache2.c 291305 2009-11-25 12:35:42Z jani $ */
+/* $Id: sapi_apache2.c 272370 2008-12-31 11:15:49Z sebastian $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -83,40 +83,55 @@ php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
}
static int
-php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_struct *sapi_headers TSRMLS_DC)
+php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC)
{
php_struct *ctx;
char *val, *ptr;
ctx = SG(server_context);
- val = strchr(sapi_header->header, ':');
+ switch (op) {
+ case SAPI_HEADER_DELETE:
+ apr_table_unset(ctx->r->headers_out, sapi_header->header);
+ return 0;
- if (!val) {
- sapi_free_header(sapi_header);
- return 0;
- }
- ptr = val;
+ case SAPI_HEADER_DELETE_ALL:
+ apr_table_clear(ctx->r->headers_out);
+ return 0;
- *val = '\0';
+ case SAPI_HEADER_ADD:
+ case SAPI_HEADER_REPLACE:
+ val = strchr(sapi_header->header, ':');
- do {
- val++;
- } while (*val == ' ');
+ if (!val) {
+ return 0;
+ }
+ ptr = val;
- if (!strcasecmp(sapi_header->header, "content-type")) {
- if (ctx->content_type) {
- efree(ctx->content_type);
- }
- ctx->content_type = estrdup(val);
- } else if (sapi_header->replace) {
- apr_table_set(ctx->r->headers_out, sapi_header->header, val);
- } else {
- apr_table_add(ctx->r->headers_out, sapi_header->header, val);
- }
- *ptr = ':';
+ *val = '\0';
+
+ do {
+ val++;
+ } while (*val == ' ');
+
+ if (!strcasecmp(sapi_header->header, "content-type")) {
+ if (ctx->content_type) {
+ efree(ctx->content_type);
+ }
+ ctx->content_type = estrdup(val);
+ } else if (op == SAPI_HEADER_REPLACE) {
+ apr_table_set(ctx->r->headers_out, sapi_header->header, val);
+ } else {
+ apr_table_add(ctx->r->headers_out, sapi_header->header, val);
+ }
+
+ *ptr = ':';
- return SAPI_HEADER_ADD;
+ return SAPI_HEADER_ADD;
+
+ default:
+ return 0;
+ }
}
static int
@@ -136,8 +151,8 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
apr_table_set(ctx->r->subprocess_env, "force-response-1.0", "true");
}
}
-
- /* call ap_set_content_type only once, else each time we call it,
+
+ /* call ap_set_content_type only once, else each time we call it,
configured output filters for that content type will be added */
if (!ctx->content_type) {
ctx->content_type = sapi_get_default_content_type(TSRMLS_C);
@@ -177,7 +192,7 @@ php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
buf += len;
len = count_bytes - tlen;
}
-
+
return tlen;
}
@@ -223,10 +238,6 @@ php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC)
{
php_struct *ctx = SG(server_context);
const char *env_var;
-
- if (ctx == NULL) {
- return NULL;
- }
env_var = apr_table_get(ctx->r->subprocess_env, name);
@@ -305,8 +316,7 @@ static void php_apache_sapi_log_message_ex(char *msg, request_rec *r)
}
}
-static time_t php_apache_sapi_get_request_time(TSRMLS_D)
-{
+static time_t php_apache_sapi_get_request_time(TSRMLS_D) {
php_struct *ctx = SG(server_context);
return apr_time_sec(ctx->r->request_time);
}
@@ -348,6 +358,7 @@ static sapi_module_struct apache2_sapi_module = {
php_apache_sapi_register_variables,
php_apache_sapi_log_message, /* Log message */
php_apache_sapi_get_request_time, /* Request Time */
+ NULL, /* Child Terminate */
STANDARD_SAPI_MODULE_PROPERTIES
};
@@ -385,7 +396,7 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp
int threaded_mpm;
ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm);
- if (threaded_mpm) {
+ if(threaded_mpm) {
ap_log_error(APLOG_MARK, APLOG_CRIT, 0, 0, "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.");
return DONE;
}
@@ -489,12 +500,12 @@ typedef struct {
uint str_len;
php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module);
- for (zend_hash_internal_pointer_reset(&c->config);
- zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&c->config)
+ for (zend_hash_internal_pointer_reset(&c->config);
+ zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
+ zend_hash_move_forward(&c->config)
) {
zend_restore_ini_entry(str, str_len, ZEND_INI_STAGE_SHUTDOWN);
- }
+ }
}
if (p) {
((php_struct *)SG(server_context))->r = p;
@@ -544,7 +555,7 @@ normal:
}
/* Give a 404 if PATH_INFO is used but is explicitly disabled in
- * the configuration; default behaviour is to accept. */
+ * the configuration; default behaviour is to accept. */
if (r->used_path_info == AP_REQ_REJECT_PATH_INFO
&& r->path_info && r->path_info[0]) {
PHPAP_INI_OFF;
@@ -592,17 +603,17 @@ zend_first_try {
if (!parent_req) {
parent_req = ctx->r;
}
- if (parent_req && parent_req->handler &&
- strcmp(parent_req->handler, PHP_MAGIC_TYPE) &&
- strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) &&
+ if (parent_req && parent_req->handler &&
+ strcmp(parent_req->handler, PHP_MAGIC_TYPE) &&
+ strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) &&
strcmp(parent_req->handler, PHP_SCRIPT)) {
if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) {
zend_bailout();
}
}
-
- /*
- * check if comming due to ErrorDocument
+
+ /*
+ * check if comming due to ErrorDocument
* We make a special exception of 413 (Invalid POST request) as the invalidity of the request occurs
* during processing of the request by PHP during POST processing. Therefor we need to re-use the exiting
* PHP instance to handle the request rather then creating a new one.