]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix EOF detection in new proxy dechunking code. Before, we barfed when we got
authorMartin Kraemer <martin@apache.org>
Fri, 12 Apr 2002 12:36:53 +0000 (12:36 +0000)
committerMartin Kraemer <martin@apache.org>
Fri, 12 Apr 2002 12:36:53 +0000 (12:36 +0000)
EOF (stripped down to '\xFF') instead of CRLF.

Also avoid a conversion problem for EBCDIC hosts.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94622 13f79535-47bb-0310-9956-ffa450edef68

src/modules/proxy/proxy_util.c

index dd95471c858ee94993ebce3bb3f9aac243517bf6..c0e685e0f01b19d485b2e7e04da8d0cc6118693d 100644 (file)
@@ -442,7 +442,7 @@ table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f)
     return resp_hdrs;
 }
 
-/* read data from f, write it to:
+/* read data from (socket BUFF*) f, write it to:
  * - c->fp, if it is open
  * - r->connection->client, if nowrite == 0
  */
@@ -474,8 +474,6 @@ long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int
 #ifdef CHARSET_EBCDIC
     /* The cache copy is ASCII, not EBCDIC, even for text/html) */
     ap_bsetflag(f, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0);
-    if (c != NULL && c->fp != NULL)
-        ap_bsetflag(c->fp, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0);
     ap_bsetflag(con->client, B_ASCII2EBCDIC | B_EBCDIC2ASCII, 0);
 #endif
 
@@ -553,24 +551,30 @@ long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c, off_t len, int
 
             /* soak up trailing CRLF */
             if (0 == remaining) {
-                char ch;
+                int ch; /* int because it may hold an EOF */
                 /*
-                * For EBCDIC, the proxy has configured the BUFF layer to
-                * transparently pass the ascii characters thru (also writing
-                * an ASCII copy to the cache, where appropriate).
-                * Therefore, we see here an ASCII-CRLF (\015\012),
-                * not an EBCDIC-CRLF (\r\n).
-                */
-                if ((ch = ap_bgetc(f)) == '\015') { /* _ASCII_ CR */
-                    ch = ap_bgetc(f);
+                 * For EBCDIC, the proxy has configured the BUFF layer to
+                 * transparently pass the ascii characters thru (also writing
+                 * an ASCII copy to the cache, where appropriate).
+                 * Therefore, we see here an ASCII-CRLF (\015\012),
+                 * not an EBCDIC-CRLF (\r\n).
+                 */
+                if ((ch = ap_bgetc(f)) == EOF) {
+                    /* EOF detected */
+                    n = 0;
                 }
-                if (ch != '\012') {
-                    n = -1;
+                else
+                {
+                    if (ch == '\015') { /* _ASCII_ CR */
+                        ch = ap_bgetc(f);
+                    }
+                    if (ch != '\012') {
+                        n = -1;
+                    }
                 }
             }
         }
 
-
         /* otherwise read block normally */
         else {
             if (-1 == len) {