2 * Sherlock Library -- URL Functions
4 * (c) 1997 Martin Mares <mj@ucw.cz>
5 * (c) 2001 Robert Spalek <robert@ucw.cz>
8 #ifndef _SHERLOCK_URL_H
9 #define _SHERLOCK_URL_H
11 #define MAX_URL_SIZE 1024
13 /* Non-control meanings of control characters */
15 #define NCC_SEMICOLON 1
25 #define NCC_CHARS " ;/?:@=&#"
27 /* Remove/Introduce '%' escapes */
29 int url_deescape(byte *, byte *);
30 int url_enescape(byte *, byte *);
32 /* URL splitting and normalization */
39 uns port; /* ~0 if unspec */
44 int url_split(byte *, struct url *, byte *);
45 int url_normalize(struct url *, struct url *);
46 int url_canonicalize(struct url *);
47 int url_pack(struct url *, byte *);
48 int url_canon_split(byte *, byte *, byte *, struct url *);
49 int url_auto_canonicalize(byte *, byte *);
50 uns identify_protocol(byte *);
51 int url_has_repeated_component(byte *url);
57 #define URL_ERR_TOO_LONG 1
58 #define URL_ERR_INVALID_CHAR 2
59 #define URL_ERR_INVALID_ESCAPE 3
60 #define URL_ERR_INVALID_ESCAPED_CHAR 4
61 #define URL_ERR_INVALID_PORT 5
62 #define URL_ERR_REL_NOTHING 6
63 #define URL_ERR_UNKNOWN_PROTOCOL 7
64 #define URL_SYNTAX_ERROR 8
65 #define URL_PATH_UNDERFLOW 9
67 #define URL_PROTO_UNKNOWN 0
68 #define URL_PROTO_HTTP 1
69 #define URL_PROTO_FTP 2
70 #define URL_PROTO_FILE 3
71 #define URL_PROTO_MAX 5
73 #define URL_PNAMES { "unknown", "http", "ftp", "file" }
74 #define URL_DEFPORTS { ~0, 80, 21, 0 }
75 #define URL_PATH_FLAGS { 0, 1, 1, 1 }
77 extern byte *url_proto_names[];