]> granicus.if.org Git - apache/commitdiff
Clean up record header parsing a bit. This may fix the problems some
authorGarrett Rooney <rooneg@apache.org>
Wed, 4 Jan 2006 03:51:58 +0000 (03:51 +0000)
committerGarrett Rooney <rooneg@apache.org>
Wed, 4 Jan 2006 03:51:58 +0000 (03:51 +0000)
people have seen where rid != request_id.

* modules/proxy/mod_proxy_fcgi.c
  (dispatch): Stop initializing things we're just going to assign over
   them later, initialize all of the rid and clen variables, and fix a
   warning from passing an unsigned char array into apr_socket_recv by
   adding a cast to char *.

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

modules/proxy/mod_proxy_fcgi.c

index f18833061f233a19d63a73e68084d56f27cc4f91..fc32f04927b48e45245bf215bdf6f142cfeae7c5 100644 (file)
@@ -406,10 +406,10 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r,
              * the headers, even if we fill the entire length in the recv. */
             char readbuf[AP_IOBUFSIZE + 1];
             apr_size_t readbuflen;
-            apr_size_t clen = 0;
-            int rid, type = 0;
-            char plen = 0;
+            apr_size_t clen;
+            int rid, type;
             apr_bucket *b;
+            char plen;
             /*
              * below mapped to fcgi_header layout. We
              * use a unsigned char array to ensure the
@@ -424,7 +424,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r,
             /* First, we grab the header... */
             readbuflen = FCGI_HEADER_LEN;
 
-            rv = apr_socket_recv(conn->sock, fheader, &readbuflen);
+            rv = apr_socket_recv(conn->sock, (char *) fheader, &readbuflen);
             if (rv != APR_SUCCESS) {
                 break;
             }
@@ -446,8 +446,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r,
 
             type = fheader[1];
 
-            rid |= fheader[2] << 8;
-            rid |= fheader[3] << 0;
+            rid = (fheader[2] << 8) | fheader[3];
 
             if (rid != request_id) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
@@ -459,8 +458,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r,
 #endif
             }
 
-            clen |= fheader[4] << 8;
-            clen |= fheader[5] << 0;
+            clen = (fheader[4] << 8) | fheader[5];
 
             plen = fheader[6];