From 6a50d8ac43b24ebf1fc8ce415332d33c3506bcc7 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Fri, 24 Mar 2017 13:43:57 +0000 Subject: [PATCH] Merge r1777354 from trunk: old IBM EBCDIC fix that never got shared. Submitted by: covener Reviewed by: covener, wrowe, ylavic (by inspection) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1788447 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 5 ----- server/protocol.c | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/STATUS b/STATUS index 015316bdcd..cf9b0206aa 100644 --- a/STATUS +++ b/STATUS @@ -132,11 +132,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x patch: trunk works +1: covener, wrowe, ylavic - *) core: EBCDIC fixes for interim responses with additional headers. - trunk patch: http://svn.apache.org/r1777354 - 2.4.x patch: http://people.apache.org/~covener/patches/ebcdic-interim.diff - +1: covener, wrowe, ylavic (by inspection) - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/server/protocol.c b/server/protocol.c index 00174458ae..19d087cbea 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -2016,12 +2016,27 @@ typedef struct hdr_ptr { ap_filter_t *f; apr_bucket_brigade *bb; } hdr_ptr; + +#if APR_CHARSET_EBCDIC static int send_header(void *data, const char *key, const char *val) { - ap_fputstrs(((hdr_ptr*)data)->f, ((hdr_ptr*)data)->bb, - key, ": ", val, CRLF, NULL); + char *header_line = NULL; + hdr_ptr *hdr = (hdr_ptr*)data; + + header_line = apr_pstrcat(hdr->bb->p, key, ": ", val, CRLF, NULL); + ap_xlate_proto_to_ascii(header_line, strlen(header_line)); + ap_fputs(hdr->f, hdr->bb, header_line); return 1; } +#else +static int send_header(void *data, const char *key, const char *val) +{ + ap_fputstrs(((hdr_ptr*)data)->f, ((hdr_ptr*)data)->bb, + key, ": ", val, CRLF, NULL); + return 1; + } +#endif + AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers) { hdr_ptr x; -- 2.50.1