You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/06/02 17:55:23 UTC

cvs commit: apache-2.0/src/main http_protocol.c util_charset.c

trawick     00/06/02 08:55:22

  Modified:    src/include httpd.h
               src/main http_protocol.c util_charset.c
  Log:
  APACHE_XLATE, when doing translation that isn't single-byte-only
  
  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.
  
  Revision  Changes    Path
  1.51      +1 -0      apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- httpd.h	2000/05/31 22:06:32	1.50
  +++ httpd.h	2000/06/02 15:55:15	1.51
  @@ -594,6 +594,7 @@
   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*/
  
  
  
  1.75      +11 -0     apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- http_protocol.c	2000/05/31 01:35:46	1.74
  +++ http_protocol.c	2000/06/02 15:55:19	1.75
  @@ -333,6 +333,17 @@
                              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
  
  
  
  1.2       +3 -0      apache-2.0/src/main/util_charset.c
  
  Index: util_charset.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_charset.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- util_charset.c	2000/05/25 20:51:23	1.1
  +++ util_charset.c	2000/06/02 15:55:20	1.2
  @@ -103,6 +103,9 @@
   
       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 {