#
ServerSignature On
+# EBCDIC configuration:
+# (only for mainframes using the EBCDIC codeset, currently one of:
+# Fujitsu-Siemens' BS2000/OSD, IBM's OS/390 and IBM's TPF)!!
+# The following default configuration assumes that "text files"
+# are stored in EBCDIC (so that you can operate on them using the
+# normal POSIX tools like grep and sort) while "binary files" are
+# stored with identical octets as on an ASCII machine.
+#
+# The directives are evaluated in configuration file order, with
+# the EBCDICConvert directives applied before EBCDICConvertByType.
+#
+# If you want to have ASCII HTML documents and EBCDIC HTML documents
+# at the same time, you can use the file extension to force
+# conversion off for the ASCII documents:
+# > AddType text/html .ahtml
+# > EBCDICConvert Off=InOut .ahtml
+#
+# EBCDICConvertByType On=InOut text/* message/* multipart/*
+# EBCDICConvertByType On=In application/x-www-form-urlencoded
+# EBCDICConvertByType On=InOut application/postscript model/vrml
+# EBCDICConvertByType Off=InOut */*
+
+
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
Changes with Apache 1.3.20
+ *) Make EBCDIC conversion fully configurable. Until now, apache relied
+ on some (incomplete) heuristics, and would fail to correctly serve
+ text files when they had a MIME type of application/anything, like
+ application/x-javascript. The new conversion directives allow
+ defining the conversion based on MIME type or file suffix.
+ [Martin Kraemer]
+
*) Add a -V flag to suexec, which causes it to display the
compile-time settings with which it was built. (Only
usable by root or the HTTPD_USER username.) [Ken Coar]
LIB=libap.a
OBJS=ap_cpystrn.o ap_execve.o ap_fnmatch.o ap_getpass.o ap_md5c.o ap_signal.o \
- ap_slack.o ap_snprintf.o ap_sha1.o ap_checkpass.o ap_base64.o
+ ap_slack.o ap_snprintf.o ap_sha1.o ap_checkpass.o ap_base64.o ap_ebcdic.o
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $<
#include "ap.h"
#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
+#include "ap_ebcdic.h"
#endif /* CHARSET_EBCDIC */
/* aaaack but it's fast and const should make it shared text page. */
--- /dev/null
+/* ====================================================================
+ * Copyright (c) 1995-2000 The Apache Group. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the Apache Group
+ * for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the Apache Group
+ * for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#include "httpd.h"
+#include "http_core.h"
+#include "http_config.h"
+#include "ap_config.h"
+
+#ifdef CHARSET_EBCDIC
+#include "ap_ebcdic.h"
+
+
+/* ====================================================================== */
+/* Global functions for dealing with EBCDIC <-> ASCII conversion: */
+/* ====================================================================== */
+
+/* EBCDIC-to-ASCII tables:
+ These tables are bijective - there are no ambigous or duplicate characters.
+ */
+const unsigned char os_toascii[256] = {
+#ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */
+/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
+ 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
+/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
+ 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
+/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
+/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
+ 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
+/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
+ 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
+/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
+ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
+/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
+ 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
+/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
+ 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
+/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
+/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
+/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
+/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
+ 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
+/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
+/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
+ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
+/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
+/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
+
+#elif defined(OS390) || defined(TPF) /* IBM's OS/390 and TPF systems: */
+/*
+Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
+*/
+ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
+ 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
+ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
+ 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
+ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
+ 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
+ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
+ 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
+ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
+ 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
+ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
+ 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
+ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
+ 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
+ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
+ 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
+ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
+ 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
+ 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
+ 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
+ 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
+ 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
+ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
+ 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
+ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
+ 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
+ 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
+ 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
+ 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
+#else
+#error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>!
+#endif
+};
+
+
+/* Bijective ascii-to-ebcdic table: */
+const unsigned char os_toebcdic[256] = {
+#ifdef _OSD_POSIX /* Fujitsu-Siemens' EDF04 character set on BS2000: */
+/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
+ 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
+/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
+ 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
+/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
+ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
+/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
+/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
+/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
+ 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
+/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
+/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
+ 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
+/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
+/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
+ 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
+/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
+ 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
+/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
+ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
+/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
+ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
+/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
+ 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
+/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
+ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
+/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
+ 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
+#elif defined(OS390) || defined(TPF) /* IBM's OS/390 and TPF systems: */
+/*
+The US-ASCII to EBCDIC (character set IBM-1047) table:
+This table is bijective (no ambiguous or duplicate characters)
+*/
+ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
+ 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
+ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
+ 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
+ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
+ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
+ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
+ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
+ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
+ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
+ 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
+ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
+ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
+ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
+ 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
+ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
+ 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
+ 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
+ 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
+ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
+ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
+ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
+ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
+ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
+ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
+ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
+ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
+ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
+ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
+#else
+#error Unimplemented EBCDIC platform. Please send information about your system to <martin@apache.org>!
+#endif
+};
+
+
+/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
+ * dest and srce may be identical, or separate memory blocks, but
+ * should not overlap. These functions intentionally have an interface
+ * compatible to memcpy(3).
+ */
+
+
+API_EXPORT(void *)
+ebcdic2ascii(void *dest, const void *srce, size_t count)
+{
+ unsigned char *udest = dest;
+ const unsigned char *usrce = srce;
+
+ while (count-- != 0) {
+ *udest++ = os_toascii[*usrce++];
+ }
+
+ return dest;
+}
+
+API_EXPORT(void *)
+ascii2ebcdic(void *dest, const void *srce, size_t count)
+{
+ unsigned char *udest = dest;
+ const unsigned char *usrce = srce;
+
+ while (count-- != 0) {
+ *udest++ = os_toebcdic[*usrce++];
+ }
+
+ return dest;
+}
+#endif /*CHARSET_EBCDIC*/
#include "ap_md5.h"
#include "ap.h"
#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
+#include "ap_ebcdic.h"
#endif /*CHARSET_EBCDIC*/
#if HAVE_CRYPT_H
#include <crypt.h>
#include "ap_sha1.h"
#include "ap.h"
#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
+#include "ap_ebcdic.h"
#endif /*CHARSET_EBCDIC*/
/* a bit faster & bigger, if defined */
--- /dev/null
+/* ====================================================================
+ * Copyright (c) 1998-1999 The Apache Group. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the Apache Group
+ * for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * 4. The names "Apache Server" and "Apache Group" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the Apache Group
+ * for use in the Apache HTTP server project (http://www.apache.org/)."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Group and was originally based
+ * on public domain software written at the National Center for
+ * Supercomputing Applications, University of Illinois, Urbana-Champaign.
+ * For more information on the Apache Group and the Apache HTTP server
+ * project, please see <http://www.apache.org/>.
+ *
+ */
+
+#ifndef AP_EBCDIC_H
+#define AP_EBCDIC_H "$Id: ap_ebcdic.h,v 1.1 2001/03/09 10:10:19 martin Exp $"
+
+#include <sys/types.h>
+
+extern const unsigned char os_toascii[256];
+extern const unsigned char os_toebcdic[256];
+API_EXPORT(void *) ebcdic2ascii(void *dest, const void *srce, size_t count);
+API_EXPORT(void *) ascii2ebcdic(void *dest, const void *srce, size_t count);
+
+#endif /*AP_EBCDIC_H*/
interpreter_source_e script_interpreter_source;
#endif
+#ifdef CHARSET_EBCDIC
+ /* Configurable EBCDIC Conversion stuff */
+ /* Direction specific conversion: */
+#define dir_Out 0 /* 0utput (returned contents in a GET or POST) */
+#define dir_In 1 /* 1nput (uploaded contents in a PUT / POST) */
+
+ /* Conversion Enabled/Disabled: */
+#define conv_Unset '?' /* Conversion unconfigured */
+#define conv_Off '0' /* BINARY or ASCII file (no conversion) */
+#define conv_On '1' /* TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) */
+
+ /* The configuration args {On|Off}[={In|Out|InOut}] are currently stored
+ * as character strings ("0" = conv_Off, "1" = conv_On)
+ */
+ table *ebcdicconversion_by_ext_in;
+ table *ebcdicconversion_by_ext_out;
+ table *ebcdicconversion_by_type_in;
+ table *ebcdicconversion_by_type_out;
+
+#define LEGACY_KLUDGE 1 /* After a couple of versions this legacy kludge should be set to 0 */
+#ifndef ASCIITEXT_MAGIC_TYPE_PREFIX
+#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" /* Text files whose content-type starts with this are passed thru unconverted */
+#endif
+ int x_ascii_magic_kludge; /* whether to handle the text/x-ascii- kludge */
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ int ebcdicconversion_debug_header; /* whether to add an X-EBCDIC-Debug-{In,Out} header to the response */
+#endif
+#endif /* CHARSET_EBCDIC */
+
} core_dir_config;
/* Per-server core configuration */
#define CRLF "\015\012"
#define OS_ASC(c) (c)
#else /* CHARSET_EBCDIC */
-#include "ebcdic.h"
+#include "ap_ebcdic.h"
/* OSD_POSIX uses the EBCDIC charset. The transition ASCII->EBCDIC is done in
* the buff package (bread/bputs/bwrite), so everywhere else, we use
* "native EBCDIC" CR and NL characters. These are therefore defined as
*/
char *case_preserved_filename;
+#ifdef CHARSET_EBCDIC
+ /* We don't want subrequests to modify our current conversion flags.
+ * These flags save the state of the conversion flags when subrequests
+ * are run.
+ */
+ struct {
+ unsigned conv_in:1; /* convert ASCII->EBCDIC when read()ing? */
+ unsigned conv_out:1; /* convert EBCDIC->ASCII when write()ing? */
+ } ebcdic;
+#endif
+
/* Things placed at the end of the record to avoid breaking binary
* compatibility. It would be nice to remember to reorder the entire
* record to improve 64bit alignment the next time we need to break
#endif
#endif
-#ifdef _OSD_POSIX
-extern const char *os_set_account(pool *p, const char *account);
-extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
-#endif /* _OSD_POSIX */
+#ifdef CHARSET_EBCDIC
+API_EXPORT(int) ap_checkconv(struct request_rec *r); /* for downloads */
+API_EXPORT(int) ap_checkconv_in(struct request_rec *r); /* for uploads */
+#endif /*#ifdef CHARSET_EBCDIC*/
char *ap_get_local_host(pool *);
unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port);
*/
#define CORE_PRIVATE
+#define ADD_EBCDICCONVERT_DEBUG_HEADER 0
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
conf->add_default_charset = ADD_DEFAULT_CHARSET_UNSET;
conf->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME;
+#ifdef CHARSET_EBCDIC
+ conf->ebcdicconversion_by_ext_in = ap_make_table(a, 4);
+ conf->ebcdicconversion_by_ext_out = ap_make_table(a, 4);
+ conf->ebcdicconversion_by_type_in = ap_make_table(a, 4);
+ conf->ebcdicconversion_by_type_out = ap_make_table(a, 4);
+ conf->x_ascii_magic_kludge = 0;
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ conf->ebcdicconversion_debug_header = 0;
+#endif
+#endif /* CHARSET_EBCDIC */
+
return (void *)conf;
}
}
}
+#ifdef CHARSET_EBCDIC
+ conf->ebcdicconversion_by_ext_in = ap_overlay_tables(a, new->ebcdicconversion_by_ext_in,
+ base->ebcdicconversion_by_ext_in);
+ conf->ebcdicconversion_by_ext_out = ap_overlay_tables(a, new->ebcdicconversion_by_ext_out,
+ base->ebcdicconversion_by_ext_out);
+ conf->ebcdicconversion_by_type_in = ap_overlay_tables(a, new->ebcdicconversion_by_type_in,
+ base->ebcdicconversion_by_type_in);
+ conf->ebcdicconversion_by_type_out = ap_overlay_tables(a, new->ebcdicconversion_by_type_out,
+ base->ebcdicconversion_by_type_out);
+ conf->x_ascii_magic_kludge = new->x_ascii_magic_kludge ? new->x_ascii_magic_kludge : base->x_ascii_magic_kludge;
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ conf->ebcdicconversion_debug_header = new->ebcdicconversion_debug_header ? new->ebcdicconversion_debug_header : base->ebcdicconversion_debug_header;
+#endif
+#endif /* CHARSET_EBCDIC */
+
return (void*)conf;
}
}
#endif
+
+#ifdef CHARSET_EBCDIC
+
+typedef struct {
+ char conv_out[2];
+ char conv_in[2];
+} parsed_conf_t;
+
+/* Check for conversion syntax: { On | Off } [ = { In | Out | InOut } ] */
+static parsed_conf_t *
+parse_on_off_in_out(pool *p, char *arg)
+{
+ static parsed_conf_t ret = { { conv_Unset, '\0' }, { conv_Unset, '\0' } };
+ char *onoff = ap_getword_nc(p, &arg, '=');
+ int in = 0, out = 0, inout = 0;
+ char conv_val;
+
+ /* Check for valid syntax: { On | Off } [ = { In | Out | InOut } ] */
+ if (strcasecmp(onoff, "On") == 0)
+ conv_val = conv_On;
+ else if (strcasecmp(onoff, "Off") == 0)
+ conv_val = conv_Off;
+ else
+ return NULL;
+
+ /* Check the syntax, and at the same time assign the test results */
+ if (!(inout = (*arg == '\0')) &&
+ !(in = (strcasecmp(arg, "In") == 0)) &&
+ !(out = (strcasecmp(arg, "Out") == 0)) &&
+ !(inout = (strcasecmp(arg, "InOut") == 0))) {
+ /* Invalid string, not conforming to syntax! */
+ return NULL;
+ }
+
+ ret.conv_in[0] = (in || inout) ? conv_val : conv_Unset;
+ ret.conv_out[0] = (out || inout) ? conv_val : conv_Unset;
+
+ return &ret;
+}
+
+
+/* Handle the EBCDICConvert directive:
+ * EBCDICConvert {On|Off}[={In|Out|InOut}] ext ...
+ */
+static const char *
+add_conversion_by_ext(cmd_parms *cmd, core_dir_config *m,
+ char *onoff, char *ext)
+{
+ parsed_conf_t *onoff_code = parse_on_off_in_out(cmd->pool, onoff);
+
+ if (onoff_code == NULL)
+ return "Invalid syntax: use EBCDICConvert {On|Off}[={In|Out|InOut}] ext [...]";
+
+ if (*ext == '.')
+ ++ext;
+
+ if (*onoff_code->conv_in != conv_Unset)
+ ap_table_addn(m->ebcdicconversion_by_ext_in, ext,
+ ap_pstrndup(cmd->pool, onoff_code->conv_in, 1));
+ if (*onoff_code->conv_out != conv_Unset)
+ ap_table_addn(m->ebcdicconversion_by_ext_out, ext,
+ ap_pstrndup(cmd->pool, onoff_code->conv_out, 1));
+
+ return NULL;
+}
+
+
+/* Handle the EBCDICConvertByType directive:
+ * EBCDICConvertByType {On|Off}[={In|Out|InOut}] mimetype ...
+ */
+static const char *
+add_conversion_by_type(cmd_parms *cmd, core_dir_config *m,
+ char *onoff, char *type)
+{
+ parsed_conf_t *onoff_code = parse_on_off_in_out(cmd->pool, onoff);
+
+ if (onoff_code == NULL)
+ return "Invalid syntax: use EBCDICConvertByType {On|Off}[={In|Out|InOut}] mimetype [...]";
+
+ if (*onoff_code->conv_in != conv_Unset)
+ ap_table_addn(m->ebcdicconversion_by_type_in, type,
+ ap_pstrndup(cmd->pool, onoff_code->conv_in, 1));
+ if (*onoff_code->conv_out != conv_Unset)
+ ap_table_addn(m->ebcdicconversion_by_type_out, type,
+ ap_pstrndup(cmd->pool, onoff_code->conv_out, 1));
+
+ return NULL;
+}
+
+
+/* Handle the EBCDICKludge directive:
+ * EBCDICKludge {On|Off}
+ */
+#ifdef LEGACY_KLUDGE
+static const char *
+set_x_ascii_kludge(cmd_parms *cmd, core_dir_config *m, int arg)
+{
+ m->x_ascii_magic_kludge = arg;
+
+ return NULL;
+}
+#endif
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+/* Handle the EBCDICDebugHeader directive:
+ * EBCDICDebugHeader {On|Off}
+ */
+static const char *
+set_debug_header(cmd_parms *cmd, core_dir_config *m, int arg)
+{
+ m->ebcdicconversion_debug_header = arg;
+
+ return NULL;
+}
+#endif
+#endif /* CHARSET_EBCDIC */
+
/* Note --- ErrorDocument will now work from .htaccess files.
* The AllowOverride of Fileinfo allows webmasters to turn it off
*/
(void*)XtOffsetOf(core_dir_config, limit_req_body),
OR_ALL, TAKE1,
"Limit (in bytes) on maximum size of request message body" },
+
+/* EBCDIC Conversion directives: */
+#ifdef CHARSET_EBCDIC
+{ "EBCDICConvert", add_conversion_by_ext, NULL, OR_FILEINFO, ITERATE2,
+ "{On|Off}[={In|Out|InOut}] followed by one or more file extensions" },
+{ "EBCDICConvertByType", add_conversion_by_type, NULL, OR_FILEINFO, ITERATE2,
+ "{On|Off}[={In|Out|InOut}] followed by one or more MIME types" },
+#ifdef LEGACY_KLUDGE
+{ "EBCDICKludge", set_x_ascii_kludge, NULL, OR_FILEINFO, FLAG,
+ "'On': enable or default='Off': disable the old text/x-ascii-mimetype kludge" },
+#endif
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+{ "EBCDICDebugHeader", set_debug_header, NULL, OR_FILEINFO, FLAG,
+ "'On': enable or default='Off': disable the EBCDIC Debugging MIME Header" },
+#endif
+#endif /* CHARSET_EBCDIC */
+
{ NULL }
};
static int do_nothing(request_rec *r) { return OK; }
+#ifdef CHARSET_EBCDIC
+struct do_mime_match_parms {
+ request_rec *request; /* [In] current request_rec */
+ int direction; /* [In] determine conversion for: dir_In|dir_Out */
+ const char *content_type; /* [In] Content-Type (dir_In: from MIME Header, else r->content_type) */
+ int match_found; /* [Out] nonzero if a match was found */
+ int conv; /* [Out] conversion setting if match was found */
+};
+
+
+/* This routine is called for each mime type configured by the
+ * EBCDICConvertByType directive.
+ */
+static int
+do_mime_match(void *rec, const char *key, const char *val)
+{
+ int conv = (val[0] == conv_On);
+ const char *content_type;
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ request_rec *r = ((struct do_mime_match_parms *) rec)->request;
+#endif
+
+ ((struct do_mime_match_parms *) rec)->match_found = 0;
+ ((struct do_mime_match_parms *) rec)->conv = conv_Unset;
+
+ content_type = ((struct do_mime_match_parms *) rec)->content_type;
+
+ /* If no type set: no need to continue */
+ if (content_type == NULL)
+ return 0;
+
+ /* If the MIME type matches, set the conversion flag appropriately */
+ if ((ap_is_matchexp(key) && ap_strcasecmp_match(content_type, key) == 0)
+ || (strcasecmp(key, content_type) == 0)) {
+
+ ((struct do_mime_match_parms *) rec)->match_found = 1;
+ ((struct do_mime_match_parms *) rec)->conv = conv;
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ ap_table_setn(r->headers_out,
+ ((((struct do_mime_match_parms *) rec)->direction) == dir_In)
+ ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out",
+ ap_psprintf(r->pool, "EBCDICConversionByType %s %s",
+ conv ? "On" : "Off",
+ key));
+#endif
+
+ /* the mime type scan stops at the first match. */
+ return 0;
+ }
+
+ return 1;
+}
+
+static void
+ap_checkconv_dir(request_rec *r, const char **pType, int dir)
+{
+ core_dir_config *conf =
+ (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module);
+ table *conv_by_ext, *conv_by_type;
+ const char *type, *conversion;
+ char *ext;
+ int conv_valid = 0, conv;
+
+ conv_by_ext = (dir == dir_In) ? conf->ebcdicconversion_by_ext_in : conf->ebcdicconversion_by_ext_out;
+ conv_by_type = (dir == dir_In) ? conf->ebcdicconversion_by_type_in : conf->ebcdicconversion_by_type_out;
+
+ type = (*pType == NULL) ? ap_default_type(r) : *pType;
+
+ /* Pseudo "loop" which is executed once only, with break's at individual steps */
+ do {
+ /* Step 0: directories result in redirections or in directory listings.
+ * Both are EBCDIC text documents.
+ * @@@ Should we check for the handler instead?
+ */
+ if (S_ISDIR(r->finfo.st_mode) && dir == dir_Out) {
+ conv = conv_valid = 1;
+ break;
+ }
+
+ /* 1st step: check the binding on file extension. This allows us to
+ * override the conversion default based on a specific name.
+ * For instance, the following would allow some HTML files
+ * to be converted (.html) and others passed unconverted (.ahtml):
+ * AddType text/html .html .ahtml
+ * EBCDICConvert Off .ahtml
+ * For uploads, this assumes that the destination file name
+ * has the correct extension. That may not be true for, e.g.,
+ * Netscape Communicator roaming profile uploads!
+ */
+ if (r->filename && !ap_is_empty_table(conv_by_ext)) {
+ const char *fn = strrchr(r->filename, '/');
+
+ if (fn == NULL)
+ fn = r->filename;
+
+ /* Parse filename extension */
+ if ((ext = strrchr(fn, '.')) != NULL) {
+ ++ext;
+
+ /* Check for Content-Type */
+ if ((conversion = ap_table_get(conv_by_ext, ext)) != NULL) {
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ if (conf->ebcdicconversion_debug_header)
+ ap_table_setn(r->headers_out,
+ (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out",
+ ap_psprintf(r->pool, "EBCDICConversion %s .%s",
+ (conversion[0] == conv_On) ? "On" : "Off",
+ ext));
+#endif
+
+ conv = (conversion[0] == conv_On);
+ conv_valid = 1;
+ break;
+ }
+ }
+ }
+
+
+ /* 2nd step: test for the old "legacy kludge", that is, a default
+ * conversion=on for text/?* message/?* multipart/?* and the possibility
+ * to override the text/?* conversion with a definition like
+ * AddType text/x-ascii-plain .atxt
+ * AddType text/x-ascii-html .ahtml
+ * where the "x-ascii-" would be removed and the conversion switched
+ * off.
+ * This step must be performed prior to testing wildcard MIME types
+ * like text/?* by the EBCDICConvertByType directive.
+ */
+#ifdef LEGACY_KLUDGE
+ /* This fallback is only used when enabled (default=off) */
+ if (conf->x_ascii_magic_kludge) {
+ char *magic;
+
+ /* If the mime type of a document is set to
+ * "text/x-ascii-anything", it gets changed to
+ * "text/anything" here and the conversion is forced to off
+ * ("binary" or ASCII documents).
+ */
+ if (*pType != NULL
+ && (magic = strstr(*pType, "/x-ascii-")) != NULL) {
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ if (conf->ebcdicconversion_debug_header)
+ ap_table_setn(r->headers_out,
+ (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out",
+ ap_psprintf(r->pool, "EBCDICKludge On (and type is: %s, thus no conversion)",
+ *pType));
+#endif
+
+ /* the mime type scan stops at the first match. */
+ magic[1] = '\0'; /* overwrite 'x' */
+
+ /* Fix MIME type: strip out the magic "x-ascii-" substring */
+ *pType = ap_pstrcat(r->pool, *pType, &magic[9], NULL);
+
+ magic[1] = 'x'; /* restore 'x' in old string (just in case) */
+
+ /* Switch conversion to BINARY */
+ conv = 0; /* do NOT convert this document */
+ conv_valid = 1;
+ break;
+ }
+ }
+#endif /*LEGACY_KLUDGE */
+
+
+ /* 3rd step: check whether a generic conversion was defined for a MIME type,
+ * like in
+ * EBCDICConvertByType On model/vrml application/postscript text/?*
+ */
+ if (!ap_is_empty_table(conv_by_type)) {
+ struct do_mime_match_parms do_par;
+
+ do_par.request = r;
+ do_par.direction = dir;
+ do_par.content_type = type;
+
+ ap_table_do(do_mime_match, (void *) &do_par, conv_by_type, NULL);
+
+ if ((conv_valid = do_par.match_found) != 0) {
+ conv = do_par.conv;
+ break;
+ }
+ }
+ else /* If no conversion by type was configured, use the default: */
+ {
+ /*
+ * As a final step, mime types starting with "text/", "message/" or
+ * "multipart/" imply a conversion, while all the rest is
+ * delivered unconverted (i.e., binary, e.g. application/octet-stream).
+ */
+
+ /* If no content type is set then treat it as text (conversion=on) */
+ conv =
+ (type == NULL) ||
+ (strncasecmp(type, "text/", 5) == 0) ||
+ (strncasecmp(type, "message/", 8) == 0) ||
+ (strncasecmp(type, "multipart/", 10) == 0) ||
+ (strcasecmp(type, "application/x-www-form-urlencoded") == 0);
+
+#if ADD_EBCDICCONVERT_DEBUG_HEADER
+ if (conf->ebcdicconversion_debug_header)
+ ap_table_setn(r->headers_out,
+ (dir == dir_In) ? "X-EBCDIC-Debug-In" : "X-EBCDIC-Debug-Out",
+ ap_psprintf(r->pool,
+ "No EBCDICConversion configured (and type is: %s, "
+ "=> guessed conversion = %s)",
+ type, conv ? "On" : "Off"));
+#endif
+ conv_valid = 1;
+ break;
+ }
+ } while (0);
+
+ if (conv_valid) {
+ if (dir == dir_In)
+ r->ebcdic.conv_in = conv;
+ else
+ r->ebcdic.conv_out = conv;
+ }
+}
+
+/* This function determines the conversion for uploads (PUT/POST): */
+API_EXPORT(int)
+ap_checkconv_in(request_rec *r)
+{
+ const char *typep;
+
+ /* If nothing is being sent as input anyway, we don't bother about conversion */
+ /* (see ap_should_client_block())*/
+ if (r->read_length || (!r->read_chunked && (r->remaining <= 0)))
+ return r->ebcdic.conv_in;
+
+ typep = ap_table_get(r->headers_in, "Content-Type");
+ ap_checkconv_dir(r, &typep, dir_In);
+
+ return r->ebcdic.conv_in;
+}
+
+
+/* Backward compatibility function */
+API_EXPORT(int)
+ap_checkconv(request_rec *r)
+{
+ ap_checkconv_dir(r, &r->content_type, dir_Out);
+ return r->ebcdic.conv_out;
+}
+
+#endif /* CHARSET_EBCDIC */
+
+
#ifdef USE_MMAP_FILES
struct mmap_rec {
void *mm;
#ifdef USE_MMAP_FILES
caddr_t mm;
#endif
-#ifdef CHARSET_EBCDIC
- int convert_flag;
-#endif
/* This handler has no use for a request body (yet), but we still
* need to read and discard it if the client sent one.
return errstatus;
}
-#ifdef CHARSET_EBCDIC
- /* 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.
- *
- * Note: convert_flag is not used in the MMAP path;
- * ap_checkconv() sets a request_req flag based on content_type
- */
- convert_flag = ap_checkconv(r);
-#endif
#ifdef USE_MMAP_FILES
ap_block_alarms();
if ((r->finfo.st_size >= MMAP_THRESHOLD)
#ifdef CHARSET_EBCDIC
if (d->content_md5 & 1) {
ap_table_setn(r->headers_out, "Content-MD5",
- ap_md5digest(r->pool, f, convert_flag));
+ ap_md5digest(r->pool, f, r->ebcdic.conv_out));
}
#else
if (d->content_md5 & 1) {
#define POP_EBCDIC_INPUTCONVERSION_STATE(_buff) \
ap_bsetflag(_buff, B_ASCII2EBCDIC, _convert_in);
-#define PUSH_EBCDIC_OUTPUTCONVERSION_STATE(_buff, _onoff) \
- int _convert_out = ap_bgetflag(_buff, B_EBCDIC2ASCII); \
- ap_bsetflag(_buff, B_EBCDIC2ASCII, _onoff);
+#define PUSH_EBCDIC_INPUTCONVERSION_STATE_r(_req, _onoff) \
+ ap_bsetflag(_req->connection->client, B_ASCII2EBCDIC, _onoff);
-#define POP_EBCDIC_OUTPUTCONVERSION_STATE(_buff) \
- ap_bsetflag(_buff, B_EBCDIC2ASCII, _convert_out);
+#define POP_EBCDIC_INPUTCONVERSION_STATE_r(_req) \
+ ap_bsetflag(_req->connection->client, B_ASCII2EBCDIC, _req->ebcdic.conv_in);
+
+#define PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(_req, _onoff) \
+ ap_bsetflag(_req->connection->client, B_EBCDIC2ASCII, _onoff);
+
+#define POP_EBCDIC_OUTPUTCONVERSION_STATE_r(_req) \
+ ap_bsetflag(_req->connection->client, B_EBCDIC2ASCII, _req->ebcdic.conv_out);
#endif /*CHARSET_EBCDIC*/
* set to ON (protocol strings MUST be converted)
* and reset to original setting before returning
*/
- PUSH_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client, 1);
+ PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1);
#endif /*CHARSET_EBCDIC*/
if (start < 0 || end < 0) {
}
#ifdef CHARSET_EBCDIC
- POP_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client);
+ POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r);
#endif /*CHARSET_EBCDIC*/
return length;
r->the_request = NULL;
#ifdef CHARSET_EBCDIC
- ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1);
+ ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, r->ebcdic.conv_in = 1);
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
#endif
/* Get the request... */
return AUTH_REQUIRED;
}
- /* CHARSET_EBCDIC Issue's here ?!? Compare with 32/9 instead
- * as we are operating on an octed stream ?
+ /* No CHARSET_EBCDIC Issue here because the line has already
+ * been converted to native text.
*/
while (*auth_line== ' ' || *auth_line== '\t')
auth_line++;
protocol = SERVER_PROTOCOL;
#ifdef CHARSET_EBCDIC
- { PUSH_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client, 1);
+ PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1);
#endif /*CHARSET_EBCDIC*/
/* Output the HTTP/1.x Status-Line and the Date and Server fields */
ap_table_unset(r->headers_out, "Date"); /* Avoid bogosity */
ap_table_unset(r->headers_out, "Server");
#ifdef CHARSET_EBCDIC
- POP_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client); }
+ POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r);
#endif /*CHARSET_EBCDIC*/
}
r->content_type = "message/http";
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
/* Now we recreate the request, and echo it back */
int i;
const long int zero = 0L;
+#ifdef CHARSET_EBCDIC
+ /* Use previously determined conversion (output): */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, ap_checkconv(r));
+#endif /*CHARSET_EBCDIC*/
+
if (r->assbackwards) {
if (!r->main)
ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
ap_basic_http_header(r);
#ifdef CHARSET_EBCDIC
- { PUSH_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client, 1);
+ PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1);
#endif /*CHARSET_EBCDIC*/
ap_set_keepalive(r);
if (r->chunked)
ap_bsetflag(r->connection->client, B_CHUNK, 1);
#ifdef CHARSET_EBCDIC
- POP_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client); }
+ POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r);
#endif /*CHARSET_EBCDIC*/
}
{
if (r->chunked && !r->connection->aborted) {
#ifdef CHARSET_EBCDIC
- PUSH_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client, 1);
+ PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1);
#endif
/*
* Turn off chunked encoding --- we can only do this once.
ap_kill_timeout(r);
#ifdef CHARSET_EBCDIC
- POP_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client);
+ POP_EBCDIC_OUTPUTCONVERSION_STATE_r(r);
#endif /*CHARSET_EBCDIC*/
}
}
#ifdef CHARSET_EBCDIC
{
- /* @@@ Temporary kludge for guessing the conversion @@@
- * from looking at the MIME header.
+ /* Determine the EBCDIC conversion for the uploaded content
+ * by looking at the Content-Type MIME header.
* If no Content-Type header is found, text conversion is assumed.
*/
- const char *typep = ap_table_get(r->headers_in, "Content-Type");
- int convert_in = (typep == NULL ||
- strncasecmp(typep, "text/", 5) == 0 ||
- strncasecmp(typep, "message/", 8) == 0 ||
- strncasecmp(typep, "multipart/", 10) == 0 ||
- strcasecmp (typep, "application/x-www-form-urlencoded") == 0
- );
- ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, convert_in);
+ ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, ap_checkconv_in(r));
}
#endif
while (ap_isxdigit(*b)) {
int xvalue = 0;
+ /* This works even on EBCDIC. */
if (*b >= '0' && *b <= '9')
xvalue = *b - '0';
else if (*b >= 'A' && *b <= 'F')
if (r->remaining == 0) { /* End of chunk, get trailing CRLF */
#ifdef CHARSET_EBCDIC
/* Chunk end is Protocol stuff! Set conversion = 1 to read CR LF: */
- PUSH_EBCDIC_INPUTCONVERSION_STATE(r->connection->client, 1);
+ PUSH_EBCDIC_INPUTCONVERSION_STATE_r(r, 1);
#endif /*CHARSET_EBCDIC*/
if ((c = ap_bgetc(r->connection->client)) == CR) {
#ifdef CHARSET_EBCDIC
/* restore ASCII->EBCDIC conversion state */
- POP_EBCDIC_INPUTCONVERSION_STATE(r->connection->client);
+ POP_EBCDIC_INPUTCONVERSION_STATE_r(r);
#endif /*CHARSET_EBCDIC*/
if (c != LF) {
int idx = ap_index_of_response(status);
char *custom_response;
const char *location = ap_table_get(r->headers_out, "Location");
+#ifdef CHARSET_EBCDIC
+ /* Error Responses (builtin / string literal / redirection) are TEXT! */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
/*
* It's possible that the Location field might be in r->err_headers_out
}
}
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
+
ap_hard_timeout("send error body", r);
if ((custom_response = ap_response_code_string(r, idx))) {
request_rec *rr = ap_pcalloc(rrp, sizeof(request_rec));
rr->pool = rrp;
+#ifdef CHARSET_EBCDIC
+ /* Assume virgin state (like after reading the request_line): */
+ ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, rr->ebcdic.conv_in = 1);
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, rr->ebcdic.conv_out = 1);
+#endif
return rr;
}
API_EXPORT(int) ap_run_sub_req(request_rec *r)
{
-#ifndef CHARSET_EBCDIC
int retval = ap_invoke_handler(r);
-#else /*CHARSET_EBCDIC*/
- /* Save the EBCDIC conversion setting of the caller across subrequests */
- int convert = ap_bgetflag(r->connection->client, B_EBCDIC2ASCII);
- int retval = ap_invoke_handler(r);
- ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert);
-#endif /*CHARSET_EBCDIC*/
ap_finalize_sub_req_protocol(r);
return retval;
}
API_EXPORT(void) ap_destroy_sub_req(request_rec *r)
{
+#ifdef CHARSET_EBCDIC
+ if (r->main) {
+ ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, r->main->ebcdic.conv_in);
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->main->ebcdic.conv_out);
+ }
+#endif
/* Reclaim the space */
ap_destroy_pool(r->pool);
}
new->no_local_copy = r->no_local_copy;
new->read_length = r->read_length; /* We can only read it once */
new->vlist_validator = r->vlist_validator;
+#ifdef CHARSET_EBCDIC /* @@@ Is this correct? When is it used? */
+ new->ebcdic.conv_out= r->ebcdic.conv_out;
+ new->ebcdic.conv_in = r->ebcdic.conv_in;
+#endif
ap_table_setn(new->subprocess_env, "REDIRECT_STATUS",
ap_psprintf(r->pool, "%d", r->status));
* is broken.
*/
r->content_type = "text/html";
+
ap_soft_timeout("send example call trace", r);
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
+
/*
* If we're only supposed to send header information (HEAD request), we're
* already there.
ap_table_setn(resp_hdrs, "Date", ap_gm_timestr_822(r->pool, r->request_time));
ap_table_setn(resp_hdrs, "Server", ap_get_server_version());
- if (parms[0] == 'd')
+ if (parms[0] == 'd') {
ap_table_setn(resp_hdrs, "Content-Type", "text/html");
+#ifdef CHARSET_EBCDIC
+ r->ebcdic.conv_out = 1; /* server-generated */
+#endif
+ }
else {
+#ifdef CHARSET_EBCDIC
+ r->ebcdic.conv_out = 0; /* do not convert what we read from the ftp server */
+#endif
if (r->content_type != NULL) {
ap_table_setn(resp_hdrs, "Content-Type", r->content_type);
Explain1("FTP: Content-Type set to %s", r->content_type);
ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
r->sent_bodyct = 1;
+#ifdef CHARSET_EBCDIC
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out);
+#endif
/* send body */
if (!r->header_only) {
if (parms[0] != 'd') {
}
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
+
if (r->header_only) {
ap_pclosedir(r->pool, d);
return 0;
#endif /* TPF */
#ifdef CHARSET_EBCDIC
- /* XXX:@@@ Is the generated/included output ALWAYS in text/ebcdic format? */
- /* Or must we check the Content-Type first? */
- ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, 1);
+ /* The included MIME headers must ALWAYS be in text/ebcdic format.
+ * Only after reading the MIME headers, we check the Content-Type
+ * and switch to the necessary conversion mode.
+ * Until then (and in case an nph- script was called), use the
+ * configured default conversion:
+ */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out);
#endif /*CHARSET_EBCDIC*/
/*
return log_script(r, conf, ret, dbuf, sbuf, script_in, script_err);
}
-#ifdef CHARSET_EBCDIC
- /* Now check the Content-Type to decide if conversion is needed */
- ap_checkconv(r);
-#endif /*CHARSET_EBCDIC*/
-
location = ap_table_get(r->headers_out, "Location");
if (location && location[0] == '/' && r->status == 200) {
{
r->content_type = "text/html";
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
ap_hard_timeout("send menu", r); /* killed in menu_footer */
ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ", r->uri,
if (r->header_only) {
return 0;
}
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
ap_hard_timeout("send server info", r);
ap_rputs(DOCTYPE_HTML_3_2
}
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
if (r->header_only)
return 0;
r->content_type = "text/html";
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
if(r->header_only) {
return 0;
}
r->content_type = "text/html";
ap_send_http_header(r);
+#ifdef CHARSET_EBCDIC
+ /* Server-generated response, converted */
+ ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, r->ebcdic.conv_out = 1);
+#endif
if(r->header_only) {
return 0;
}
INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
-OBJS= os.o os-inline.o ebcdic.o bs2login.o
+OBJS= os.o os-inline.o bs2login.o
LIB= libos.a
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-
-#ifdef CHARSET_EBCDIC
-#include "ap_config.h"
-#include "ebcdic.h"
-/*
- Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
-
-"BS2000 OSD/POSIX" is a POSIX subsystem on a main frame. It is made
-by Fujitsu-Siemens Computers GmbH, Germany. The POSIX system has been
-derived from a regular SVR4 source and thus is very "compatible"
-to other unixes. In fact, it received the X/Open branding.
-
-Within the POSIX subsystem, the same character set was chosen as in
-"native BS2000", namely EBCDIC. This requires conversions at various
-stages of the request and response processing.
-
-EBCDIC Table. (In EBCDIC, the letters 'a'..'z' are not contiguous!)
-This table is bijective, i.e. there are no ambigous or duplicate characters
-*/
-
-/* Bijective ebcdic-to-ascii table: */
-const unsigned char os_toascii[256] = {
-/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
- 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
-/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
- 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
-/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
-/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
- 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
-/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
- 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
-/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
- 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
-/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
- 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
-/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
- 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
-/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
-/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
-/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
-/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
- 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
-/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
-/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
- 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
-/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
-/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
-};
-
-
-/* Bijective ascii-to-ebcdic table: */
-const unsigned char os_toebcdic[256] = {
-/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
- 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
-/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
- 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
-/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
- 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
-/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
-/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
-/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
- 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
-/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
-/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
- 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
-/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
-/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
- 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
-/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
- 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
-/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
- 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
-/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
- 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
-/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
- 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
-/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
- 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
-/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
- 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
-};
-
-/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
- * dest and srce may be identical, or separate memory blocks, but
- * should not overlap. These functions intentionally have an interface
- * compatible to memcpy(3).
- */
-
-void *
-ebcdic2ascii(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
-
- while (count-- != 0) {
- *udest++ = os_toascii[*usrce++];
- }
-
- return dest;
-}
-
-void *
-ascii2ebcdic(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
-
- while (count-- != 0) {
- *udest++ = os_toebcdic[*usrce++];
- }
-
- return dest;
-}
-#endif /*CHARSET_EBCDIC*/
-#ifndef AP_EBCDIC_H
-#define AP_EBCDIC_H "$Id: ebcdic.h,v 1.8 2000/06/21 14:36:32 martin Exp $"
+#ifndef EBCDIC_H
+#define EBCDIC_H "$Id: ebcdic.h,v 1.9 2001/03/09 10:10:40 martin Exp $"
-#include <sys/types.h>
+#include <ap_ebcdic.h>
-extern const unsigned char os_toascii[256];
-extern const unsigned char os_toebcdic[256];
-API_EXPORT(void *) ebcdic2ascii(void *dest, const void *srce, size_t count);
-API_EXPORT(void *) ascii2ebcdic(void *dest, const void *srce, size_t count);
-
-#endif /*AP_EBCDIC_H*/
+#endif /*EBCDIC_H*/
#include "http_core.h"
#include "os.h"
-/* Check the Content-Type to decide if conversion is needed */
-int ap_checkconv(struct request_rec *r)
-{
- int convert_to_ascii;
- const char *type;
-
- /* 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 ||
- strncasecmp(type, "multipart/", 10) == 0)) {
- if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX,
- sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0)
- r->content_type = ap_pstrcat(r->pool, "text/",
- type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1,
- NULL);
- else
- /* translate EBCDIC to ASCII */
- convert_to_ascii = 1;
- }
- /* Enable conversion if it's a text document */
- ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
-
- return convert_to_ascii;
-}
-
#ifdef HAVE_DLFCN_H
#include "../unix/os.c"
#endif
extern int _rini(_rini_struct *);
#endif /* !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) */
-/* Sorry if this is ugly, but the include order doesn't allow me
- * to use request_rec here... */
-struct request_rec;
-extern int ap_checkconv(struct request_rec *r);
extern pid_t os_fork(const char *user);
+#ifdef _OSD_POSIX
+struct pool;
+extern const char *os_set_account(struct pool *p, const char *account);
+struct server_rec;
+extern int os_init_job_environment(struct server_rec *s, const char *user_name, int one_process);
+#endif
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#define ap_os_dso_handle_t void *
+void ap_os_dso_init(void);
+void * ap_os_dso_load(const char *);
+void ap_os_dso_unload(void *);
+void * ap_os_dso_sym(void *, const char *);
+const char *ap_os_dso_error(void);
+#endif
#endif /*! APACHE_OS_H*/
INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
-OBJS= os.o os-inline.o ebcdic.o
+OBJS= os.o os-inline.o
LIB= libos.a
# DO NOT REMOVE
-ebcdic.o: ebcdic.c
-ebcdic.o: $(INCDIR)/ap_config.h
-ebcdic.o: $(INCDIR)/ap_mmn.h
-ebcdic.o: $(INCDIR)/ap_config_auto.h
-ebcdic.o: os.h
-ebcdic.o: $(INCDIR)/ap_ctype.h
-ebcdic.o: $(INCDIR)/hsregex.h
-ebcdic.o: ebcdic.h
os-inline.o: os-inline.c
os-inline.o: $(INCDIR)/ap_config.h
os-inline.o: $(INCDIR)/ap_mmn.h
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-
-#ifdef CHARSET_EBCDIC
-#include "ap_config.h"
-#include "ebcdic.h"
-/*
-This code does basic character mapping for IBM's OS/390 Unix
-System Services operating system. It is a modified version
-of <Martin.Kraemer@Mch.SNI.De>'s code for the BS2000
-(apache/src/os/bs2000/ebcdic.c).
-*/
-
-/*
-Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
-This table is bijective - there are no ambigous or duplicate characters.
-*/
-const unsigned char os_toascii[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
- 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
- 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
- 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
- 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
- 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
- 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
- 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
- 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
- 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
- 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
- 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
- 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
- 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
- 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
- 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
- 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
- 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
- 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
- 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
- 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
- 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
- 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
- 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
- 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
- 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
- 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
- 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
- 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
-};
-
-
-/*
-The US-ASCII to EBCDIC (character set IBM-1047) table:
-This table is bijective (no ambiguous or duplicate characters)
-*/
-const unsigned char os_toebcdic[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
- 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
- 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
- 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
- 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
- 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
- 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
- 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
- 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
- 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
- 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
- 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
- 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
- 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
- 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
- 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
- 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
- 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
- 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
- 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
- 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
- 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
- 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
- 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
- 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
- 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
- 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
- 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
- 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
-};
-
-/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
- * dest and srce may be identical, or separate memory blocks, but
- * should not overlap.
- */
-void
-ebcdic2ascii(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
- while (count-- != 0) {
- *udest++ = os_toascii[*usrce++];
- }
-}
-
-void
-ascii2ebcdic(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
-
- while (count-- != 0) {
- *udest++ = os_toebcdic[*usrce++];
- }
-}
-#endif /*CHARSET_EBCDIC*/
-
-#include <sys/types.h>
+#ifndef EBCDIC_H
+#define EBCDIC_H "$Id: ebcdic.h,v 1.4 2001/03/09 10:10:45 martin Exp $"
-extern const unsigned char os_toascii[256];
-extern const unsigned char os_toebcdic[256];
-void ebcdic2ascii(void *dest, const void *srce, size_t count);
-void ascii2ebcdic(void *dest, const void *srce, size_t count);
+#include <ap_ebcdic.h>
+
+#endif /*EBCDIC_H*/
#include "http_core.h"
#include "os.h"
-/* Check the Content-Type to decide if conversion is needed */
-int ap_checkconv(struct request_rec *r)
-{
- int convert_to_ascii;
- const char *type;
-
- /* 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 = ap_pstrcat(r->pool, "text/",
- type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1,
- NULL);
- else
- /* translate EBCDIC to ASCII */
- convert_to_ascii = 1;
- }
- /* Enable conversion if it's a text document */
- ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
-
- return convert_to_ascii;
-}
-
#define ap_os_is_filename_valid(f) (1)
#define ap_os_kill(pid, sig) kill(pid, sig)
-/* Sorry if this is ugly, but the include order doesn't allow me
- * to use request_rec here... */
-struct request_rec;
-extern int ap_checkconv(struct request_rec *r);
-
#endif /*! APACHE_OS_H*/
INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
-OBJS= os.o os-inline.o ebcdic.o cgetop.o
+OBJS= os.o os-inline.o cgetop.o
LIB= libos.a
$(OBJS): Makefile
os.o: os.c os-inline.c $(INCDIR)/ap_config.h
-ebcdic.o: ebcdic.c
cgetop.o: cgetop.c
# DO NOT REMOVE
os.o: os.c
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-
-#ifdef CHARSET_EBCDIC
-#include "ap_config.h"
-#include "ebcdic.h"
-/*
-This code does basic character mapping for IBM's TPF operating system.
-It is a modified version of <Martin.Kraemer@Mch.SNI.De>'s code for
-the BS2000 (apache/src/os/bs2000/ebcdic.c).
-*/
-
-/*
-Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
-This table is bijective - there are no ambigous or duplicate characters.
-*/
-const unsigned char os_toascii[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
- 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
- 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
- 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
- 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
- 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
- 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
- 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
- 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
- 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
- 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
- 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
- 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
- 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
- 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
- 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
- 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
- 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
- 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
- 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
- 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
- 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
- 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
- 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
- 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
- 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
- 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
- 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
- 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
-};
-
-/*
-The US-ASCII to EBCDIC (character set IBM-1047) table:
-This table is bijective (no ambiguous or duplicate characters)
-*/
-const unsigned char os_toebcdic[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
- 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
- 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
- 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
- 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
- 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
- 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
- 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
- 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
- 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
- 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
- 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
- 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
- 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
- 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
- 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
- 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
- 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
- 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
- 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
- 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
- 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
- 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
- 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
- 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
- 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
- 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
- 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
- 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
-};
-
-/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
- * dest and srce may be identical, or separate memory blocks, but
- * should not overlap.
- */
-void
-ebcdic2ascii(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
- while (count-- != 0) {
- *udest++ = os_toascii[*usrce++];
- }
-}
-void
-ascii2ebcdic(void *dest, const void *srce, size_t count)
-{
- unsigned char *udest = dest;
- const unsigned char *usrce = srce;
-
- while (count-- != 0) {
- *udest++ = os_toebcdic[*usrce++];
- }
-}
-#endif /*CHARSET_EBCDIC*/
-
-#include <sys/types.h>
+#ifndef EBCDIC_H
+#define EBCDIC_H "$Id: ebcdic.h,v 1.3 2001/03/09 10:10:50 martin Exp $"
-extern const unsigned char os_toascii[256];
-extern const unsigned char os_toebcdic[256];
-void ebcdic2ascii(void *dest, const void *srce, size_t count);
-void ascii2ebcdic(void *dest, const void *srce, size_t count);
+#include <ap_ebcdic.h>
+#endif /*EBCDIC_H*/
static FILE *sock_fp;
-/* Check the Content-Type to decide if conversion is needed */
-int ap_checkconv(struct request_rec *r)
-{
- int convert_to_ascii;
- const char *type;
-
- /* 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 = ap_pstrcat(r->pool, "text/",
- type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1, NULL);
- if (r->method_number == M_PUT)
- ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0);
- }
-
- else
- /* translate EBCDIC to ASCII */
- convert_to_ascii = 1;
- }
- else{
- if (r->method_number == M_PUT)
- ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0);
- /* don't translate non-text files to EBCDIC */
- }
- /* Enable conversion if it's a text document */
- ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
-
- return convert_to_ascii;
-}
-
int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, struct timeval *tv)
{
/* We're going to force our way through select. We're only interested reads and TPF allows
#define ap_os_is_filename_valid(f) (1)
#define ap_os_kill(pid, sig) kill(pid, sig)
-/* Sorry if this is ugly, but the include order doesn't allow me
- * to use request_rec here... */
-struct request_rec;
-extern int ap_checkconv(struct request_rec *r);
-
#include <strings.h>
#ifndef __strings_h
#include "ap_config.h"
#include "ap.h"
#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
+#include "ap_ebcdic.h"
#endif
#include <fcntl.h>
#ifndef MPE
static void copyright(void)
{
if (!use_html) {
- printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.44 $> apache-1.3");
+ printf("This is ApacheBench, Version %s\n", VERSION " <$Revision: 1.45 $> apache-1.3");
printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/\n");
printf("\n");
}
else {
printf("<p>\n");
- printf(" This is ApacheBench, Version %s <i><%s></i> apache-1.3<br>\n", VERSION, "$Revision: 1.44 $");
+ printf(" This is ApacheBench, Version %s <i><%s></i> apache-1.3<br>\n", VERSION, "$Revision: 1.45 $");
printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Copyright (c) 1998-2000 The Apache Group, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n");