dmitry Wed May 3 15:48:33 2006 UTC
Modified files:
/php-src/sapi/cgi fastcgi.c fastcgi.h
Log:
Fixed bug #37205 (incompatibility with mod_fastcgi)
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.12&r2=1.13&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.12 php-src/sapi/cgi/fastcgi.c:1.13
--- php-src/sapi/cgi/fastcgi.c:1.12 Wed May 3 13:20:12 2006
+++ php-src/sapi/cgi/fastcgi.c Wed May 3 15:48:33 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fastcgi.c,v 1.12 2006/05/03 13:20:12 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.13 2006/05/03 15:48:33 dmitry Exp $ */
#include "fastcgi.h"
#include "php.h"
@@ -305,7 +305,7 @@
memset(&sa.sa_unix, 0, sizeof(sa.sa_unix));
sa.sa_unix.sun_family = AF_UNIX;
memcpy(sa.sa_unix.sun_path, path, path_len + 1);
- sa_len = (size_t)(((struct sockaddr_un *)0)->sun_path) +
path_len;
+ sa_len = (size_t)(((struct sockaddr_un *)0)->sun_path) +
path_len;
#ifdef HAVE_SOCKADDR_UN_SUN_LEN
sa.sa_unix.sun_len = sa_len;
#endif
@@ -441,7 +441,6 @@
unsigned char buf[FCGI_MAX_LENGTH+8];
req->keep = 0;
- req->has_in = 0;
req->in_len = 0;
req->out_hdr = NULL;
req->out_pos = req->out_buf;
@@ -510,19 +509,6 @@
len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0;
padding = hdr.paddingLength;
}
-#ifdef _WIN32
- req->has_in = 1;
-#else
- if (safe_read(req, &hdr, sizeof(fcgi_header)) !=
sizeof(fcgi_header) ||
- hdr.version < FCGI_VERSION_1 ||
- hdr.type != FCGI_STDIN) {
- req->keep = 0;
- return 0;
- }
- req->in_len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0;
- req->in_pad = hdr.paddingLength;
- req->has_in = (req->in_len != 0);
-#endif
} else if (hdr.type == FCGI_GET_VALUES) {
int i, j;
int name_len;
@@ -548,7 +534,7 @@
}
len = p - buf - sizeof(fcgi_header);
len += fcgi_make_header((fcgi_header*)buf,
FCGI_GET_VALUES_RESULT, 0, len);
- if (safe_write(req, buf, sizeof(fcgi_header)+len) !=
sizeof(fcgi_header)+len) {
+ if (safe_write(req, buf, sizeof(fcgi_header)+len) !=
(int)sizeof(fcgi_header)+len) {
return 0;
}
return 0;
@@ -565,9 +551,6 @@
fcgi_header hdr;
unsigned char buf[8];
- if (!req->has_in) {
- return 0;
- }
n = 0;
rest = len;
while (rest > 0) {
@@ -635,6 +618,10 @@
RevertToSelf();
}
#else
+ char buf[8];
+
+ shutdown(req->fd, 1);
+ while (recv(req->fd, buf, sizeof(buf), 0) > 0) {}
close(req->fd);
#endif
req->fd = -1;
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.3&r2=1.4&diff_format=u
Index: php-src/sapi/cgi/fastcgi.h
diff -u php-src/sapi/cgi/fastcgi.h:1.3 php-src/sapi/cgi/fastcgi.h:1.4
--- php-src/sapi/cgi/fastcgi.h:1.3 Thu Apr 27 11:39:46 2006
+++ php-src/sapi/cgi/fastcgi.h Wed May 3 15:48:33 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fastcgi.h,v 1.3 2006/04/27 11:39:46 dmitry Exp $ */
+/* $Id: fastcgi.h,v 1.4 2006/05/03 15:48:33 dmitry Exp $ */
/* FastCGI protocol */
@@ -97,7 +97,6 @@
int id;
int keep;
- int has_in;
int in_len;
int in_pad;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php