On Thu, Feb 06, 2003 at 08:38:28PM +0000, David Woolley wrote:
> > Content-Disposition: form-data; name=3D""MSignal_MC-Send@0,5517867""=0D
> 
> It looks like Lynx has got confused by the special characters and added
> a spurious level of quoting.

Here's a simple fix for that (attached).

-- 
Thomas E. Dickey <[EMAIL PROTECTED]>
http://invisible-island.net
ftp://invisible-island.net
# ------------------------------------------------------------------------------
# WWW/Library/Implementation/HTParse.c |   22 +++++++++++++++-------
# WWW/Library/Implementation/HTParse.h |    3 ++-
# src/GridText.c                       |    2 +-
# 3 files changed, 18 insertions(+), 9 deletions(-)
# ------------------------------------------------------------------------------
Index: WWW/Library/Implementation/HTParse.c
--- lynx2.8.5dev.14+/WWW/Library/Implementation/HTParse.c       Tue Feb  4 21:18:27 
2003
+++ lynx2.8.5dev.14a/WWW/Library/Implementation/HTParse.c       Thu Feb  6 20:07:15 
+2003
@@ -1012,17 +1012,21 @@
 
 /*
 **  Turn a string which is not a RFC 822 token into a quoted-string. - KW
+**  The "quoted" parameter tells whether we need the beginning/ending quote
+**  marks.  If not, the caller will provide them -TD
 */
-PUBLIC void HTMake822Word ARGS1(
-       char **,        str)
+PUBLIC void HTMake822Word ARGS2(
+       char **,        str,
+       int,            quoted)
 {
     CONST char * p;
     char * q;
     char * result;
     unsigned char a;
     int added = 0;
-    if (!(*str) || !(**str)) {
-       StrAllocCopy(*str, "\"\"");
+
+    if (isEmpty(*str)) {
+       StrAllocCopy(*str, quoted ? "\"\"" : "");
        return;
     }
     for (p = *str; *p; p++) {
@@ -1044,14 +1048,17 @@
     result = typecallocn(char, p-(*str) + added + 1);
     if (result == NULL)
        outofmem(__FILE__, "HTMake822Word");
-    result[0] = '"';
+
+    q = result;
+    if (quoted)
+       *q++ = '"';
     /*
     ** Having converted the character to ASCII, we can't use symbolic
     ** escape codes, since they're in the host character set, which
     ** is not necessarily ASCII.  Thus we use octal escape codes instead.
     ** -- gil (Paul Gilmartin) <[EMAIL PROTECTED]>
     */  /* S/390 -- gil -- 0268 */
-    for (q = result + 1, p = *str; *p; p++) {
+    for (p = *str; *p; p++) {
        a = TOASCII(*p);
        if ((a != '\011') && ((a & 127) < 32 ||
                            ( a < 128 && ((crfc[a-32]) & 2))))
@@ -1060,7 +1067,8 @@
        if (a == '\012' || (a == '\015' && (TOASCII(*(p+1)) != '\012')))
            *q++ = ' ';
     }
-    *q++ = '"';
+    if (quoted)
+       *q++ = '"';
     *q++ = '\0';                       /* Terminate */
     FREE(*str);
     *str = result;
Index: WWW/Library/Implementation/HTParse.h
--- lynx2.8.5dev.14+/WWW/Library/Implementation/HTParse.h       Wed Jan 22 05:09:18 
2003
+++ lynx2.8.5dev.14a/WWW/Library/Implementation/HTParse.h       Thu Feb  6 20:03:17 
+2003
@@ -189,6 +189,7 @@
 **  Turn a string which is not a RFC 822 token into a quoted-string. - KW
 */
 extern void HTMake822Word PARAMS((
-       char **         str));
+       char **         str,
+       int             quoted));
 
 #endif  /* HTPARSE_H */
Index: src/GridText.c
--- lynx2.8.5dev.14+/src/GridText.c     Tue Feb  4 21:18:27 2003
+++ lynx2.8.5dev.14a/src/GridText.c     Thu Feb  6 20:06:27 2003
@@ -10595,7 +10595,7 @@
                     *  as multipart/form-data can only occur if the form
                     *  provider specifically asked for it anyway. - kw
                     */
-                   HTMake822Word(&copied_name_used);
+                   HTMake822Word(&copied_name_used, FALSE);
                    name_used = copied_name_used;
                }
 

Reply via email to