[Zope] Zope.cgi -> mod_zope
Oleg Broytmann
phd@sun.med.ru
Sat, 10 Apr 1999 20:40:52 +0400 (MSD)
Hello!
On Fri, 12 Mar 1999, Jeff Bauer wrote:
> Oleg Broytmann wrote:
> > Is there any plan to make complex "Apache + Zope" even
> > more efficient by making Zope.cgi a module (mod_zope,
> > let's name it, or mod_pcgi)?
>
> A mod_pcgi Apache module has been discussed. It would certainly
> be more efficient. One of the issues would be whether pcgi
> should get out of the process launch business, which would
> simplify a mod_pcgi and make it easier to debug.
Well, I want to ask you to take some precautions when you'll write
actual code.
Preface.
There are many different languages (speaking ones, I mean, not
programming ones), but while you are using one language, problems are rare.
Usually all your computer programs understand some encoding rules, locale
settings, etc. But there are some exceptions, most notable are Japanese,
Chinese, Korean languages (and some other). Cyrillic (Russian) language is
probably worst case. There are so many different encodings no one can
understand it. No one can support it all in one programming product, esp.
if it is multiplatform program.
There is KOI8-R encoding, that's used in Unix world. There is so called
"alternative" encoding (it is "alternative" to so called "main", now
obsolete), used in DOS and OS/2 world. Windows users live with windows-1251
(CP1251 codepage) encoding. Mac users use x-mac-cyrillic. There is
iso8869-5, which is of rare use. It is a problem even on one computer - you
need to convert between DOS and Windows encodings, e.g. But encodings in
heterogeneous networking environment are big big pain. Your mailer should
understand and recode at least koi8 and win1251 encodings (most frequently
used). Your browser should be able to convert text back and forth (in
forms). Very bad.
There is a special version of Apache - Russian Apache. Russian Apache
(apache.lexa.ru) consists of two parts. There is a module - mod_charset.
And there are some patches for standard Apache, as mod_charset need to work
with very deep internals of Apache. The very mod_charset provides conversion
between client and server encodings. In most cases mod_charset recognizes
client encodings. But webmaster can configure mod_charset in many different
ways, and client can use configurations that webmaster provides. There are
three configuration used most often.
1. Automatic client encoding recognition.
2. Hostname-based (win-www.server.ru, koi-www.server.ru)
3. Port-based (www.server.ru:8080 = KOI8, www.server.ru:8081 = WIN).
You don't want to know too much details about Russian Apache. Russian
Apache is actively developed and maintained by Alex Tutubalin (lexa@lexa.ru),
and he does really good job. What I want to ask is: please, write your
modules in a way that is compatible with Russian Apache. Most modules in
the Apache Modules Registry are compatible. Some has problems, but authors
are usually helpful to patch their modules. For example, PHP now has
special configuration option --with-modcharset.
How to make your module compatible? It is easy. Please do not use
low-level apache read/write functions (ap_bwrite and other ap_b*
functions). Use ap_r* functions: ap_rputc, ap_rprintf, ap_rputs, ap_rvputs,
ap_rwrite. For processing POST queries - use get_client_block.
All standard Apache modules work this way, as most of 3rd-party modules.
> -Jeff Bauer
>
Oleg.
----
Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/
Programmers don't die, they just GOSUB without RETURN.