]> granicus.if.org Git - apache/commitdiff
Get rid of much of the old implementation of translating the
authorJeff Trawick <trawick@apache.org>
Thu, 5 Oct 2000 11:21:26 +0000 (11:21 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 5 Oct 2000 11:21:26 +0000 (11:21 +0000)
charset of response bodies.

ap_checkconv() is removed, except for in os/bs2000 and os/tpf.
(Anything there is questionable for 2.0 anyway.)

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

include/httpd.h
include/util_ebcdic.h
modules/filters/mod_include.c
modules/http/http_protocol.c
modules/http/http_request.c
server/util_charset.c
server/util_ebcdic.c

index 77086f946f9c3a06c60efd19e680d186a3fa42be..4cebd4dc8ef42c788263060eb3686e8c5b7a9d53 100644 (file)
@@ -579,10 +579,6 @@ typedef struct request_rec request_rec;
 /** structure to aid charset translate between machine and network */
 struct ap_rr_xlate {
     /* contents are experimental! expect it to change! */
-    /** translation handle to use when going to the network */
-    apr_xlate_t *to_net;
-    /** whether or not write translation is single-byte-only */
-    int to_net_sb;
     /** translation handle to use when coming from the network */
     apr_xlate_t *from_net;
 };
index 6086fc33af2896524f035906748f85ab881fe897..8b6c645da51f1d9b48c49e8dec5ae4854ed2d23a 100644 (file)
@@ -79,13 +79,6 @@ extern "C" {
  */
 apr_status_t ap_init_ebcdic(apr_pool_t *pool);
 
-/**
- * Check the Content-Type to decide if conversion is needed 
- * @param r The current request
- * @return The translation handle to use for the conversion if one is needed
- */
-apr_xlate_t *ap_checkconv(request_rec *r);
-
 #ifdef __cplusplus
 }
 #endif
index ef31f810f7a6ba227483aaaa8ab4dd03fa473796..5514e247c70417abc27647264d039fd7f50ca1b6 100644 (file)
@@ -2514,10 +2514,6 @@ static int includes_filter(ap_filter_t *f, ap_bucket_brigade *b)
      * expect to be signal-ready to SIGALRM.  There is no clean way to
      * fix this, except to put alarm support into BUFF. -djg
      */
-#ifdef CHARSET_EBCDIC
-    /* XXX:@@@ Is the generated/included output ALWAYS in text/ebcdic format? */
-    ap_bsetopt(r->connection->client, BO_WXLATE, &ap_hdrs_to_ascii);
-#endif
 
     send_parsed_content(&b, r, f);
     ap_pass_brigade(f->next, b);
index 82004222564c0b82a66c617ae5fabcb1760de6ba..639d04b7f4b1b31a07a3631496094b4b7744e818 100644 (file)
@@ -428,17 +428,6 @@ API_EXPORT(int) ap_set_keepalive(request_rec *r)
                            apr_table_get(r->headers_out, "Connection"), "close");
     const char *conn = apr_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.
-         */
-        apr_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
@@ -2075,20 +2064,6 @@ API_EXPORT(void) ap_send_http_header(request_rec *r)
         return;
     }
 
-#ifdef CHARSET_EBCDIC
-    /* By default, we convert all content.  ap_checkconv() can decide
-     * that conversion shouldn't be performed.  Also, if the content type
-     * contains the "magic" prefix for serving raw ascii
-     * (text/x-ascii-{plain,html,...}), the type is corrected to the real
-     * text/{plain,html,...} type which goes into the headers.
-     * This may not seem like the best place to put this call, but doing
-     * it here avoids having to call it in every handler (which is
-     * particularly hard to do with handlers in modules which aren't
-     * part of the Apache httpd distribution).
-     */
-    ap_checkconv(r);
-#endif
-      
     /*
      * Now that we are ready to send a response, we need to combine the two
      * header field tables into a single table.  If we don't do this, our
@@ -3242,15 +3217,6 @@ API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error)
         }
     }
 
-#ifdef APACHE_XLATE
-    /* Ensure that the proper translation handle (if any) is used when
-     * sending the response document to the client.  Note that on an 
-     * ASCII machine, ap_hdrs_to_ascii is NULL, so this will turn off 
-     * any translation selected by a module for content.
-     */
-    ap_set_content_xlate(r, 1, ap_hdrs_to_ascii);
-#endif
-
     if ((custom_response = ap_response_code_string(r, idx))) {
         /*
          * We have a custom response output. This should only be
index fda602133c5aa8857fb90c6af25de0983f8622df..c346fe11e07e0917a2cae5fadec2f50b04bb73c8 100644 (file)
@@ -983,19 +983,7 @@ API_EXPORT(int) ap_run_sub_req(request_rec *r)
 
     /* see comments in process_request_internal() */
     ap_run_insert_filter(r);
-
-#ifndef APACHE_XLATE
     retval = ap_invoke_handler(r);
-#else /*APACHE_XLATE*/
-    {
-        /* Save the output conversion setting across subrequests */
-        apr_xlate_t *saved_xlate;
-
-        ap_bgetopt(r->connection->client, BO_WXLATE, &saved_xlate);
-        retval  = ap_invoke_handler(r);
-        ap_bsetopt(r->connection->client, BO_WXLATE, &saved_xlate);
-    }
-#endif /*APACHE_XLATE*/
     ap_finalize_sub_req_protocol(r);
     return retval;
 }
