]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
APACHE_XLATE, when doing translation that isn't single-byte-only
authorJeff Trawick <trawick@apache.org>
Fri, 2 Jun 2000 15:55:20 +0000 (15:55 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 2 Jun 2000 15:55:20 +0000 (15:55 +0000)
We must zap the Content-length header (if any).  Otherwise, the
browser will be seriously confused :)  The header is zapped in
ap_set_keepalive() right before we look for Content-length, transfer
encoding, HTTP level, etc. to decide, among other issues, whether or
not to turn on chunked encoding.  For HTTP 1.1, if we don't send
Content-length, we need to use chunked encoding, so we have to zap
the header before that decision.

Interestingly, in Russian Apache the Content-length header is
zapped after ap_set_keepalive() is called, so with HTTP 1.1 they
break the content-length-or-chunked rule.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85379 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
modules/http/http_protocol.c
server/util_charset.c

index 165f71325260527408232d12e70db24ed5d92bb3..0e7ddfd265fe92686269e66e8df4168a393e18a0 100644 (file)
@@ -594,6 +594,7 @@ typedef struct request_rec request_rec;
 struct ap_rr_xlate {
     /* contents are experimental! expect it to change! */
     ap_xlate_t *to_net;
+    int to_net_sb; /* whether or not write translation is single-byte-only */
     ap_xlate_t *from_net;
 };
 #endif /*APACHE_XLATE*/
index c4838c10ca454416be0e1646fd28e80630343856..14c638d7a1388d8262f4d5b3c248f22649dffc51 100644 (file)
@@ -333,6 +333,17 @@ API_EXPORT(int) ap_set_keepalive(request_rec *r)
                            ap_table_get(r->headers_out, "Connection"), "close");
     const char *conn = ap_table_get(r->headers_in, "Connection");
 
+#ifdef APACHE_XLATE
+    if (r->rrx->to_net && !r->rrx->to_net_sb) {
+        /* Translation is not single-byte-only, so we don't know the
+         * content length. Zap the Content-Length header before the 
+         * following logic, as the absence of the Content-Length header
+         * may affect the decision on chunked encoding.
+         */
+        ap_table_unset(r->headers_out,"Content-Length");
+    }
+#endif /* APACHE_XLATE */
+
     /* The following convoluted conditional determines whether or not
      * the current connection should remain persistent after this response
      * (a.k.a. HTTP Keep-Alive) and whether or not the output message
index 8a613f90759d696f581398679541c16025a50aa0..b6bb0dfd837d8b3ea06f1049c2a7a1000aa3e89c 100644 (file)
@@ -103,6 +103,9 @@ API_EXPORT(ap_status_t) ap_set_content_xlate(request_rec *r, int output,
 
     if (output) {
         r->rrx->to_net = xlate;
+        if (xlate) {
+            ap_xlate_get_sb(r->rrx->to_net, &r->rrx->to_net_sb);
+        }
         rv = ap_bsetopt(r->connection->client, BO_WXLATE, &xlate);
     }
     else {