X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=ucw%2Furl.h;h=5af7dbcafec3531fd0ca73d57d8926e41f103c91;hb=1e5ae8a779b693d8023ce9821b839f29e210d9e8;hp=39d6e05b1a3dd52f4c55d2f6cb2430bc44f785cd;hpb=8dfb51232c3b8c1f70026503593281cd6bc76a97;p=libucw.git diff --git a/ucw/url.h b/ucw/url.h index 39d6e05b..5af7dbca 100644 --- a/ucw/url.h +++ b/ucw/url.h @@ -11,21 +11,44 @@ #ifndef _UCW_URL_H #define _UCW_URL_H +#ifdef CONFIG_UCW_CLEAN_ABI +#define url_auto_canonicalize_rel ucw_url_auto_canonicalize_rel +#define url_canon_split_rel ucw_url_canon_split_rel +#define url_canonicalize ucw_url_canonicalize +#define url_deescape ucw_url_deescape +#define url_enescape ucw_url_enescape +#define url_enescape_friendly ucw_url_enescape_friendly +#define url_error ucw_url_error +#define url_has_repeated_component ucw_url_has_repeated_component +#define url_identify_protocol ucw_url_identify_protocol +#define url_normalize ucw_url_normalize +#define url_pack ucw_url_pack +#define url_proto_names ucw_url_proto_names +#define url_split ucw_url_split +#endif + #define MAX_URL_SIZE 1024 /* 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 +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 " ;/?:@=&#" +#define NCC_CHARS " ;/?:@=&#\t\n$+\r," /* Remove/Introduce '%' escapes */ @@ -37,11 +60,11 @@ int url_enescape_friendly(const char *src, char *dest); struct url { char *protocol; - uns protoid; + uint protoid; char *user; char *pass; char *host; - uns port; /* ~0 if unspec */ + uint port; /* ~0 if unspec */ char *rest; char *buf, *bufend; }; @@ -52,7 +75,7 @@ int url_canonicalize(struct url *u); int url_pack(struct url *u, char *d); int url_canon_split_rel(const char *url, char *buf1, char *buf2, struct url *u, struct url *base); int url_auto_canonicalize_rel(const char *src, char *dst, struct url *base); -uns identify_protocol(const char *p); +uint url_identify_protocol(const char *p); int url_has_repeated_component(const char *url); static inline int url_canon_split(const char *url, char *buf1, char *buf2, struct url *u) @@ -63,7 +86,7 @@ static inline int url_auto_canonicalize(const char *src, char *dst) /* Error codes */ -char *url_error(uns); +char *url_error(uint); #define URL_ERR_TOO_LONG 1 #define URL_ERR_INVALID_CHAR 2