index edec8ad006cdd5cd0f11e3b15ecc46aee46cc153..106d1306d4ade9992d5c7102655fbcd46d36a7a1 100644 (file)
@@ -75,8 +75,8 @@
  * the source code.
  *
  * For an ASCII machine, these remain NULL so that when they are stored
- * in the BUFF via ap_bsetop(BO_WXLATE or BO_RXLATE) it ensures that no
- * translation is performed.
+ * in the BUFF via ap_bsetop(BO_RXLATE) it ensures that no translation is 
+ * performed.
  */
  
 apr_xlate_t *ap_hdrs_to_ascii, *ap_hdrs_from_ascii;
@@ -101,22 +101,14 @@ API_EXPORT(apr_status_t) ap_set_content_xlate(request_rec *r, int output,
 {
     apr_status_t rv;
 
-    if (output) {
-        r->rrx->to_net = xlate;
-        if (xlate) {
-            apr_xlate_get_sb(r->rrx->to_net, &r->rrx->to_net_sb);
-        }
-        rv = ap_bsetopt(r->connection->client, BO_WXLATE, &xlate);
-    }
-    else {
-        r->rrx->from_net = xlate;
-        rv = ap_bsetopt(r->connection->client, BO_RXLATE, &xlate);
-    }
+    ap_assert(output == 0);
+
+    r->rrx->from_net = xlate;
+    rv = ap_bsetopt(r->connection->client, BO_RXLATE, &xlate);
 
     if (rv) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "BO_%sXLATE failed",
-                      output ? "W" : "R");
+                      "BO_RXLATE failed");
     }
 
     return rv;
index f0155906c6c29a8731c60017e93163b028a4caef..525ea170ba444f9f4d8805b44a24427da7859352 100644 (file)
@@ -123,46 +123,4 @@ apr_status_t ap_init_ebcdic(apr_pool_t *pool)
     return APR_SUCCESS;
 }
 
-#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
-
-/* Check the Content-Type to decide if conversion is needed */
-apr_xlate_t *ap_checkconv(struct request_rec *r)
-{
-    int convert_to_ascii;
-    const char *type;
-    apr_xlate_t *zero = NULL;
-
-    /* To make serving of "raw ASCII text" files easy (they serve faster 
-     * since they don't have to be converted from EBCDIC), a new
-     * "magic" type prefix was invented: text/x-ascii-{plain,html,...}
-     * If we detect one of these content types here, we simply correct
-     * the type to the real text/{plain,html,...} type. Otherwise, we
-     * set a flag that translation is required later on.
-     */
-
-    type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type;
-
-    /* If no content type is set then treat it as (ebcdic) text/plain */
-    convert_to_ascii = (type == NULL);
-
-    /* Conversion is applied to text/ files only, if ever. */
-    if (type && (strncasecmp(type, "text/", 5) == 0 ||
-                strncasecmp(type, "message/", 8) == 0)) {
-       if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX,
-                       sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0)
-           r->content_type = apr_pstrcat(r->pool, "text/",
-                                        type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1,
-                                        NULL);
-        else
-           /* translate EBCDIC to ASCII */
-           convert_to_ascii = 1;
-    }
-    /* Turn off conversion if it's not a text document */
-    if (!convert_to_ascii) {
-        ap_set_content_xlate(r, 1, zero);
-    }
-
-    return convert_to_ascii ? ap_locale_to_ascii : NULL;
-}
-
 #endif /* CHARSET_EBCDIC */