2 * Sherlock Library -- URL Functions
4 * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
7 #define MAX_URL_SIZE 1024
9 /* Non-control meanings of control characters */
11 #define NCC_SEMICOLON 1
20 #define NCC_CHARS " ;/?:@=&"
22 /* Remove/Introduce '%' escapes */
24 int url_deescape(byte *, byte *);
25 int url_enescape(byte *, byte *);
27 /* URL splitting and normalization */
34 uns port; /* ~0 if unspec */
39 int url_split(byte *, struct url *, byte *);
40 int url_normalize(struct url *, struct url *);
41 int url_canonicalize(struct url *);
42 int url_pack(struct url *, byte *);
43 int url_canon_split(byte *, byte *, byte *, struct url *);
44 uns identify_protocol(byte *);
50 #define URL_ERR_TOO_LONG 1
51 #define URL_ERR_INVALID_CHAR 2
52 #define URL_ERR_INVALID_ESCAPE 3
53 #define URL_ERR_INVALID_ESCAPED_CHAR 4
54 #define URL_ERR_INVALID_PORT 5
55 #define URL_ERR_REL_NOTHING 6
56 #define URL_ERR_UNKNOWN_PROTOCOL 7
57 #define URL_SYNTAX_ERROR 8
58 #define URL_PATH_UNDERFLOW 9
60 #define URL_PROTO_UNKNOWN 0
61 #define URL_PROTO_HTTP 1
62 #define URL_PROTO_FTP 2
63 #define URL_PROTO_FILE 3
64 #define URL_PROTO_MAX 4
66 #define URL_PNAMES { "unknown", "http", "ftp", "file" }
67 #define URL_DEFPORTS { ~0, 80, 21, 0 }
69 extern byte *url_proto_names[];