httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_ftp.c proxy_util.c
Date Thu, 25 Apr 2002 22:12:51 GMT
trawick     02/04/25 15:12:51

  Modified:    modules/proxy proxy_ftp.c proxy_util.c
  Log:
  get mod_proxy to build on EBCDIC machines
  
  Revision  Changes    Path
  1.118     +8 -1      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- proxy_ftp.c	29 Mar 2002 08:17:23 -0000	1.117
  +++ proxy_ftp.c	25 Apr 2002 22:12:50 -0000	1.118
  @@ -147,6 +147,9 @@
   static int ftp_check_string(const char *x)
   {
       int i, ch = 0;
  +#if APR_CHARSET_EBCDIC
  +    char buf[1];
  +#endif
   
       for (i = 0; x[i] != '\0'; i++) {
           ch = x[i];
  @@ -157,7 +160,11 @@
   #if !APR_CHARSET_EBCDIC
           if (ch == '\015' || ch == '\012' || (ch & 0x80))
   #else                           /* APR_CHARSET_EBCDIC */
  -        if (ch == '\r' || ch == '\n' || (os_toascii[ch] & 0x80))
  +        if (ch == '\r' || ch == '\n')
  +            return 0;
  +        buf[0] = ch;
  +        ap_xlate_proto_to_ascii(buf);
  +        if (buf[0] & 0x80)
   #endif                          /* APR_CHARSET_EBCDIC */
               return 0;
       }
  
  
  
  1.90      +29 -3     httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- proxy_util.c	6 Apr 2002 12:43:47 -0000	1.89
  +++ proxy_util.c	25 Apr 2002 22:12:51 -0000	1.90
  @@ -93,7 +93,27 @@
   	i += ch - ('a' - 10);
       return i;
   #else /*APR_CHARSET_EBCDIC*/
  -    return (1 == sscanf(x, "%2x", &i)) ? os_toebcdic[i&0xFF] : 0;
  +    /* we assume that the hex value refers to an ASCII character
  +     * so convert to EBCDIC so that it makes sense locally;
  +     *
  +     * example:
  +     *
  +     * client specifies %20 in URL to refer to a space char;
  +     * at this point we're called with EBCDIC "20"; after turning
  +     * EBCDIC "20" into binary 0x20, we then need to assume that 0x20
  +     * represents an ASCII char and convert 0x20 to EBCDIC, yielding
  +     * 0x40
  +     */
  +    char buf[1];
  +
  +    if (1 == sscanf(x, "%2x", &i)) {
  +        buf[0] = i & 0xFF;
  +        ap_xlate_proto_from_ascii(buf, 1);
  +        return buf[0];
  +    }
  +    else {
  +        return 0;
  +    }
   #endif /*APR_CHARSET_EBCDIC*/
   }
   
  @@ -116,10 +136,16 @@
   	x[2] = '0' + i;
   #else /*APR_CHARSET_EBCDIC*/
       static const char ntoa[] = { "0123456789ABCDEF" };
  +    char buf[1];
  +
       ch &= 0xFF;
  +
  +    buf[0] = ch;
  +    ap_xlate_proto_to_ascii(buf, 1);
  +
       x[0] = '%';
  -    x[1] = ntoa[(os_toascii[ch]>>4)&0x0F];
  -    x[2] = ntoa[os_toascii[ch]&0x0F];
  +    x[1] = ntoa[(buf[0] >> 4) & 0x0F];
  +    x[2] = ntoa[buf[0] & 0x0F];
       x[3] = '\0';
   #endif /*APR_CHARSET_EBCDIC*/
   }
  
  
  

Mime
View raw message