久久首页
免费软件
网络时尚
网络学堂
专题讨论
网络资源
网络游戏
网络文档
网络产品
网站导航: 首页 > 网络服务 > Apache 2.0 中文文档 > Apache对EBCDIC的移植 文档讨论

Apache 2.0 中文文档

后退 Apache对EBCDIC的移植 前进

2004-02-11 Apache 译者:kajaa http://www.douzhe.com/ApacheManual/
 
Overview of the Apache EBCDIC Port

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.

(It is the SIEMENS family of mainframes running the BS2000/OSD operating system. This mainframe OS nowadays features a SVR4-derived POSIX subsystem).

The port was started initially to

prove the feasibility of porting the Apache HTTP server to this platform
find a "worthy and capable" successor for the venerable CERN-3.0 daemon (which was ported a couple of years ago), and to
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.
This document serves as a rationale to describe some of the design decisions of the port to this machine.


Design Goals

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 grep or sed 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.


Technical Solution

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:

set before a request is received (because the request and the request header lines are always in ASCII format)
set/unset 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)
set before a reply header is sent (because the response header lines are always in ASCII format)
set/unset 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)

Porting Notes
The relevant changes in the source are #ifdef'ed into two categories:

#ifdef CHARSET_EBCDIC
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 etc.

#ifdef _OSD_POSIX
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.

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 not 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 GET request, any Header: lines, the chunking information etc.) whereas the file transfer parts (i.e., GIF images, CGI output etc.) 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 bgets() or rvputs() for strings, and functions like bwrite() for binary data. A global translation of everything would therefore be inadequate.

(In the case of text files of course, provisions must be made so that EBCDIC documents are always served in ASCII)

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
 
后退 目录 前进
在HPUX上运行高性能网络服务器 上一级 Apache HTTP服务器和支持程序
 
发表评论 关闭窗口
 相关内容
 
 文档分类
操作系统
网络服务
编程语言
数据库
RFC请求注解
基础原理
软件使用
硬件参考
解决方案
 文章搜索
 
网站简介 | 广告服务 | 编程支持 | 设计服务 | 诚邀合作 | 访客留言
Copyright © 1999-2004 99NET. All Rights Reserved
版权所有 久久网络工作室
Email:webmaster@99net.net