It's an AOLserver bug -- it's translating + to space in paths where it
shouldn't. Attached is a patch for 4+.
On Mon, 2004-01-26 at 14:37, Bart Teeuwisse wrote:
> Fastpath.c doesn't recognize directories starting with a plus sign (+). Thus
> _ns_dirlist is never called to return the content of the directory.
>
> This is important to me as I'm trying to setup AOLserver to host GNU Arch
> (http://www.gnu.org/software/gnu-arch/) archives. Arch makes use of
> directories called ++revision-lick and +contents to name a couple examples.
>
> Lacking the necessary C skills, I'd like to ask those who do posses them, is
> it a bug that fastpath.c doesn't recognize directory names starting with a
> plus sign? If not what is needed to fix it?
>
> /Bart
>
>
> --
> 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.
--
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.
--- aolserver-4.0/include/ns.h.plus-sign-encoding 2004-01-16 04:35:27.000000000 -0700
+++ aolserver-4.0/include/ns.h 2004-01-16 04:35:45.000000000 -0700
@@ -1156,6 +1156,15 @@
NS_EXTERN char *Ns_DecodeUrlCharset(Ns_DString *pds, char *string,
char *charset);
+NS_EXTERN char *Ns_EncodeFormWithEncoding(Ns_DString *pds, char *string,
+ Tcl_Encoding encoding);
+NS_EXTERN char *Ns_DecodeFormWithEncoding(Ns_DString *pds, char *string,
+ Tcl_Encoding encoding);
+NS_EXTERN char *Ns_EncodeFormCharset(Ns_DString *pds, char *string,
+ char *charset);
+NS_EXTERN char *Ns_DecodeFormCharset(Ns_DString *pds, char *string,
+ char *charset);
+
/*
* urlopen.c:
*/
--- aolserver-4.0/nsd/urlencode.c.plus-sign-encoding 2004-01-16 04:34:56.000000000 -0700
+++ aolserver-4.0/nsd/urlencode.c 2004-01-16 04:35:57.000000000 -0700
@@ -41,6 +41,14 @@
+#define URL_ENCODING 0
+#define FORM_ENCODING 1
+
+static char *EncodeWithEncoding(Ns_DString *dsPtr, char *string,
+ Tcl_Encoding encoding, int scheme);
+static char *DecodeWithEncoding(Ns_DString *dsPtr, char *string,
+ Tcl_Encoding encoding, int scheme);
+
static Tcl_Encoding GetUrlEncoding(char *charset);
/*
@@ -123,10 +131,10 @@
/*
*----------------------------------------------------------------------
*
- * Ns_EncodeUrlWithEncoding --
+ * Ns_EncodeUrlWithEncoding, Ns_EncodeUrlCharset --
*
* Take a URL and encode any non-alphanumeric characters into
- * %hexcode
+ * %hexcode.
*
* Results:
* A pointer to the encoded string (which is part of the
@@ -141,6 +149,76 @@
char *
Ns_EncodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
{
+ return EncodeWithEncoding(dsPtr, string, encoding, URL_ENCODING);
+}
+
+char *
+Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
+{
+ Tcl_Encoding encoding = GetUrlEncoding(charset);
+
+ return Ns_EncodeUrlWithEncoding(dsPtr, string, encoding);
+
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Ns_EncodeFormWithEncoding, Ns_EncodeFormCharset --
+ *
+ * Take some form data encode any non-alphanumeric characters into
+ * %hexcode, except spaces which become '+'.
+ *
+ * Results:
+ * A pointer to the encoded string (which is part of the
+ * passed-in DString's memory)
+ *
+ * Side effects:
+ * Encoded form data will be copied to given dstring.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+Ns_EncodeFormWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
+{
+ return EncodeWithEncoding(dsPtr, string, encoding, FORM_ENCODING);
+}
+
+char *
+Ns_EncodeFormCharset(Ns_DString *dsPtr, char *string, char *charset)
+{
+ Tcl_Encoding encoding = GetUrlEncoding(charset);
+
+ return Ns_EncodeUrlWithEncoding(dsPtr, string, encoding);
+
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EncodeWithEncoding --
+ *
+ * Take a string and encode any non-alphanumeric characters, the
+ * scheme determins the method of encoding:
+ * URL_ENCODE: %hex encoding
+ * FORM_ENCODE: %hex encoding, but spaces become '+'
+ *
+ * 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.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static char *
+EncodeWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding, int scheme)
+{
register int i, n;
register char *p, *q;
Tcl_DString ds;
@@ -171,7 +249,7 @@
q = dsPtr->string + i;
p = string;
while ((i = UCHAR(*p)) != 0) {
- if (UCHAR(*p) == ' ') {
+ if (UCHAR(*p) == ' ' && scheme == FORM_ENCODING) {
*q++ = '+';
} else if (enc[i].str == NULL) {
*q++ = *p;
@@ -190,41 +268,45 @@
return dsPtr->string;
}
-
/*
*----------------------------------------------------------------------
*
- * Ns_EncodeUrlCharset --
+ * Ns_DecodeUrlWithEncoding, Ns_DecodeUrlCharset --
*
- * Take a URL and encode any non-alphanumeric characters into
- * %hexcode
+ * Decode an encoded URL (with %hexcode).
*
* Results:
- * A pointer to the encoded string (which is part of the
- * passed-in DString's memory)
+ * A pointer to the dstring's value, containing the decoded
+ * URL.
*
* Side effects:
- * Encoded URL will be copied to given dstring.
+ * Decoded URL will be copied to given dstring.
*
*----------------------------------------------------------------------
*/
char *
-Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
+Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
{
- Tcl_Encoding encoding = GetUrlEncoding(charset);
+ return DecodeWithEncoding(dsPtr, string, encoding, URL_ENCODING);
+}
- return Ns_EncodeUrlWithEncoding(dsPtr, string, encoding);
+char *
+Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
+{
+ Tcl_Encoding encoding = GetUrlEncoding(charset);
+ return Ns_DecodeUrlWithEncoding( dsPtr, string, encoding );
}
+
/*
*----------------------------------------------------------------------
*
- * Ns_DecodeUrlCharset --
+ * Ns_DecodeFormWithEncoding, Ns_DecodeFormCharset --
*
- * Decode an encoded URL (with %hexcode, etc.).
+ * Decode encoded form data (with %hexcode, etc.).
*
* Results:
* A pointer to the dstring's value, containing the decoded
@@ -237,21 +319,29 @@
*/
char *
-Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset)
+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 );
}
-
/*
*----------------------------------------------------------------------
*
- * Ns_DecodeUrlWithEncoding --
+ * DecodeWithEncoding --
*
- * Decode an encoded URL (with %hexcode, etc.).
+ * 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
@@ -264,7 +354,7 @@
*/
char *
-Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding)
+DecodeWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding, int scheme)
{
register int i, j, n;
register char *p, *q;
@@ -303,7 +393,7 @@
(j = enc[UCHAR(p[2])].hex) >= 0) {
*q++ = (unsigned char) ((i << 4) + j);
p += 3;
- } else if (UCHAR(*p) == '+') {
+ } else if (UCHAR(*p) == '+' && scheme == FORM_ENCODING) {
*q++ = ' ';
++p;
} else {
--- aolserver-4.0/nsd/form.c.plus-sign-encoding 2004-01-16 04:35:07.000000000 -0700
+++ aolserver-4.0/nsd/form.c 2004-01-16 04:35:37.000000000 -0700
@@ -250,10 +250,10 @@
*v = '\0';
}
Ns_DStringTrunc(&kds, 0);
- k = Ns_DecodeUrlWithEncoding(&kds, k, encoding);
+ k = Ns_DecodeFormWithEncoding(&kds, k, encoding);
if (v != NULL) {
Ns_DStringTrunc(&vds, 0);
- Ns_DecodeUrlWithEncoding(&vds, v+1, encoding);
+ Ns_DecodeFormWithEncoding(&vds, v+1, encoding);
*v = '=';
v = vds.string;
}