diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /sapi/apache2handler | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'sapi/apache2handler')
| -rw-r--r-- | sapi/apache2handler/EXPERIMENTAL | 5 | ||||
| -rw-r--r-- | sapi/apache2handler/apache_config.c | 2 | ||||
| -rw-r--r-- | sapi/apache2handler/config.w32 | 19 | ||||
| -rw-r--r-- | sapi/apache2handler/php_apache.h | 4 | ||||
| -rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 30 |
5 files changed, 40 insertions, 20 deletions
diff --git a/sapi/apache2handler/EXPERIMENTAL b/sapi/apache2handler/EXPERIMENTAL deleted file mode 100644 index 293159a69..000000000 --- a/sapi/apache2handler/EXPERIMENTAL +++ /dev/null @@ -1,5 +0,0 @@ -this module is experimental, -its functions may change their names -or move to extension all together -so do not rely to much on them -you have been warned! diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c index 13f447db3..bd80bb86f 100644 --- a/sapi/apache2handler/apache_config.c +++ b/sapi/apache2handler/apache_config.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: apache_config.c,v 1.7.2.2 2006/06/09 15:13:58 mike Exp $ */ +/* $Id: apache_config.c,v 1.7.2.1.2.1 2006/06/09 15:13:39 mike Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32 index ec099503b..d64da17c0 100644 --- a/sapi/apache2handler/config.w32 +++ b/sapi/apache2handler/config.w32 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.1 2003/12/19 18:28:56 wez Exp $ +// $Id: config.w32,v 1.1.6.1 2006/05/07 00:09:20 edink Exp $ ARG_ENABLE('apache2handler', 'Build Apache 2.x handler', 'no'); @@ -16,3 +16,20 @@ if (PHP_APACHE2HANDLER != "no") { WARNING("Could not find apache2 libraries/headers"); } } + +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") && + 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") + ) { + SAPI('apache2_2handler', 'mod_php5.c sapi_apache2.c apache_config.c php_functions.c', + 'php' + PHP_VERSION + 'apache2_2.dll', + '/D PHP_APACHE2_EXPORTS /I win32', + 'sapi\\apache2_2handler'); + } else { + WARNING("Could not find apache2.2 libraries/headers"); + } +} diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 332c2736a..e4030cbbe 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_apache.h,v 1.8.2.1 2006/01/01 12:50:18 sniper Exp $ */ +/* $Id: php_apache.h,v 1.8.2.1.2.1 2006/05/28 20:32:00 mike Exp $ */ #ifndef PHP_APACHE_H #define PHP_APACHE_H @@ -44,6 +44,8 @@ typedef struct php_struct { #endif /* Whether or not we've processed PHP in the output filters yet. */ int request_processed; + /* final content type */ + char *content_type; } php_struct; void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf); diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 50e2550c1..21bce6128 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache2.c,v 1.57.2.11 2006/08/08 13:11:39 stas Exp $ */ +/* $Id: sapi_apache2.c,v 1.57.2.10.2.6 2006/08/10 13:43:18 tony2001 Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -105,8 +105,10 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_stru } while (*val == ' '); if (!strcasecmp(sapi_header->header, "content-type")) { - val = apr_pstrdup(ctx->r->pool, val); - ap_set_content_type(ctx->r, val); + 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 { @@ -131,6 +133,15 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) && sline[8] == ' ') { ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9); } + + /* 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); + } + ap_set_content_type(ctx->r, apr_pstrdup(ctx->r->pool, ctx->content_type)); + efree(ctx->content_type); + ctx->content_type = NULL; return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -221,12 +232,12 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) php_struct *ctx = SG(server_context); const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); char *key, *val; - + APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) val = ""; php_register_variable(key, val, track_vars_array TSRMLS_CC); APR_ARRAY_FOREACH_CLOSE() - + php_register_variable("PHP_SELF", ctx->r->uri, track_vars_array TSRMLS_CC); } @@ -405,7 +416,6 @@ static apr_status_t php_server_context_cleanup(void *data_) static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) { - char *content_type; char *content_length; const char *auth; @@ -418,10 +428,6 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename); r->no_local_copy = 1; - content_type = sapi_get_default_content_type(TSRMLS_C); - ap_set_content_type(r, apr_pstrdup(r->pool, content_type)); - efree(content_type); - content_length = (char *) apr_table_get(r->headers_in, "Content-Length"); SG(request_info).content_length = (content_length ? atoi(content_length) : 0); @@ -524,7 +530,7 @@ normal: /* Setup the CGI variables if this is the main request */ if (r->main == NULL || - /* .. or if the sub-request envinronment differs from the main-request. */ + /* .. or if the sub-request environment differs from the main-request. */ r->subprocess_env != r->main->subprocess_env ) { /* setup standard CGI variables */ @@ -591,7 +597,7 @@ zend_first_try { { char *mem_usage; - mem_usage = apr_psprintf(ctx->r->pool, "%u", AG(allocated_memory_peak)); + mem_usage = apr_psprintf(ctx->r->pool, "%u", zend_memory_peak_usage(1 TSRMLS_CC)); apr_table_set(r->notes, "mod_php_memory_usage", mem_usage); } #endif |
