[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-20 Thread Dmitry Stogov
dmitry   Mon, 20 Sep 2010 10:45:22 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303614

Log:
Reverted wrong patch

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-20 10:33:23 UTC (rev 
303613)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-20 10:45:22 UTC (rev 
303614)
@@ -1108,7 +1108,7 @@
DisconnectNamedPipe(pipe);
} else {
if (!force) {
-   char buf;
+   fcgi_header buf;

shutdown(req-fd, 1);
/* read the last FCGI_STDIN header (it may be 
omitted) */

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

Re: [PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-20 Thread Dmitry Stogov

Hi Kalle,

Your patch was definitely wrong and I reverted it.

This code reads a terminating FastCGI header which can be omitted.
With your change PHP reads just a single byte instead of whole header, 
as result FastCGI manager receives SIGPIPE and may assume that it can't 
deliver request.


I don't know what you tried to fix because on Unix recv() has void* 
argument.


Thanks. Dmitry.


Kalle Sommer Nielsen wrote:

kalleSun, 19 Sep 2010 19:18:30 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303577

Log:
Fix incompatible types, we need to use a char here for recv()

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-19 19:08:56 UTC (rev 
303576)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-19 19:18:30 UTC (rev 
303577)
@@ -1108,7 +1108,7 @@
DisconnectNamedPipe(pipe);
} else {
if (!force) {
-   fcgi_header buf;
+   char buf;

shutdown(req-fd, 1);
/* read the last FCGI_STDIN header (it may be 
omitted) */




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



[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-19 Thread Kalle Sommer Nielsen
kalleSun, 19 Sep 2010 19:18:30 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303577

Log:
Fix incompatible types, we need to use a char here for recv()

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-19 19:08:56 UTC (rev 
303576)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-19 19:18:30 UTC (rev 
303577)
@@ -1108,7 +1108,7 @@
DisconnectNamedPipe(pipe);
} else {
if (!force) {
-   fcgi_header buf;
+   char buf;

shutdown(req-fd, 1);
/* read the last FCGI_STDIN header (it may be 
omitted) */

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-06 Thread Dmitry Stogov
dmitry   Mon, 06 Sep 2010 11:11:40 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303072

Log:
Fixed bug #46723 (FastCGI persistent connection is incredibly slow due to TCP 
ack delay).

Bug: http://bugs.php.net/46723 (Assigned) FastCGI is incredibly slow due to TCP 
ack delay
  
Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-06 11:08:43 UTC (rev 
303071)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-06 11:11:40 UTC (rev 
303072)
@@ -67,6 +67,7 @@
 # include sys/socket.h
 # include sys/un.h
 # include netinet/in.h
+# include netinet/tcp.h
 # include arpa/inet.h
 # include netdb.h
 # include signal.h
@@ -337,12 +338,13 @@

 struct _fcgi_request {
intlisten_socket;
-#ifdef _WIN32
inttcp;
-#endif
intfd;
intid;
intkeep;
+#ifdef TCP_NODELAY
+   intnodelay;
+#endif
intclosed;

intin_len;
@@ -746,6 +748,10 @@
req-tcp = 
!GetNamedPipeInfo((HANDLE)_get_osfhandle(req-listen_socket), NULL, NULL, NULL, 
NULL);
 #endif

+#ifdef TCP_NODELAY
+   req-nodelay = 0;
+#endif
+
fcgi_hash_init(req-env);

return req;
@@ -908,6 +914,18 @@
}

req-keep = (((fcgi_begin_request*)buf)-flags  
FCGI_KEEP_CONN);
+#ifdef TCP_NODELAY
+   if (req-keep  req-tcp  !req-nodelay) {
+# ifdef _WIN32
+   BOOL on = 1;
+# else
+   int on = 1;
+# endif
+
+   setsockopt(req-fd, IPPROTO_TCP, TCP_NODELAY, 
(char*)on, sizeof(on));
+   req-nodelay = 1;
+   }
+#endif
switch fcgi_begin_request*)buf)-roleB1  8) + 
((fcgi_begin_request*)buf)-roleB0) {
case FCGI_RESPONDER:
fcgi_hash_set(req-env, 
FCGI_HASH_FUNC(FCGI_ROLE, sizeof(FCGI_ROLE)-1), FCGI_ROLE, 
sizeof(FCGI_ROLE)-1, RESPONDER, sizeof(RESPONDER)-1);
@@ -1108,6 +1126,9 @@
}
close(req-fd);
 #endif
+#ifdef TCP_NODELAY
+   req-nodelay = 0;
+#endif
req-fd = -1;
}
 }
