From: Jeff Trawick Date: Thu, 5 Oct 2000 11:21:26 +0000 (+0000) Subject: Get rid of much of the old implementation of translating the X-Git-Tag: APACHE_2_0_ALPHA_7~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf7aaebda614e19f493c6819ef45c548481412e1;p=apache Get rid of much of the old implementation of translating the 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 --- diff --git a/include/httpd.h b/include/httpd.h index 77086f946f..4cebd4dc8e 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -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; }; diff --git a/include/util_ebcdic.h b/include/util_ebcdic.h index 6086fc33af..8b6c645da5 100644 --- a/include/util_ebcdic.h +++ b/include/util_ebcdic.h @@ -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 diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index ef31f810f7..5514e247c7 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -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); diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 8200422256..639d04b7f4 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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 diff --git a/modules/http/http_request.c b/modules/http/http_request.c index fda602133c..c346fe11e0 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -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; } diff --git a/server/util_charset.c b/server/util_charset.c index edec8ad006..106d1306d4 100644 --- a/server/util_charset.c +++ b/server/util_charset.c @@ -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; diff --git a/server/util_ebcdic.c b/server/util_ebcdic.c index f0155906c6..525ea170ba 100644 --- a/server/util_ebcdic.c +++ b/server/util_ebcdic.c @@ -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 */