thetaphi                Sun Jun 22 18:08:45 2008 UTC

  Modified files:              
    /php-src/sapi/nsapi nsapi.c 
  Log:
  Response to: [PHP-DEV] cleaning up the functions - any volunteers? :)
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/nsapi/nsapi.c?r1=1.87&r2=1.88&diff_format=u
Index: php-src/sapi/nsapi/nsapi.c
diff -u php-src/sapi/nsapi/nsapi.c:1.87 php-src/sapi/nsapi/nsapi.c:1.88
--- php-src/sapi/nsapi/nsapi.c:1.87     Wed Mar 19 16:37:49 2008
+++ php-src/sapi/nsapi/nsapi.c  Sun Jun 22 18:08:45 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: nsapi.c,v 1.87 2008/03/19 16:37:49 rasmus Exp $ */
+/* $Id: nsapi.c,v 1.88 2008/06/22 18:08:45 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.87 
$");
+       php_info_print_table_row(2, "NSAPI Module Revision", "$Revision: 1.88 
$");
        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,31 +327,29 @@
  */
 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_output_end_all(TSRMLS_C);
+               php_end_ob_buffers(1 TSRMLS_CC);
                php_header(TSRMLS_C);
 
                /* 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++) {
@@ -423,6 +425,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

Reply via email to