From: Jeff Trawick Date: Wed, 25 Oct 2000 15:42:38 +0000 (+0000) Subject: EBCDIC: Make chunk_filter() write chunk headers/trailers in ASCII. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3405c7a590bd297ca1a5463a57b37182f3d0d565;p=apache EBCDIC: Make chunk_filter() write chunk headers/trailers in ASCII. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86747 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 15dadedf25..3226eff284 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -3218,6 +3218,8 @@ static apr_status_t coalesce_filter(ap_filter_t *f, ap_bucket_brigade *b) */ static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b) { +#define ASCII_CRLF "\015\012" +#define ASCII_ZERO "\060" ap_bucket_brigade *more = NULL; ap_bucket *e; apr_status_t rv; @@ -3282,6 +3284,15 @@ static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b) /* XXX might be nice to have APR_OFF_T_FMT_HEX */ hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr), "%qx" CRLF, (apr_uint64_t)bytes); +#ifdef CHARSET_EBCDIC + { + apr_size_t inbytes_left = hdr_len, outbytes_left = hdr_len; + + apr_xlate_conv_buffer(ap_hdrs_to_ascii, + chunk_hdr, &inbytes_left, + chunk_hdr, &outbytes_left); + } +#endif e = ap_bucket_create_transient(chunk_hdr, hdr_len); AP_BRIGADE_INSERT_HEAD(b, e); @@ -3289,7 +3300,7 @@ static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b) * Insert the end-of-chunk CRLF before the EOS bucket, or * appended to the brigade */ - e = ap_bucket_create_immortal(CRLF, 2); + e = ap_bucket_create_immortal(ASCII_CRLF, 2); if (eos != NULL) { AP_BUCKET_INSERT_BEFORE(eos, e); } @@ -3313,7 +3324,7 @@ static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b) */ if (eos != NULL) { /* XXX: (2) trailers ... does not yet exist */ - e = ap_bucket_create_immortal("0" CRLF /* */ CRLF, 5); + e = ap_bucket_create_immortal(ASCII_ZERO ASCII_CRLF /* */ ASCII_CRLF, 5); AP_BUCKET_INSERT_BEFORE(eos, e); }