thetaphi Sun Jun 22 18:09:41 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/sapi/nsapi nsapi.c
Log:
MFH: Response to: [PHP-DEV] cleaning up the functions - any volunteers? :)
http://cvs.php.net/viewvc.cgi/php-src/sapi/nsapi/nsapi.c?r1=1.69.2.3.2.6.2.4&r2=1.69.2.3.2.6.2.5&diff_format=u
Index: php-src/sapi/nsapi/nsapi.c
diff -u php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.6.2.4
php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.6.2.5
--- php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.6.2.4 Tue Mar 18 22:23:21 2008
+++ php-src/sapi/nsapi/nsapi.c Sun Jun 22 18:09:41 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: nsapi.c,v 1.69.2.3.2.6.2.4 2008/03/18 22:23:21 rasmus Exp $ */
+/* $Id: nsapi.c,v 1.69.2.3.2.6.2.5 2008/06/22 18:09:41 thetaphi Exp $ */
/*
* PHP includes
@@ -308,7 +308,7 @@
PHP_MINFO_FUNCTION(nsapi)
{
php_info_print_table_start();
- php_info_print_table_row(2, "NSAPI Module Revision", "$Revision:
1.69.2.3.2.6.2.4 $");
+ php_info_print_table_row(2, "NSAPI Module Revision", "$Revision:
1.69.2.3.2.6.2.5 $");
php_info_print_table_row(2, "Server Software", system_version());
php_info_print_table_row(2, "Sub-requests with nsapi_virtual()",
(nsapi_servact_service)?((zend_ini_long("zlib.output_compression",
sizeof("zlib.output_compression"), 0))?"not supported with
zlib.output_compression":"enabled"):"not supported on this platform" );
@@ -327,22 +327,20 @@
*/
PHP_FUNCTION(nsapi_virtual)
{
- zval **uri;
- int rv;
- char *value;
+ int uri_len,rv;
+ char *uri,*value;
Request *rq;
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &uri) == FAILURE)
{
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri,
&uri_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(uri);
if (!nsapi_servact_service) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include
uri '%s' - Sub-requests not supported on this platform", (*uri)->value.str.val);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include
uri '%s' - Sub-requests not supported on this platform", uri);
RETURN_FALSE;
} else if (zend_ini_long("zlib.output_compression",
sizeof("zlib.output_compression"), 0)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include
uri '%s' - Sub-requests do not work with zlib.output_compression",
(*uri)->value.str.val);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include
uri '%s' - Sub-requests do not work with zlib.output_compression", uri);
RETURN_FALSE;
} else {
php_end_ob_buffers(1 TSRMLS_CC);
@@ -350,8 +348,8 @@
/* do the sub-request */
/* thanks to Chris Elving from Sun for this code sniplet */
- if ((rq = request_restart_internal((*uri)->value.str.val,
NULL)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
include uri '%s' - Internal request creation failed", (*uri)->value.str.val);
+ if ((rq = request_restart_internal(uri, NULL)) == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
include uri '%s' - Internal request creation failed", uri);
RETURN_FALSE;
}
@@ -383,7 +381,7 @@
} while (rv == REQ_RESTART);
if (rq->status_num != 200) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
include uri '%s' - HTTP status code %d during subrequest",
(*uri)->value.str.val, rq->status_num);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to
include uri '%s' - HTTP status code %d during subrequest", uri, rq->status_num);
request_free(rq);
RETURN_FALSE;
}
@@ -403,6 +401,10 @@
struct pb_entry *entry;
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
for (i=0; i < rc->rq->headers->hsize; i++) {
@@ -425,6 +427,10 @@
struct pb_entry *entry;
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
php_header(TSRMLS_C);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php