thetaphi                Sat Nov 29 14:51:45 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/sapi/nsapi nsapi.c 
  Log:
  Hallo release manager: This patch is not release critical (affects only 
NSAPI, but I want it to be fixed in the last version of PHP 5.2). If you do not 
want to have it in, revert it, a new RC is definitely not needed because of 
this (and I am sure nobody who tests RCs is using NSAPI :)!
  
  MFH: Implement flushing in NSAPI, fix some problems with output buffering if 
the response was not started (no headers sent) before doing something in 
ub_write() or flush() - Writing or flushing output will fail in NSAPI, if 
headers were not sent before.
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/nsapi/nsapi.c?r1=1.69.2.3.2.9&r2=1.69.2.3.2.10&diff_format=u
Index: php-src/sapi/nsapi/nsapi.c
diff -u php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.9 
php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.10
--- php-src/sapi/nsapi/nsapi.c:1.69.2.3.2.9     Sun Jun 22 18:10:33 2008
+++ php-src/sapi/nsapi/nsapi.c  Sat Nov 29 14:51:45 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: nsapi.c,v 1.69.2.3.2.9 2008/06/22 18:10:33 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.69.2.3.2.10 2008/11/29 14:51: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.69.2.3.2.9 $");
+       php_info_print_table_row(2, "NSAPI Module Revision", "$Revision: 
1.69.2.3.2.10 $");
        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" );
@@ -433,8 +433,6 @@
 
        array_init(return_value);
 
-       php_header(TSRMLS_C);
-
        for (i=0; i < rc->rq->srvhdrs->hsize; i++) {
                entry=rc->rq->srvhdrs->ht[i];
                while (entry) {
@@ -453,9 +451,12 @@
 static int sapi_nsapi_ub_write(const char *str, unsigned int str_length 
TSRMLS_DC)
 {
        int retval;
-       nsapi_request_context *rc;
+       nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+       
+       if (!SG(headers_sent)) {
+               sapi_send_headers(TSRMLS_C);
+       }
 
-       rc = (nsapi_request_context *)SG(server_context);
        retval = net_write(rc->sn->csd, (char *)str, str_length);
        if (retval == IO_ERROR /* -1 */ || retval == IO_EOF /* 0 */) {
                php_handle_aborted_connection();
@@ -463,6 +464,28 @@
        return retval;
 }
 
+/* modified version of apache2 */
+static void sapi_nsapi_flush(void *server_context)
+{
+       nsapi_request_context *rc = (nsapi_request_context *)server_context;
+       TSRMLS_FETCH();
+
+       if (!rc) {
+               return;
+       }
+
+       if (!SG(headers_sent)) {
+               sapi_send_headers(TSRMLS_C);
+       }
+
+       /* flushing is only supported in iPlanet servers from version 6.1 on, 
make it conditional */
+#if defined(net_flush)
+       if (net_flush(rc->sn->csd) < 0) {
+               php_handle_aborted_connection();
+       }
+#endif
+}
+
 static int sapi_nsapi_header_handler(sapi_header_struct *sapi_header, 
sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
        char *header_name, *header_content, *p;
@@ -747,7 +770,7 @@
        NULL,                                   /* deactivate */
 
        sapi_nsapi_ub_write,                    /* unbuffered write */
-       NULL,                                   /* flush */
+       sapi_nsapi_flush,                       /* flush */
        NULL,                                   /* get uid */
        NULL,                                   /* getenv */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to