summaryrefslogtreecommitdiff
path: root/libsoup/soup-misc.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2010-04-06 11:56:04 -0400
committerDan Winship <danw@gnome.org>2010-04-09 19:51:33 -0400
commit6ce2bb5d1e4dfc1429567cc6d2b5232f421af2b3 (patch)
treeee48fb7fc93af32368ff0a71c7851276bf24f4ba /libsoup/soup-misc.c
parent50e363db0243cd94acd45e67f93983312a90eb1c (diff)
downloadlibsoup-6ce2bb5d1e4dfc1429567cc6d2b5232f421af2b3.tar.gz
Add macros for checking character classes. Eg, soup_char_is_token()
Move the existing URI character class table from soup-uri.c to soup-misc.c, and update for that. Also add soup_char_is_token(), to determine if a character can be used in a token or not.
Diffstat (limited to 'libsoup/soup-misc.c')
-rw-r--r--libsoup/soup-misc.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c
index 5e99476f..9a9740b2 100644
--- a/libsoup/soup-misc.c
+++ b/libsoup/soup-misc.c
@@ -164,3 +164,62 @@ soup_add_timeout (GMainContext *async_context,
g_source_unref (source);
return source;
}
+
+/* 00 URI_UNRESERVED
+ * 01 URI_PCT_ENCODED
+ * 02 URI_GEN_DELIMS
+ * 04 URI_SUB_DELIMS
+ * 08 HTTP_SEPARATOR
+ * 10 HTTP_CTL
+ */
+const char soup_char_attributes[] = {
+ /* 0x00 - 0x07 */
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ /* 0x08 - 0x0f */
+ 0x11, 0x19, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ /* 0x10 - 0x17 */
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ /* 0x18 - 0x1f */
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ /* !"#$%&' */
+ 0x09, 0x04, 0x09, 0x02, 0x04, 0x01, 0x04, 0x04,
+ /* ()*+,-./ */
+ 0x0c, 0x0c, 0x04, 0x04, 0x0c, 0x00, 0x00, 0x0a,
+ /* 01234567 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* 89:;<=>? */
+ 0x00, 0x00, 0x0a, 0x0c, 0x09, 0x0a, 0x09, 0x0a,
+ /* @ABCDEFG */
+ 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* HIJKLMNO */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* PQRSTUVW */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* XYZ[\]^_ */
+ 0x00, 0x00, 0x00, 0x0a, 0x09, 0x0a, 0x01, 0x00,
+ /* `abcdefg */
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* hijklmno */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* pqrstuvw */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* xyz{|}~ */
+ 0x00, 0x00, 0x00, 0x09, 0x01, 0x09, 0x00, 0x11,
+ /* 0x80 - 0xFF */
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
+};