home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 May / Gamestar_62_2004-05_dvd.iso / Programy / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252840_ebcdic.xml < prev    next >
Extensible Markup Language  |  2003-05-09  |  18KB  |  562 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
  3. <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
  4.  
  5. <manualpage metafile="ebcdic.xml.meta">
  6.   <parentdocument href="./">Platform Specific Notes</parentdocument>
  7.  
  8.   <title>The Apache EBCDIC Port</title>
  9.  
  10.   <summary>
  11.  
  12.     <note type="warning"><strong>Warning:</strong> This document
  13.     has not been updated to take into account changes made in
  14.     the 2.0 version of the Apache HTTP Server. Some of the
  15.     information may still be relevant, but please use it with care.
  16.     </note>
  17.  
  18.   </summary>
  19.  
  20.   <section id="overview">
  21.  
  22.     <title>Overview of the Apache EBCDIC Port</title>
  23.  
  24.     <p>Version 1.3 of the Apache HTTP Server is the first version
  25.     which includes a port to a (non-ASCII) mainframe machine which
  26.     uses the EBCDIC character set as its native codeset.</p>
  27.  
  28.     <p>(It is the SIEMENS family of mainframes running the <a
  29.     href="http://www.siemens.de/servers/bs2osd/osdbc_us.htm">BS2000/OSD
  30.     operating system</a>. This mainframe OS nowadays features a
  31.     SVR4-derived POSIX subsystem).</p>
  32.  
  33.     <p>The port was started initially to</p>
  34.  
  35.     <ul>
  36.       <li>prove the feasibility of porting <a
  37.       href="http://dev.apache.org/">the Apache HTTP server</a> to
  38.       this platform</li>
  39.  
  40.       <li>find a "worthy and capable" successor for the venerable
  41.       <a href="http://www.w3.org/Daemon/">CERN-3.0</a> daemon
  42.       (which was ported a couple of years ago), and to</li>
  43.  
  44.       <li>prove that Apache's preforking process model can on this
  45.       platform easily outperform the accept-fork-serve model used
  46.       by CERN by a factor of 5 or more.</li>
  47.     </ul>
  48.  
  49.     <p>This document serves as a rationale to describe some of the
  50.     design decisions of the port to this machine.</p>
  51.  
  52.   </section>
  53.  
  54.   <section id="design">
  55.  
  56.     <title>Design Goals</title>
  57.  
  58.     <p>One objective of the EBCDIC port was to maintain enough
  59.     backwards compatibility with the (EBCDIC) CERN server to make
  60.     the transition to the new server attractive and easy. This
  61.     required the addition of a configurable method to define
  62.     whether a HTML document was stored in ASCII (the only format
  63.     accepted by the old server) or in EBCDIC (the native document
  64.     format in the POSIX subsystem, and therefore the only realistic
  65.     format in which the other POSIX tools like <code>grep</code> or
  66.     <code>sed</code> could operate on the documents). The current
  67.     solution to this is a "pseudo-MIME-format" which is intercepted
  68.     and interpreted by the Apache server (see below). Future versions
  69.     might solve the problem by defining an "ebcdic-handler" for all
  70.     documents which must be converted.</p>
  71.  
  72.   </section>
  73.  
  74.   <section id="technical">
  75.  
  76.     <title>Technical Solution</title>
  77.  
  78.     <p>Since all Apache input and output is based upon the BUFF
  79.     data type and its methods, the easiest solution was to add the
  80.     conversion to the BUFF handling routines. The conversion must
  81.     be settable at any time, so a BUFF flag was added which defines
  82.     whether a BUFF object has currently enabled conversion or not.
  83.     This flag is modified at several points in the HTTP
  84.     protocol:</p>
  85.  
  86.     <ul>
  87.       <li><strong>set</strong> before a request is received
  88.       (because the request and the request header lines are always
  89.       in ASCII format)</li>
  90.  
  91.       <li><strong>set/unset</strong> when the request body is
  92.       received - depending on the content type of the request body
  93.       (because the request body may contain ASCII text or a binary
  94.       file)</li>
  95.  
  96.       <li><strong>set</strong> before a reply header is sent
  97.       (because the response header lines are always in ASCII
  98.       format)</li>
  99.  
  100.       <li><strong>set/unset</strong> when the response body is sent
  101.       - depending on the content type of the response body (because
  102.       the response body may contain text or a binary file)</li>
  103.     </ul>
  104.  
  105.   </section>
  106.  
  107.   <section id="porting">
  108.  
  109.     <title>Porting Notes</title>
  110.  
  111.     <ol>
  112.       <li>
  113.         <p>The relevant changes in the source are <code>#ifdef</code>'ed
  114.         into two categories:</p>
  115.  
  116.         <dl>
  117.           <dt><code><strong>#ifdef
  118.           CHARSET_EBCDIC</strong></code></dt>
  119.  
  120.           <dd>
  121.             <p>Code which is needed for any EBCDIC based machine.
  122.             This includes character translations, differences in
  123.             contiguity of the two character sets, flags which
  124.             indicate which part of the HTTP protocol has to be
  125.             converted and which part doesn't <em>etc.</em></p>
  126.           </dd>
  127.  
  128.           <dt><code><strong>#ifdef _OSD_POSIX</strong></code></dt>
  129.  
  130.           <dd>
  131.             <p>Code which is needed for the SIEMENS BS2000/OSD
  132.             mainframe platform only. This deals with include file
  133.             differences and socket implementation topics which are
  134.             only required on the BS2000/OSD platform.</p>
  135.           </dd>
  136.         </dl>
  137.       </li>
  138.  
  139.       <li>
  140.         <p>The possibility to translate between ASCII and EBCDIC at
  141.         the socket level (on BS2000 POSIX, there is a socket option
  142.         which supports this) was intentionally <em>not</em> chosen,
  143.         because the byte stream at the HTTP protocol level consists
  144.         of a mixture of protocol related strings and non-protocol
  145.         related raw file data. HTTP protocol strings are always
  146.         encoded in ASCII (the <code>GET</code> request, any Header: lines,
  147.         the chunking information <em>etc.</em>) whereas the file transfer
  148.         parts (<em>i.e.</em>, GIF images, CGI output <em>etc.</em>)
  149.         should usually be just "passed through" by the server. This
  150.         separation between "protocol string" and "raw data" is
  151.         reflected in the server code by functions like <code>bgets()</code>
  152.         or <code>rvputs()</code> for strings, and functions like
  153.         <code>bwrite()</code> for binary data. A global translation
  154.         of everything would therefore be inadequate.</p>
  155.  
  156.         <p>(In the case of text files of course, provisions must be
  157.         made so that EBCDIC documents are always served in
  158.         ASCII)</p>
  159.       </li>
  160.  
  161.       <li>
  162.         <p>This port therefore features a built-in protocol level
  163.         conversion for the server-internal strings (which the
  164.         compiler translated to EBCDIC strings) and thus for all
  165.         server-generated documents. The hard coded ASCII escapes
  166.         <code>\012</code> and <code>\015</code> which are ubiquitous
  167.         in the server code are an exception: they are already the binary
  168.         encoding of the ASCII <code>\n</code> and <code>\r</code> and
  169.         must not be converted to ASCII a second time.
  170.         This exception is only relevant for server-generated strings;
  171.         and <em>external</em> EBCDIC documents are not expected to
  172.         contain ASCII newline characters.</p>
  173.       </li>
  174.  
  175.       <li>
  176.         <p>By examining the call hierarchy for the BUFF management
  177.         routines, I added an "ebcdic/ascii conversion layer" which
  178.         would be crossed on every puts/write/get/gets, and a
  179.         conversion flag which allowed enabling/disabling the
  180.         conversions on-the-fly. Usually, a document crosses this
  181.         layer twice from its origin source (a file or CGI output) to
  182.         its destination (the requesting client): <code>file ->
  183.         Apache</code>, and <code>Apache -> client</code>.</p>
  184.  
  185.         <p>The server can now read the header lines of a CGI-script
  186.         output in EBCDIC format, and then find out that the remainder
  187.         of the script's output is in ASCII (like in the case of the
  188.         output of a WWW Counter program: the document body contains a
  189.         GIF image). All header processing is done in the native
  190.         EBCDIC format; the server then determines, based on the type
  191.         of document being served, whether the document body (except
  192.         for the chunking information, of course) is in ASCII already
  193.         or must be converted from EBCDIC.</p>
  194.       </li>
  195.  
  196.       <li>
  197.         <p>For Text documents (MIME types text/plain, text/html
  198.         <em>etc.</em>), an implicit translation to ASCII can be
  199.         used, or (if the users prefer to store some documents in
  200.         raw ASCII form for faster serving, or because the files
  201.         reside on a NFS-mounted directory tree) can be served
  202.         without conversion.</p>
  203.  
  204.         <p><strong>Example:</strong></p>
  205.  
  206.         <p>to serve files with the suffix <code>.ahtml</code> as a
  207.         raw ASCII <code>text/html</code> document without implicit
  208.         conversion (and suffix <code>.ascii</code> as ASCII
  209.         <code>text/plain</code>), use the directives:</p>
  210.  
  211.         <example>
  212.           AddType  text/x-ascii-html  .ahtml <br />
  213.           AddType  text/x-ascii-plain .ascii
  214.         </example>
  215.  
  216.         <p>Similarly, any <code>text/foo</code> MIME type can be
  217.         served as "raw ASCII" by configuring a MIME type
  218.         "<code>text/x-ascii-foo</code>" for it using
  219.         <code>AddType</code>.</p>
  220.       </li>
  221.  
  222.       <li>
  223.         <p>Non-text documents are always served "binary" without
  224.         conversion. This seems to be the most sensible choice for,
  225.         .<em>e.g.</em>, GIF/ZIP/AU file types. This of course
  226.         requires the user to copy them to the mainframe host using
  227.         the "<code>rcp -b</code>" binary switch.</p>
  228.       </li>
  229.  
  230.       <li>
  231.         <p>Server parsed files are always assumed to be in native
  232.         (<em>i.e.</em>, EBCDIC) format as used on the machine, and
  233.         are converted after processing.</p>
  234.       </li>
  235.  
  236.       <li>
  237.         <p>For CGI output, the CGI script determines whether a
  238.         conversion is needed or not: by setting the appropriate
  239.         Content-Type, text files can be converted, or GIF output can
  240.         be passed through unmodified. An example for the latter case
  241.         is the wwwcount program which we ported as well.</p>
  242.       </li>
  243.  
  244.     </ol>
  245.  
  246.   </section>
  247.  
  248.   <section id="document">
  249.  
  250.     <title>Document Storage Notes</title>
  251.  
  252.     <section id="binary">
  253.  
  254.       <title>Binary Files</title>
  255.  
  256.       <p>All files with a <code>Content-Type:</code> which does not
  257.       start with <code>text/</code> are regarded as <em>binary
  258.       files</em> by the server and are not subject to any conversion.
  259.       Examples for binary files are GIF images, gzip-compressed files
  260.       and the like.</p>
  261.  
  262.       <p>When exchanging binary files between the mainframe host and
  263.       a Unix machine or Windows PC, be sure to use the ftp "binary"
  264.       (<code>TYPE I</code>) command, or use the
  265.       <code>rcp -b</code> command from the mainframe host (the
  266.       <code>-b</code> switch is not supported in unix
  267.       <code>rcp</code>'s).</p>
  268.  
  269.     </section>
  270.  
  271.     <section id="text">
  272.  
  273.       <title>Text Documents</title>
  274.  
  275.       <p>The default assumption of the server is that Text Files
  276.       (<em>i.e.</em>, all files whose <code>Content-Type:</code>
  277.       starts with <code>text/</code>) are stored in the native
  278.       character set of the host, EBCDIC.</p>
  279.  
  280.     </section>
  281.  
  282.     <section id="ssi">
  283.  
  284.       <title>Server Side Included Documents</title>
  285.  
  286.       <p>SSI documents must currently be stored in EBCDIC only.
  287.       No provision is made to convert it from ASCII before
  288.       processing.</p>
  289.  
  290.     </section>
  291.  
  292.   </section>
  293.  
  294.   <section id="modules">
  295.  
  296.     <title>Apache Modules' Status</title>
  297.  
  298.     <table border="1">
  299.       <tr>
  300.         <th>Module</th>
  301.         <th>Status</th>
  302.         <th>Notes</th>
  303.       </tr>
  304.  
  305.       <tr>
  306.         <td><module>core</module></td>
  307.         <td class="centered">+</td>
  308.         <td></td>
  309.       </tr>
  310.  
  311.       <tr>
  312.         <td><module>mod_access</module></td>
  313.         <td class="centered">+</td>
  314.         <td></td>
  315.       </tr>
  316.  
  317.       <tr>
  318.         <td><module>mod_actions</module></td>
  319.         <td class="centered">+</td>
  320.         <td></td>
  321.       </tr>
  322.  
  323.       <tr>
  324.         <td><module>mod_alias</module></td>
  325.         <td class="centered">+</td>
  326.         <td></td>
  327.       </tr>
  328.  
  329.       <tr>
  330.         <td><module>mod_asis</module></td>
  331.         <td class="centered">+</td>
  332.         <td></td>
  333.       </tr>
  334.  
  335.       <tr>
  336.         <td><module>mod_auth</module></td>
  337.         <td class="centered">+</td>
  338.         <td></td>
  339.       </tr>
  340.  
  341.       <tr>
  342.         <td><module>mod_auth_anon</module></td>
  343.         <td class="centered">+</td>
  344.         <td></td>
  345.       </tr>
  346.  
  347.       <tr>
  348.         <td><module>mod_auth_dbm</module></td>
  349.         <td class="centered">?</td>
  350.         <td>with own <code>libdb.a</code></td>
  351.       </tr>
  352.  
  353.       <tr>
  354.         <td><module>mod_autoindex</module></td>
  355.         <td class="centered">+</td>
  356.         <td></td>
  357.       </tr>
  358.  
  359.       <tr>
  360.         <td><module>mod_cern_meta</module></td>
  361.         <td class="centered">?</td>
  362.         <td></td>
  363.       </tr>
  364.  
  365.       <tr>
  366.         <td><module>mod_cgi</module></td>
  367.         <td class="centered">+</td>
  368.         <td></td>
  369.       </tr>
  370.  
  371.       <tr>
  372.         <td><code>mod_digest</code></td>
  373.         <td class="centered">+</td>
  374.         <td></td>
  375.       </tr>
  376.  
  377.       <tr>
  378.         <td><module>mod_dir</module></td>
  379.         <td class="centered">+</td>
  380.         <td></td>
  381.       </tr>
  382.  
  383.       <tr>
  384.         <td><module>mod_so</module></td>
  385.         <td class="centered">-</td>
  386.         <td>no shared libs</td>
  387.       </tr>
  388.  
  389.       <tr>
  390.         <td><module>mod_env</module></td>
  391.         <td class="centered">+</td>
  392.         <td></td>
  393.       </tr>
  394.  
  395.       <tr>
  396.         <td><module>mod_example</module></td>
  397.         <td class="centered">-</td>
  398.         <td>(test bed only)</td>
  399.       </tr>
  400.  
  401.       <tr>
  402.         <td><module>mod_expires</module></td>
  403.         <td class="centered">+</td>
  404.         <td></td>
  405.       </tr>
  406.  
  407.       <tr>
  408.         <td><module>mod_headers</module></td>
  409.         <td class="centered">+</td>
  410.         <td></td>
  411.       </tr>
  412.  
  413.       <tr>
  414.         <td><module>mod_imap</module></td>
  415.         <td class="centered">+</td>
  416.         <td></td>
  417.       </tr>
  418.  
  419.       <tr>
  420.         <td><module>mod_include</module></td>
  421.         <td class="centered">+</td>
  422.         <td></td>
  423.       </tr>
  424.  
  425.       <tr>
  426.         <td><module>mod_info</module></td>
  427.         <td class="centered">+</td>
  428.         <td></td>
  429.       </tr>
  430.  
  431.       <tr>
  432.         <td><code>mod_log_agent</code></td>
  433.         <td class="centered">+</td>
  434.         <td></td>
  435.       </tr>
  436.  
  437.       <tr>
  438.         <td><module>mod_log_config</module></td>
  439.         <td class="centered">+</td>
  440.         <td></td>
  441.       </tr>
  442.  
  443.       <tr>
  444.         <td><code>mod_log_referer</code></td>
  445.         <td class="centered">+</td>
  446.         <td></td>
  447.       </tr>
  448.  
  449.       <tr>
  450.         <td><module>mod_mime</module></td>
  451.         <td class="centered">+</td>
  452.         <td></td>
  453.       </tr>
  454.  
  455.       <tr>
  456.         <td><module>mod_mime_magic</module></td>
  457.         <td class="centered">?</td>
  458.         <td>not ported yet</td>
  459.       </tr>
  460.  
  461.       <tr>
  462.         <td><module>mod_negotiation</module></td>
  463.         <td class="centered">+</td>
  464.         <td></td>
  465.       </tr>
  466.  
  467.       <tr>
  468.         <td><module>mod_proxy</module></td>
  469.         <td class="centered">+</td>
  470.         <td></td>
  471.       </tr>
  472.  
  473.       <tr>
  474.         <td><module>mod_rewrite</module></td>
  475.         <td class="centered">+</td>
  476.         <td>untested</td>
  477.       </tr>
  478.  
  479.       <tr>
  480.         <td><module>mod_setenvif</module></td>
  481.         <td class="centered">+</td>
  482.         <td></td>
  483.       </tr>
  484.  
  485.       <tr>
  486.         <td><module>mod_speling</module></td>
  487.         <td class="centered">+</td>
  488.         <td></td>
  489.       </tr>
  490.  
  491.       <tr>
  492.         <td><module>mod_status</module></td>
  493.         <td class="centered">+</td>
  494.         <td></td>
  495.       </tr>
  496.  
  497.       <tr>
  498.         <td><module>mod_unique_id</module></td>
  499.         <td class="centered">+</td>
  500.         <td></td>
  501.       </tr>
  502.  
  503.       <tr>
  504.         <td><module>mod_userdir</module></td>
  505.         <td class="centered">+</td>
  506.         <td></td>
  507.       </tr>
  508.  
  509.       <tr>
  510.         <td><module>mod_usertrack</module></td>
  511.         <td class="centered">?</td>
  512.         <td>untested</td>
  513.       </tr>
  514.     </table>
  515.  
  516.   </section>
  517.  
  518.   <section id="third-party">
  519.  
  520.     <title>Third Party Modules' Status</title>
  521.  
  522.     <table border="1">
  523.       <tr>
  524.         <th>Module</th>
  525.         <th>Status</th>
  526.         <th>Notes</th>
  527.       </tr>
  528.  
  529.       <tr>
  530.         <td><code><a href="http://java.apache.org/">mod_jserv</a>
  531.         </code></td>
  532.         <td class="centered">-</td>
  533.         <td>JAVA still being ported.</td>
  534.       </tr>
  535.  
  536.       <tr>
  537.         <td><code><a href="http://www.php.net/">mod_php3</a></code></td>
  538.         <td class="centered">+</td>
  539.         <td><code>mod_php3</code> runs fine, with LDAP and GD
  540.         and FreeType libraries.</td>
  541.       </tr>
  542.  
  543.       <tr>
  544.         <td><code><a
  545.         href="http://hpwww.ec-lyon.fr/~vincent/apache/mod_put.html"
  546.         >mod_put</a></code></td>
  547.         <td class="centered">?</td>
  548.         <td>untested</td>
  549.       </tr>
  550.  
  551.       <tr>
  552.         <td><code><a href="ftp://hachiman.vidya.com/pub/apache/"
  553.         >mod_session</a></code></td>
  554.         <td class="centered">-</td>
  555.         <td>untested</td>
  556.       </tr>
  557.     </table>
  558.  
  559.   </section>
  560.  
  561. </manualpage>
  562.