]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Read the FCGI_STDERR stream and log it to the error log. This will need
authorGarrett Rooney <rooneg@apache.org>
Fri, 6 Jan 2006 03:51:43 +0000 (03:51 +0000)
committerGarrett Rooney <rooneg@apache.org>
Fri, 6 Jan 2006 03:51:43 +0000 (03:51 +0000)
cleanup, but at least it keeps us from messing up the stream when we get
stuff written to stderr by the fastcgi process.

* modules/proxy/mod_proxy_fcgi.c
  (dispatch): Move the plen recv down after the switch, so it gets done
   for all cases that have padding.  Read data for the FCGI_STDERR case
   just like we do for FCGI_STDOUT, but write it to the log instead of
   sending it to the client.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/fcgi-proxy-dev@366412 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_fcgi.c

index 4df01333b032608192f837b15c8096794e0b9686..ba82f121fb0d44c5785ea470ff361713f74c3cf9 100644 (file)
@@ -590,19 +590,19 @@ recv_again:
 
                     /* XXX Why don't we cleanup here?  (logic from AJP) */
                 }
-
-                if (plen) {
-                    readbuflen = plen;
-
-                    rv = apr_socket_recv(conn->sock, readbuf, &readbuflen);
-                    if (rv != APR_SUCCESS) {
-                        break;
-                    }
-                }
                 break;
 
             case FCGI_STDERR:
-                /* XXX TODO FCGI_STDERR gets written to the log file. */
+                /* TODO: Should probably clean up this logging a bit... */
+                if (clen) {
+                    ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+                                 "proxy: FCGI: Got error '%s'", readbuf);
+                }
+
+                if (clen > readbuflen) {
+                    clen -= readbuflen;
+                    goto recv_again;
+                }
                 break;
 
             case FCGI_END_REQUEST:
@@ -614,6 +614,15 @@ recv_again:
                              "proxy: FCGI: Got bogus record %d", type);
                 break;
             }
+
+            if (plen) {
+                readbuflen = plen;
+
+                rv = apr_socket_recv(conn->sock, readbuf, &readbuflen);
+                if (rv != APR_SUCCESS) {
+                    break;
+                }
+            }
         }
     }