summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2000-10-26 12:48:28 +0200
committerJeff Trawick <trawick@apache.org>2000-10-26 12:48:28 +0200
commit6217bc8f88fe0a734478a70b872fa5bb062dd559 (patch)
tree3df3d2866a7d6406244389ce4a36dacd99a7bcb4
parentGet rid of the xlate version of ap_md5_digest() (diff)
downloadapache2-6217bc8f88fe0a734478a70b872fa5bb062dd559.tar.xz
apache2-6217bc8f88fe0a734478a70b872fa5bb062dd559.zip
Introduce ap_xlate_proto_{to|from}_ascii() to clean up some of
the EBCDIC support. They are noops on ASCII machines, so this type of translation doesn't have to be surrounded by #ifdef CHARSET_EBCDIC. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86751 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/util_ebcdic.h21
-rw-r--r--modules/http/http_core.c10
-rw-r--r--server/rfc1413.c17
-rw-r--r--server/util_ebcdic.c18
4 files changed, 43 insertions, 23 deletions
diff --git a/include/util_ebcdic.h b/include/util_ebcdic.h
index 8b6c645da5..9799823790 100644
--- a/include/util_ebcdic.h
+++ b/include/util_ebcdic.h
@@ -79,10 +79,31 @@ extern "C" {
*/
apr_status_t ap_init_ebcdic(apr_pool_t *pool);
+/**
+ * Convert protocol data from the implementation character
+ * set to ASCII.
+ * @param buffer buffer to translate
+ * @param len number of bytes to translate
+ */
+void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len);
+
+/**
+ * Convert protocol data to the implementation character
+ * set from ASCII.
+ * @param buffer buffer to translate
+ * @param len number of bytes to translate
+ */
+void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len);
+
#ifdef __cplusplus
}
#endif
+#else /* CHARSET_EBCDIC */
+
+#define ap_xlate_proto_to_ascii(x,y) /* NOOP */
+#define ap_xlate_proto_from_ascii(x,y) /* NOOP */
+
#endif /* CHARSET_EBCDIC */
#endif /* !APACHE_UTIL_EBCDIC_H */
diff --git a/modules/http/http_core.c b/modules/http/http_core.c
index 350bad4ee9..5d21198ad5 100644
--- a/modules/http/http_core.c
+++ b/modules/http/http_core.c
@@ -3279,15 +3279,7 @@ 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
+ ap_xlate_proto_to_ascii(chunk_hdr, hdr_len);
e = ap_bucket_create_transient(chunk_hdr, hdr_len);
AP_BRIGADE_INSERT_HEAD(b, e);
diff --git a/server/rfc1413.c b/server/rfc1413.c
index 7a8cc102f6..500553334c 100644
--- a/server/rfc1413.c
+++ b/server/rfc1413.c
@@ -119,9 +119,6 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
char *cp;
char buffer[RFC1413_MAXDATA + 1];
int buflen;
-#ifdef CHARSET_EBCDIC
- apr_size_t inbytes_left, outbytes_left;
-#endif
/*
* Bind the local and remote ends of the query socket to the same
@@ -156,11 +153,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
/* send the data */
buflen = apr_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", sav_rmt_port,
sav_our_port);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = buflen;
- apr_xlate_conv_buffer(ap_hdrs_to_ascii, buffer, &inbytes_left,
- buffer, &outbytes_left);
-#endif
+ ap_xlate_proto_to_ascii(buffer, buflen);
/* send query to server. Handle short write. */
i = 0;
@@ -180,7 +173,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
/*
* Read response from server. - the response should be newline
- * terminated according to rfc - make sure it doesn't stomp it's
+ * terminated according to rfc - make sure it doesn't stomp its
* way out of the buffer.
*/
@@ -209,11 +202,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
}
/* RFC1413_USERLEN = 512 */
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = i;
- apr_xlate_conv_buffer(ap_hdrs_from_ascii, buffer, &inbytes_left,
- buffer, &outbytes_left);
-#endif
+ ap_xlate_proto_from_ascii(buffer, i);
if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port,
user) != 3 || sav_rmt_port != rmt_port
|| sav_our_port != our_port)
diff --git a/server/util_ebcdic.c b/server/util_ebcdic.c
index 525ea170ba..51830d77c2 100644
--- a/server/util_ebcdic.c
+++ b/server/util_ebcdic.c
@@ -123,4 +123,22 @@ apr_status_t ap_init_ebcdic(apr_pool_t *pool)
return APR_SUCCESS;
}
+void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len)
+{
+ apr_size_t inbytes_left, outbytes_left;
+
+ inbytes_left = outbytes_left = len;
+ apr_xlate_conv_buffer(ap_hdrs_to_ascii, buffer, &inbytes_left,
+ buffer, &outbytes_left);
+}
+
+void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len)
+{
+ apr_size_t inbytes_left, outbytes_left;
+
+ inbytes_left = outbytes_left = len;
+ apr_xlate_conv_buffer(ap_hdrs_from_ascii, buffer, &inbytes_left,
+ buffer, &outbytes_left);
+}
+
#endif /* CHARSET_EBCDIC */