]>
Commit | Line | Data |
---|---|---|
1fa9b1a7 AJ |
1 | #ifndef _SQUID_INCLUDE_RFC1738_H |
2 | #define _SQUID_INCLUDE_RFC1738_H | |
3 | ||
25f98340 AJ |
4 | #ifdef __cplusplus |
5 | extern "C" { | |
6 | #endif | |
1fa9b1a7 | 7 | |
8236d34f | 8 | /* Encoder rfc1738_do_escape flag values. */ |
1fa9b1a7 AJ |
9 | #define RFC1738_ESCAPE_UNSAFE 0 |
10 | #define RFC1738_ESCAPE_RESERVED 1 | |
11 | #define RFC1738_ESCAPE_UNESCAPED -1 | |
12 | ||
13 | ||
8236d34f A |
14 | /** |
15 | * \group rfc1738 RFC 1738 URL-escaping library | |
16 | * | |
17 | * Public API is formed of a triplet of encode functions mapping to the rfc1738_do_encode() engine. | |
18 | * | |
19 | * ASCII characters are split into three groups: | |
20 | * \item SAFE Characters which are safe to occur in any URL. For example A,B,C | |
21 | * \item UNSAFE Characters which are completely usafe to occur in any URL. For example; backspace, tab, space, newline | |
22 | * \item RESERVED Characters which are reserved for special meaning and may only occur in certain parts of a URL. | |
23 | * | |
24 | * Returns a static buffer containing the RFC 1738 compliant, escaped version of the given url. | |
25 | * | |
26 | * \param flags RFC1738_ESCAPE_UNSAFE Only encode unsafe characters. Ignore reserved. | |
27 | * \param flags RFC1738_ESCAPE_RESERVED Encode all unsafe and reserved characters. | |
28 | * \param flags RFC1738_ESCAPE_UNESCAPED Encode all unsafe characters which have not already been encoded. | |
29 | */ | |
30 | extern char *rfc1738_do_escape(const char *url, int flags); | |
31 | ||
32 | /* Old API functions */ | |
1fa9b1a7 AJ |
33 | #define rfc1738_escape(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNSAFE) |
34 | #define rfc1738_escape_part(x) rfc1738_do_escape(x, RFC1738_ESCAPE_RESERVED) | |
35 | #define rfc1738_escape_unescaped(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNESCAPED) | |
36 | ||
37 | ||
8236d34f A |
38 | /** |
39 | * Unescape a URL string according to RFC 1738 specification. | |
40 | * String is unescaped in-place | |
41 | */ | |
42 | extern void rfc1738_unescape(char *url); | |
1fa9b1a7 | 43 | |
25f98340 AJ |
44 | #ifdef __cplusplus |
45 | } | |
46 | #endif | |
1fa9b1a7 | 47 | #endif /* _SQUID_INCLUDE_RFC1738_H */ |