]> granicus.if.org Git - php/commitdiff
Properly read any remaining data when closing FastCGI socket
authorRobin McCorkell <rmccorkell@owncloud.com>
Fri, 29 Jan 2016 15:14:08 +0000 (15:14 +0000)
committerXinchen Hui <laruence@gmail.com>
Sat, 30 Jan 2016 04:36:52 +0000 (20:36 -0800)
main/fastcgi.c

index 54ba36b7dbfea5bded87b9d4a914b207a3109f64..3ab08b625f41347a52d546447e840013ee6ae0fc 100644 (file)
@@ -1287,11 +1287,11 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
                }
 #else
                if (!force) {
-                       fcgi_header buf;
+                       char buf[8];
 
                        shutdown(req->fd, 1);
-                       /* read the last FCGI_STDIN header (it may be omitted) */
-                       recv(req->fd, (char *)(&buf), sizeof(buf), 0);
+                       /* read any remaining data, it may be omitted */
+                       while (recv(req->fd, buf, sizeof(buf), 0) > 0) {}
                }
                close(req->fd);
 #endif