dmitry          Wed Apr 26 11:08:10 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/sapi/cgi   fastcgi.c 
  Log:
  Fixed bug #37205 (Serving binary content/images fails with "comm with server 
aborted" FastCGI err)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.531&r2=1.2027.2.532&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.531 php-src/NEWS:1.2027.2.532
--- php-src/NEWS:1.2027.2.531   Tue Apr 25 08:43:29 2006
+++ php-src/NEWS        Wed Apr 26 11:08:10 2006
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Apr 2006, PHP 5.1.3RC4
+- Fixed bug #37205 (Serving binary content/images fails with "comm with server
+  aborted" FastCGI err). (Dmitry)
 - Fixed bug #37192 (cc may complain about non-constant initializers in
   hash_adler.c). (Mike)
 - Fixed bug #37191 (chmod takes off sticky bit when safe_mode is On). (Tony)
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.7&r2=1.4.2.8&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.7 php-src/sapi/cgi/fastcgi.c:1.4.2.8
--- php-src/sapi/cgi/fastcgi.c:1.4.2.7  Mon Apr 24 09:53:57 2006
+++ php-src/sapi/cgi/fastcgi.c  Wed Apr 26 11:08:10 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.4.2.7 2006/04/24 09:53:57 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.4.2.8 2006/04/26 11:08:10 dmitry Exp $ */
 
 #include "fastcgi.h"
 #include "php.h"
@@ -618,8 +618,12 @@
                        RevertToSelf();
                }
 #else
+#if 1
+               shutdown(req->fd, 2);
+#else
                close(req->fd);
 #endif
+#endif
                req->fd = -1;
        }
 }
@@ -814,16 +818,30 @@
                memcpy(req->out_pos, str + limit, len - limit);
                req->out_pos += len - limit;
        } else {
-               int pad = ((len + 7) & ~7) - len;
+               int pos = 0;
+               int pad;
 
+               close_packet(req);
+               while ((len - pos) > 0xffff) {
+                       open_packet(req, type);
+                       fcgi_make_header(req->out_hdr, type, req->id, 0xfff8);
+                       req->out_hdr = NULL;
+                       fcgi_flush(req, 0);
+                       if (safe_write(req, str + pos, 0xfff8) != 0xfff8) {
+                               req->keep = 0;
+                               return -1;
+                       }
+                       pos += 0xfff8;
+               }               
+               
+               pad = (((len - pos) + 7) & ~7) - (len - pos);
                rest = pad ? 8 - pad : 0;
 
-               close_packet(req);
                open_packet(req, type);
-               fcgi_make_header(req->out_hdr, type, req->id, len - rest);
+               fcgi_make_header(req->out_hdr, type, req->id, (len - pos) - 
rest);
                req->out_hdr = NULL;
                fcgi_flush(req, 0);
-               if (safe_write(req, str, len - rest) != len - rest) {
+               if (safe_write(req, str + pos, (len - pos) - rest) != (len - 
pos) - rest) {
                        req->keep = 0;
                        return -1;
                }

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

Reply via email to