@@ -1158,25 +1179,34 @@
FCGI_LOCK(req-listen_socket);
req-fd = accept(listen_socket, (struct 
sockaddr *)sa, len);
FCGI_UNLOCK(req-listen_socket);
-   if (req-fd = 0 
-   allowed_clients 
-   ((struct sockaddr *)sa)-sa_family 
== AF_INET) {
-   int n = 0;
-   int allowed = 0;
+   if (req-fd = 0) {
+   if (((struct sockaddr 
*)sa)-sa_family == AF_INET) {
+#ifndef _WIN32
+   req-tcp = 1;
+#endif
+   if (allowed_clients) {
+   int n = 0;
+   int allowed = 0;

-   while (allowed_clients[n] != 
INADDR_NONE) {
-   if (allowed_clients[n] 
== sa.sa_inet.sin_addr.s_addr) {
-   allowed = 1;
-   break;
+   while 
(allowed_clients[n] != INADDR_NONE) {
+   if 
(allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
+   
allowed = 1;
+   
break;
+   }
+   n++;
+   }
+   if (!allowed) {
+   
fprintf(stderr, Connection from disallowed IP address '%s' is dropped.\n, 
inet_ntoa(sa.sa_inet.sin_addr));
+   
closesocket(req-fd);
+   req-fd 
= -1;
+  

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-01 Thread Dmitry Stogov
dmitry   Wed, 01 Sep 2010 14:42:43 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302977

Log:
invalid length

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 13:14:40 UTC (rev 
302976)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 14:42:43 UTC (rev 
302977)
@@ -1438,7 +1438,7 @@
if (val == NULL) {
fcgi_hash_del(req-env, var, var_len);
} else {
-   return fcgi_hash_set(req-env, var, var_len+1, val, 
strlen(val));
+   return fcgi_hash_set(req-env, var, var_len, val, 
strlen(val));
}
}
return NULL;

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-01 Thread Felipe Pena
felipe   Wed, 01 Sep 2010 23:21:03 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302985

Log:
- Fixed compiler warning (missing return statement)

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 22:59:25 UTC (rev 
302984)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 23:21:03 UTC (rev 
302985)
@@ -1445,6 +1445,7 @@
if (!req) return NULL;
if (val == NULL) {
fcgi_hash_del(req-env, FCGI_HASH_FUNC(var, var_len), var, 
var_len);
+   return NULL;
} else {
return fcgi_hash_set(req-env, FCGI_HASH_FUNC(var, var_len), 
var, var_len, val, strlen(val));
}
@@ -1454,6 +1455,7 @@
 {
if (val == NULL) {
fcgi_hash_del(req-env, hash_value, var, var_len);
+   return NULL;
} else {
return fcgi_hash_set(req-env, hash_value, var, var_len, val, 
strlen(val));
}

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-08-27 Thread Dmitry Stogov
dmitry   Fri, 27 Aug 2010 08:50:32 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302845

Log:
Don't check FCGI_WEB_SERVER_ADDRS for UNIX sockets

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-08-27 08:49:21 UTC (rev 
302844)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-08-27 08:50:32 UTC (rev 
302845)
@@ -1157,17 +1157,19 @@
FCGI_LOCK(req-listen_socket);
req-fd = accept(listen_socket, (struct 
sockaddr *)sa, len);
FCGI_UNLOCK(req-listen_socket);
-   if (req-fd = 0  allowed_clients) {
+   if (req-fd = 0 
+   allowed_clients 
+   ((struct sockaddr *)sa)-sa_family 
== AF_INET) {
int n = 0;
int allowed = 0;

-   while 
(allowed_clients[n] != INADDR_NONE) {
-   if 
(allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
-   allowed 
= 1;
-   break;
-   }
-   n++;
+   while (allowed_clients[n] != 
INADDR_NONE) {
+   if (allowed_clients[n] 
== sa.sa_inet.sin_addr.s_addr) {
+   allowed = 1;
+   break;
}
+   n++;
+   }
if (!allowed) {
fprintf(stderr, 
Connection from disallowed IP address '%s' is dropped.\n, 
inet_ntoa(sa.sa_inet.sin_addr));
closesocket(req-fd);

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-08-18 Thread Kalle Sommer Nielsen
kalleWed, 18 Aug 2010 18:00:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302451

Log:
Nuke compiler warning, wrong fix that shouldn't have been in the previously 
commit

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-08-18 16:54:47 UTC (rev 
302450)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-08-18 18:00:33 UTC (rev 
302451)
@@ -848,7 +848,7 @@
val_len |= *p++;
}
if (UNEXPECTED(name_len + val_len  0) ||
-   UNEXPECTED((unsigned char *) (name_len + val_len)  end - 
p)) {
+   UNEXPECTED(name_len + val_len  (unsigned int) (end - p))) {
/* Malformated request */
ret = 0;
break;

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2009-08-26 Thread Pierre-Alain Joye
pajoye   Wed, 26 Aug 2009 19:19:05 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=287778

Log:
- fix build

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2009-08-26 19:17:32 UTC (rev 
28)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2009-08-26 19:19:05 UTC (rev 
287778)
@@ -403,8 +403,8 @@
HANDLE namedPipe;

memset(sa, 0, sizeof(saw));
-   sa.nLength = sizeof(saw);
-   sa.bInheritHandle = FALSE;
+   saw.nLength = sizeof(saw);
+   saw.bInheritHandle = FALSE;
acl = prepare_named_pipe_acl(sd, saw);

namedPipe = CreateNamedPipe(path,

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