chiark / gitweb /
New program to make fixed tables for universal hashing.
[mLib] / url.c
diff --git a/url.c b/url.c
index 5c226015c27921c61bf6219e2a8eea65d0c6ef31..532a052c37f947ef19ef7e7d89f700b9e1cf3219 100644 (file)
--- a/url.c
+++ b/url.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: url.c,v 1.1 1999/06/01 09:49:48 mdw Exp $
+ * $Id: url.c,v 1.4 2001/06/22 19:36:18 mdw Exp $
  *
  * Parsing and construction of url-encoded name/value pairs
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: url.c,v $
+ * Revision 1.4  2001/06/22 19:36:18  mdw
+ * Include @<ctype.h>@.
+ *
+ * Revision 1.3  2001/01/20 12:06:21  mdw
+ * Be more conservative in base-64 encoding.
+ *
+ * Revision 1.2  1999/09/03 08:02:05  mdw
+ * Make `#' a special character which needs escaping.
+ *
  * Revision 1.1  1999/06/01 09:49:48  mdw
  * New files for url-encoding and decoding.
  *
@@ -37,6 +46,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -78,14 +88,10 @@ static void encode(dstr *d, const char *p)
        DPUTC(d, '+');
         break;
       default:
-        if (*p >= 33 && *p < 127)
+        if (isalnum((unsigned char)*p))
          DPUTC(d, *p);
         else
-      case '&':
-      case '+':
-      case '=':
-      case '%':
-       dstr_putf(d, "%%%02x", *p);
+         dstr_putf(d, "%%%02x", *p);
         break;
     }
     p++;