httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject request_rec change inside ifdef APACHE_XLATE (?)
Date Mon, 15 May 2000 15:51:52 GMT
At this point, APR has generic charset translation capability and the
BUFF can be told what charsets to translate between, but modules don't
have a good way to look at the request and the configuration and then
get the right translation handle stored in the BUFF.  (They could do
the ap_bsetopt(BO_WXLATE or BO_RXLATE), but that seems like a bad
idea.)

request_rec needs some translation fields, including a translation
handle for write and a translation handle for read.  They will be 
initialized to sensible values when the request_rec is created,
modules may or may not update them, then when it is time to possibly
enable translation on read or write for content, the current value of
the appropriate handle (possibly NULL) is stored in the BUFF.

My change was to create a structure which will contain information
related to charset translation and point to it from the request_rec.
The current definition of the structure (translation handles for read
and write) seems to be sufficient for all of what Martin's mod_ebcdic
does and a fair amount of what Russian Apache's mod_charset does, but
until those modules (or something similar) can be ported to 2.0 as
proof of concept, the contents of what I'm calling rr_xlate IS NOT
STABLE.

<WILDASS>Because request_rec is only changed if APACHE_XLATE is turned
on and a module has to be rebuilt to have that on, no change to the
version number is required with this code.</WILDASS>

Comments?

My patch:

===================================================================
RCS file: /cvs/apache/apache-2.0/src/include/httpd.h,v
retrieving revision 1.45
diff -u -r1.45 httpd.h
--- httpd.h     2000/05/05 23:17:53     1.45
+++ httpd.h     2000/05/15 02:04:06
@@ -584,6 +584,15 @@

 #include "util_uri.h"

+#ifdef APACHE_XLATE
+#include "apr_xlate.h"
+
+struct rr_xlate {
+    ap_xlate_t *to_net;
+    ap_xlate_t *from_net;
+};
+#endif /*APACHE_XLATE*/
+
 struct process_rec {
     ap_pool_t *pool;  /* Global pool. Please try to cleared on _all_
exits */
     ap_pool_t *pconf; /* aka configuration pool, cleared on restarts
*/
@@ -741,6 +750,10 @@
  */
     const struct htaccess_result *htaccess;

+#ifdef APACHE_XLATE
+    struct rr_xlate *rrx; /* contents are experimental! expect it to
change! */
+#endif /*APACHE_XLATE*/
+
 /* 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

For your reading pleasure, the analogous changes by Martin (in support
of mod_ebcdic) and Russian Apache (in support of mod_charset) are
shown below.

Martin's patch to 1.3's httpd.h for mod_ebcdic (other unrelated
changes to httpd.h omitted):

Index: src/include/httpd.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.308
diff -u -r1.308 httpd.h
--- src/include/httpd.h	2000/02/28 13:42:24	1.308
+++ src/include/httpd.h	2000/03/05 21:10:23
@@ -816,6 +816,17 @@
  */
     const struct htaccess_result *htaccess;
 
+#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

Part of Russian Apache's patch to 1.3's httpd.h...

I have omitted lots of stuff, particularly stuff related to what we
now have in APR or buff.c.  Even in what is shown below, most of their
codepage_data_t is not needed because it deals with details in APR
(e.g., the ptrs to translation tables) or buff.c/buff.h (ptrs to
buffers used during translation).

Index: src/include/httpd.h
diff -c apache-1.3-rus/src/include/httpd.h:1.1.1.10
apache-1.3-rus/src/include/httpd.h:1.26
*** apache-1.3-rus/src/include/httpd.h:1.1.1.10 Sat Feb 26 21:40:43
2000
--- apache-1.3-rus/src/include/httpd.h  Sun Feb 27 18:16:33 2000
***************
*** 73,78 ****
--- 73,79 ----
  #include "buff.h"
  #include "ap.h"

+
  /* ----------------------------- config dir
  ------------------------------ */

  /* Define this to be the default server home dir. Most things later
  in this
***************
*** 664,669 ****
--- 665,693 ----

  #include "util_uri.h"

+ #ifdef RUSSIAN_APACHE
+
+ typedef struct
+ {
+   unsigned int len;
+   unsigned char *buf;
+ } local_buf_t;
+
+ typedef struct
+ {
+   unsigned char *cp_itabl_p;
+   unsigned char *cp_otabl_p;
+   char *cp_name;
+   char *cp_fromname;
+   char *cp_lang;
+   int  cp_flags; /* NEED_EXPIRES,NEED_CHARSET etc */
+   unsigned char postbuf[3];
+   int postlen, errflag, errcode;
+   local_buf_t  *recode_buffer_in;
+   local_buf_t  *recode_buffer_out;
+ } codepage_data_t;
+ #endif
+
  enum proxyreqtype {
      NOT_PROXY=0,
      STD_PROXY,
***************
*** 813,825 ****
   * that way, a sub request's list can (temporarily) point to a
parent's list
   */
      const struct htaccess_result *htaccess;
!
  /* 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
   * binary compatibility for some other reason.
   */
  };


  /* Things which are per connection
--- 837,947 ----
   * that way, a sub request's list can (temporarily) point to a
parent's list
   */
      const struct htaccess_result *htaccess;
! #ifdef RUSSIAN_APACHE
!   codepage_data_t *ra_codep;
! #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
   * binary compatibility for some other reason.
   */
  };
+
(omitted stuff)
+
+ #define RA_NEED_EXPIRES                       2
+ #define RA_DONT_NEED_EXPIRES          (~(RA_NEED_EXPIRES))
+ #define RA_EXPIRES_ALREADY_SET                4
+ #define RA_NEED_CHARSET                       8
+ #define RA_DONT_NEED_CHARSET          (~(RA_NEED_CHARSET))
+ #define RA_IGNORE_LANGUAGE            16
+ #define RA_DONT_IGNORE_LANGUAGE
(~(RA_IGNORE_LANGUAGE))
+ #define RA_VARY_ACCEPT                        32
+ #define RA_VARY_ACCEPT_CHARSET                64
+ #define RA_VARY_USERAGENT             128
+ #define RA_RECODE_HEADERS             256
+ #define RA_DONT_RECODE_HEADERS                (~(RA_RECODE_HEADERS))
+ #define RA_RECODE_FILENAMES           512
+ #define RA_DONT_RECODE_FILENAMES      (~(RA_RECODE_FILENAMES))
+ #define RA_OVERRIDE_EXPIRES           1024
+ #define RA_DONT_OVERRIDE_EXPIRES      (~(RA_OVERRIDE_EXPIRES))
+ #define RA_CONTLEN_PROCESSED          2048
+ /* wide table from server to client */
+ #define RA_WIDE_CHARS_SC              4096
+ /* wide table from client to server - unsupported now */
+ /*#define RA_WIDE_CHARS_CS            8192*/
+ #define RA_ALREADY_RECODED            16384
+ #endif                                      

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message