xref: /lighttpd1.4/src/burl.h (revision 49e9f0ac)
1 #ifndef INCLUDED_BURL_H
2 #define INCLUDED_BURL_H
3 #include "first.h"
4 
5 #include "buffer.h"
6 
7 struct burl_parts_t {
8   buffer *scheme;
9   buffer *authority;
10   unsigned short port;
11   buffer *path;
12   buffer *query;
13 };
14 
15 enum burl_opts_e {
16   HTTP_PARSEOPT_HEADER_STRICT  = 0x1
17  ,HTTP_PARSEOPT_HOST_STRICT    = 0x2
18  ,HTTP_PARSEOPT_HOST_NORMALIZE = 0x4
19  ,HTTP_PARSEOPT_URL_NORMALIZE  = 0x8/*normalize chars %-encoded, uppercase hex*/
20  ,HTTP_PARSEOPT_URL_NORMALIZE_UNRESERVED          =0x10 /* decode unreserved */
21  ,HTTP_PARSEOPT_URL_NORMALIZE_REQUIRED            =0x20 /* decode (un)reserved*/
22  ,HTTP_PARSEOPT_URL_NORMALIZE_CTRLS_REJECT        =0x40
23  ,HTTP_PARSEOPT_URL_NORMALIZE_PATH_BACKSLASH_TRANS=0x80 /* "\\" -> "/" Cygwin */
24  ,HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_DECODE      =0x100/* "%2F"-> "/" */
25  ,HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_REJECT      =0x200
26  ,HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REMOVE  =0x400/* "." ".." "//" */
27  ,HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REJECT  =0x800
28  ,HTTP_PARSEOPT_URL_NORMALIZE_QUERY_20_PLUS       =0x1000
29  ,HTTP_PARSEOPT_METHOD_GET_BODY                   =0x8000
30 };
31 
32 int burl_normalize (buffer *b, buffer *t, int flags);
33 
34 enum burl_recoding_e {
35   BURL_TOLOWER         = 0x0001
36  ,BURL_TOUPPER         = 0x0002
37  ,BURL_ENCODE_NONE     = 0x0004
38  ,BURL_ENCODE_ALL      = 0x0008
39  ,BURL_ENCODE_NDE      = 0x0010 /* encode delims, but no-double-encode (NDE) */
40  ,BURL_ENCODE_PSNDE    = 0x0020 /* similar to NDE, but preserve literal slash */
41  ,BURL_ENCODE_B64U     = 0x0040
42  ,BURL_DECODE_B64U     = 0x0080
43 };
44 
45 void burl_append (buffer * const b, const char * const str, const size_t len, const int flags);
46 
47 #endif
48