Oops,

a cut and paste mistake. What I ment to post is:

Applying Stephen's patch to the 2003-11-09 tarball yields:

513 [EMAIL PROTECTED]/tmp> tar zxf ~/tmp/aolserver-4.0-src.tar.gz
514 [EMAIL PROTECTED]/tmp> cd aolserver-4.0
515 [EMAIL PROTECTED]/tmp/aolserver-4.0> patch -p1 -b <
../aolserver-4.0-plus-sign-encoding.patch

patching file include/ns.h
patching file nsd/urlencode.c
Hunk #2 FAILED at 131.
Hunk #4 FAILED at 249.
Hunk #5 FAILED at 268.
Hunk #6 FAILED at 319.
Hunk #8 FAILED at 393.
5 out of 8 hunks FAILED -- saving rejects to file nsd/urlencode.c.rej
patching file nsd/form.c
Hunk #1 FAILED at 250.
1 out of 1 hunk FAILED -- saving rejects to file nsd/form.c.rej

nsd/urlencode.c.rej:

***************
*** 123,132 ****
  /*
   *----------------------------------------------------------------------
   *
-  * Ns_EncodeUrlWithEncoding --
   *
   *     Take a URL and encode any non-alphanumeric characters into
-  *     %hexcode
   *
   * Results:
   *     A pointer to the encoded string (which is part of the
--- 131,140 ----
  /*
   *----------------------------------------------------------------------
   *
+  * Ns_EncodeUrlWithEncoding, Ns_EncodeUrlCharset --
   *
   *     Take a URL and encode any non-alphanumeric characters into
+  *     %hexcode.
   *
   * Results:
   *     A pointer to the encoded string (which is part of the
***************
*** 171,177 ****
      q = dsPtr->string + i;
      p = string;
      while ((i = UCHAR(*p)) != 0) {
-        if (UCHAR(*p) == ' ') {
             *q++ = '+';
         } else if (enc[i].str == NULL) {
             *q++ = *p;
--- 249,255 ----
      q = dsPtr->string + i;
      p = string;
      while ((i = UCHAR(*p)) != 0) {
+        if (UCHAR(*p) == ' ' && scheme == FORM_ENCODING) {
             *q++ = '+';
         } else if (enc[i].str == NULL) {
             *q++ = *p;
***************
*** 190,230 ****
      return dsPtr->string;
  }

-

  /*
   *----------------------------------------------------------------------
   *
-  * Ns_EncodeUrlCharset --
   *
-  *     Take a URL and encode any non-alphanumeric characters into
-  *     %hexcode
   *
   * Results:
-  *     A pointer to the encoded string (which is part of the
-  *     passed-in DString's memory)
   *
   * Side effects:
-  *     Encoded URL will be copied to given dstring.
   *
   *----------------------------------------------------------------------
   */

  char *
- Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
  {
-     Tcl_Encoding encoding = GetUrlEncoding(charset);

-     return Ns_EncodeUrlWithEncoding(dsPtr, string, encoding);

  }

  /*
   *----------------------------------------------------------------------
   *
-  * Ns_DecodeUrlCharset --
   *
-  *     Decode an encoded URL (with %hexcode, etc.).
   *
   * Results:
   *     A pointer to the dstring's value, containing the decoded
--- 268,312 ----
      return dsPtr->string;
  }


  /*
   *----------------------------------------------------------------------
   *
+  * Ns_DecodeUrlWithEncoding, Ns_DecodeUrlCharset --
   *
+  *     Decode an encoded URL (with %hexcode).
   *
   * Results:
+  *     A pointer to the dstring's value, containing the decoded
+  *     URL.
   *
   * Side effects:
+  *     Decoded URL will be copied to given dstring.
   *
   *----------------------------------------------------------------------
   */

  char *
+ Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding
encoding)
  {
+     return DecodeWithEncoding(dsPtr, string, encoding, URL_ENCODING);
+ }

+ char *
+ Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
+ {
+     Tcl_Encoding  encoding = GetUrlEncoding(charset);

+     return Ns_DecodeUrlWithEncoding( dsPtr, string, encoding );
  }
+

  /*
   *----------------------------------------------------------------------
   *
+  * Ns_DecodeFormWithEncoding, Ns_DecodeFormCharset --
   *
+  *     Decode encoded form data (with %hexcode, etc.).
   *
   * Results:
   *     A pointer to the dstring's value, containing the decoded
***************
*** 237,257 ****
   */

  char *
- Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
  {
      Tcl_Encoding  encoding = GetUrlEncoding(charset);

      return Ns_DecodeUrlWithEncoding( dsPtr, string, encoding );
  }

-

  /*
   *----------------------------------------------------------------------
   *
-  * Ns_DecodeUrlWithEncoding --
   *
-  *     Decode an encoded URL (with %hexcode, etc.).
   *
   * Results:
   *     A pointer to the dstring's value, containing the decoded
--- 319,347 ----
   */

  char *
+ Ns_DecodeFormWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding
encoding)
+ {
+     return DecodeWithEncoding(dsPtr, string, encoding, FORM_ENCODING);
+ }
+
+ char *
+ Ns_DecodeFormCharset(Ns_DString *dsPtr, char *string, char *charset)
  {
      Tcl_Encoding  encoding = GetUrlEncoding(charset);

      return Ns_DecodeUrlWithEncoding( dsPtr, string, encoding );
  }


  /*
   *----------------------------------------------------------------------
   *
+  * DecodeWithEncoding --
   *
+  *     Decode an encoded string, the scheme determines how the '+' is
+  *      handled:
+  *          URL_ENCODE:  '+' left untransformed.
+  *          FORM_ENCODE: '+' transformed into space.
   *
   * Results:
   *     A pointer to the dstring's value, containing the decoded
***************
*** 303,309 ****
             (j = enc[UCHAR(p[2])].hex) >= 0) {
             *q++ = (unsigned char) ((i << 4) + j);
             p += 3;
-        } else if (UCHAR(*p) == '+') {
             *q++ = ' ';
             ++p;
         } else {
--- 393,399 ----
             (j = enc[UCHAR(p[2])].hex) >= 0) {
             *q++ = (unsigned char) ((i << 4) + j);
             p += 3;
+        } else if (UCHAR(*p) == '+' && scheme == FORM_ENCODING) {
             *q++ = ' ';
             ++p;
         } else {



nsd/form.c.rej:

***************
*** 250,259 ****
             *v = '\0';
         }
          Ns_DStringTrunc(&kds, 0);
-        k = Ns_DecodeUrlWithEncoding(&kds, k, encoding);
         if (v != NULL) {
              Ns_DStringTrunc(&vds, 0);
-            Ns_DecodeUrlWithEncoding(&vds, v+1, encoding);
             *v = '=';
             v = vds.string;
         }
--- 250,259 ----
             *v = '\0';
         }
          Ns_DStringTrunc(&kds, 0);
+        k = Ns_DecodeFormWithEncoding(&kds, k, encoding);
         if (v != NULL) {
              Ns_DStringTrunc(&vds, 0);
+            Ns_DecodeFormWithEncoding(&vds, v+1, encoding);
             *v = '=';
             v = vds.string;
         }


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to