📄 ebcdic.html
字号:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="Apache, 中文, 手册, 中文版, 中文手册, 中文版手册, 参考手册, 中文参考手册, 金步国" />
<meta name="description" content="Apache 2.2 中文版参考手册" />
<meta name="author" content="金步国" />
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<title>The Apache EBCDIC Port - Apache 2.2 中文版参考手册</title>
</head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="../mod/index.html">模块索引</a> | <a href="../mod/directives.html">指令索引</a> | <a href="../faq/index.html">常见问题</a> | <a href="../glossary.html">词汇表</a> | <a href="../sitemap.html">站点导航</a></p><p class="apache">Apache HTTP Server 版本2.2</p><img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./index.html"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">文档</a> > <a href="../index.html">版本2.2</a> > <a href="./index.html">针对特定平台的说明</a></div>
<div id="translation-info"> <a href="../translator_announcement.html#thanks">致谢</a> | <a href="../translator_announcement.html#announcement">译者声明</a> | 本篇译者:<<a href="../translator_announcement.html#join">虚位以待</a>> | 本篇译稿完成时间:?年?月?日 | <a href="../translator_announcement.html#last_new">获取最新版本</a></div>
<div id="page-content"><div id="preamble"><h1>The Apache EBCDIC Port</h1>
<div class="warning"><strong>Warning:</strong> This document
has not been updated to take into account changes made in
the 2.0 version of the Apache HTTP Server. Some of the
information may still be relevant, but please use it with care.
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="overview" id="overview">Overview of the Apache EBCDIC Port</a></h2>
<p>Version 1.3 of the Apache HTTP Server is the first version
which includes a port to a (non-ASCII) mainframe machine which
uses the EBCDIC character set as its native codeset.</p>
<p>(It is the SIEMENS family of mainframes running the <a href="http://www.siemens.de/servers/bs2osd/osdbc_us.htm">BS2000/OSD
operating system</a>. This mainframe OS nowadays features a
SVR4-derived POSIX subsystem).</p>
<p>The port was started initially to</p>
<ul>
<li>prove the feasibility of porting <a href="http://dev.apache.org/">the Apache HTTP server</a> to
this platform</li>
<li>find a "worthy and capable" successor for the venerable
<a href="http://www.w3.org/Daemon/">CERN-3.0</a> daemon
(which was ported a couple of years ago), and to</li>
<li>prove that Apache's preforking process model can on this
platform easily outperform the accept-fork-serve model used
by CERN by a factor of 5 or more.</li>
</ul>
<p>This document serves as a rationale to describe some of the
design decisions of the port to this machine.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="design" id="design">Design Goals</a></h2>
<p>One objective of the EBCDIC port was to maintain enough
backwards compatibility with the (EBCDIC) CERN server to make
the transition to the new server attractive and easy. This
required the addition of a configurable method to define
whether a HTML document was stored in ASCII (the only format
accepted by the old server) or in EBCDIC (the native document
format in the POSIX subsystem, and therefore the only realistic
format in which the other POSIX tools like <code>grep</code>或<code>sed</code> could operate on the documents). The current
solution to this is a "pseudo-MIME-format" which is intercepted
and interpreted by the Apache server (see below). Future versions
might solve the problem by defining an "ebcdic-handler" for all
documents which must be converted.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="technical" id="technical">Technical Solution</a></h2>
<p>Since all Apache input and output is based upon the BUFF
data type and its methods, the easiest solution was to add the
conversion to the BUFF handling routines. The conversion must
be settable at any time, so a BUFF flag was added which defines
whether a BUFF object has currently enabled conversion or not.
This flag is modified at several points in the HTTP
protocol:</p>
<ul>
<li><strong>set</strong> before a request is received
(because the request and the request header lines are always
in ASCII format)</li>
<li><strong>set/unset</strong> when the request body is
received - depending on the content type of the request body
(because the request body may contain ASCII text or a binary
file)</li>
<li><strong>set</strong> before a reply header is sent
(because the response header lines are always in ASCII
format)</li>
<li><strong>set/unset</strong> when the response body is sent
- depending on the content type of the response body (because
the response body may contain text or a binary file)</li>
</ul>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="porting" id="porting">Porting Notes</a></h2>
<ol>
<li>
<p>The relevant changes in the source are <code>#ifdef</code>'ed
into two categories:</p>
<dl>
<dt><code><strong>#ifdef
CHARSET_EBCDIC</strong></code></dt>
<dd>
<p>Code which is needed for any EBCDIC based machine.
This includes character translations, differences in
contiguity of the two character sets, flags which
indicate which part of the HTTP protocol has to be
converted and which part doesn't <em>etc.</em></p>
</dd>
<dt><code><strong>#ifdef _OSD_POSIX</strong></code></dt>
<dd>
<p>Code which is needed for the SIEMENS BS2000/OSD
mainframe platform only. This deals with include file
differences and socket implementation topics which are
only required on the BS2000/OSD platform.</p>
</dd>
</dl>
</li>
<li>
<p>The possibility to translate between ASCII and EBCDIC at
the socket level (on BS2000 POSIX, there is a socket option
which supports this) was intentionally <em>not</em> chosen,
because the byte stream at the HTTP protocol level consists
of a mixture of protocol related strings and non-protocol
related raw file data. HTTP protocol strings are always
encoded in ASCII (the <code>GET</code> request, any Header: lines,
the chunking information <em>etc.</em>) whereas the file transfer
parts (<em>i.e.</em>, GIF images, CGI output <em>etc.</em>)
should usually be just "passed through" by the server. This
separation between "protocol string" and "raw data" is
reflected in the server code by functions like <code>bgets()</code>或<code>rvputs()</code> for strings, and functions like
<code>bwrite()</code> for binary data. A global translation
of everything would therefore be inadequate.</p>
<p>(In the case of text files of course, provisions must be
made so that EBCDIC documents are always served in
ASCII)</p>
</li>
<li>
<p>This port therefore features a built-in protocol level
conversion for the server-internal strings (which the
compiler translated to EBCDIC strings) and thus for all
server-generated documents. The hard coded ASCII escapes
<code>\012</code>和<code>\015</code> which are ubiquitous
in the server code are an exception: they are already the binary
encoding of the ASCII <code>\n</code>和<code>\r</code> and
must not be converted to ASCII a second time.
This exception is only relevant for server-generated strings;
and <em>external</em> EBCDIC documents are not expected to
contain ASCII newline characters.</p>
</li>
<li>
<p>By examining the call hierarchy for the BUFF management
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -