summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorUwe Schindler <thetaphi@php.net>2008-06-22 18:10:33 +0000
committerUwe Schindler <thetaphi@php.net>2008-06-22 18:10:33 +0000
commitc1bb953c7163ae6bd6b09b008b0bb3910861ba02 (patch)
tree482fa1f68ce39d0d9285952358e0d35c333891f2 /sapi
parent79301a3677734cb72ca1d23e5544b3d1cf099f89 (diff)
downloadphp-git-c1bb953c7163ae6bd6b09b008b0bb3910861ba02.tar.gz
MFH: Response to: [PHP-DEV] cleaning up the functions - any volunteers? :)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/nsapi/nsapi.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
index 246f214d51..f742ac8dbb 100644
--- a/sapi/nsapi/nsapi.c
+++ b/sapi/nsapi/nsapi.c
@@ -327,22 +327,20 @@ PHP_MINFO_FUNCTION(nsapi)
*/
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 @@ PHP_FUNCTION(nsapi_virtual)
/* 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 @@ PHP_FUNCTION(nsapi_virtual)
} 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 @@ PHP_FUNCTION(nsapi_request_headers)
struct pb_entry *entry;
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+ if (ZEND_NUM_ARGS()) {
+ WRONG_PARAM_COUNT;
+ }
+
array_init(return_value);
for (i=0; i < rc->rq->headers->hsize; i++) {
@@ -425,6 +427,10 @@ PHP_FUNCTION(nsapi_response_headers)
struct pb_entry *entry;
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+ if (ZEND_NUM_ARGS()) {
+ WRONG_PARAM_COUNT;
+ }
+
array_init(return_value);
php_header(TSRMLS_C);