*
* The URL syntax corresponds to RFC 2396 with several exceptions:
*
- * o Escaping of special characters still follows RFC 1738.
* o Interpretation of path parameters follows RFC 1808.
*
* XXX: The buffer handling in this module is really horrible, but it works.
val = NCC_AND; break;
case '#':
val = NCC_HASH; break;
+ case '$':
+ val = NCC_DOLLAR; break;
+ case '+':
+ val = NCC_PLUS; break;
+ case ',':
+ val = NCC_COMMA; break;
}
*d++ = val;
s += 3;
{
if (d >= end)
return URL_ERR_TOO_LONG;
- if (Calnum(c) || /* RFC 1738(2.2): Only alphanumerics ... */
- c == '$' || c == '-' || c == '_' || c == '.' || c == '+' || /* ... and several other exceptions ... */
+ if (Calnum(c) || /* RFC 2396 (2.1-2.3): Only alphanumerics ... */
+ c == '-' || c == '_' || c == '.' || c == '+' || c == '~' || /* ... and several other exceptions ... */
c == '!' || c == '*' || c == '\'' || c == '(' || c == ')' ||
- c == ',' ||
c == '/' || c == '?' || c == ':' || c == '@' || /* ... and reserved chars used for reserved purpose */
- c == '=' || c == '&' || c == '#' || c == ';')
+ c == '=' || c == '&' || c == '#' || c == ';' ||
+ c == '$' || c == '+' || c == ',')
*d++ = *s++;
else
{
/* Non-control meanings of control characters */
-#define NCC_SEMICOLON 1
-#define NCC_SLASH 2
-#define NCC_QUEST 3
-#define NCC_COLON 4
-#define NCC_AT 5
-#define NCC_EQUAL 6
-#define NCC_AND 7
-#define NCC_HASH 8
-#define NCC_MAX 9
-
-#define NCC_CHARS " ;/?:@=&#"
+enum {
+ NCC_SEMICOLON = 1,
+ NCC_SLASH = 2,
+ NCC_QUEST = 3,
+ NCC_COLON = 4,
+ NCC_AT = 5,
+ NCC_EQUAL = 6,
+ NCC_AND = 7,
+ NCC_HASH = 8,
+ // Avoid 9 (\t) and 10 (\n)
+ NCC_DOLLAR = 11,
+ NCC_PLUS = 12,
+ // Avoid 13 (\r)
+ NCC_COMMA = 14,
+ NCC_MAX = 15
+};
+
+#define NCC_CHARS " ;/?:@=&#\t\n$+\r,"
/* Remove/Introduce '%' escapes */