2018-05-01 04:20:26 +00:00
|
|
|
#ifndef INCLUDED_BURL_H
|
|
|
|
#define INCLUDED_BURL_H
|
|
|
|
#include "first.h"
|
|
|
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
2018-07-01 00:11:53 +00:00
|
|
|
struct burl_parts_t {
|
2019-10-10 06:26:05 +00:00
|
|
|
const buffer *scheme;
|
|
|
|
const buffer *authority;
|
2018-07-01 00:44:47 +00:00
|
|
|
unsigned short port;
|
2019-10-10 06:26:05 +00:00
|
|
|
const buffer *path;
|
|
|
|
const buffer *query;
|
2018-07-01 00:11:53 +00:00
|
|
|
};
|
|
|
|
|
2018-05-01 04:20:26 +00:00
|
|
|
enum burl_opts_e {
|
|
|
|
HTTP_PARSEOPT_HEADER_STRICT = 0x1
|
|
|
|
,HTTP_PARSEOPT_HOST_STRICT = 0x2
|
|
|
|
,HTTP_PARSEOPT_HOST_NORMALIZE = 0x4
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE = 0x8/*normalize chars %-encoded, uppercase hex*/
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_UNRESERVED =0x10 /* decode unreserved */
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_REQUIRED =0x20 /* decode (un)reserved*/
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_CTRLS_REJECT =0x40
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_PATH_BACKSLASH_TRANS=0x80 /* "\\" -> "/" Cygwin */
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_DECODE =0x100/* "%2F"-> "/" */
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_PATH_2F_REJECT =0x200
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REMOVE =0x400/* "." ".." "//" */
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_PATH_DOTSEG_REJECT =0x800
|
|
|
|
,HTTP_PARSEOPT_URL_NORMALIZE_QUERY_20_PLUS =0x1000
|
2019-02-22 04:55:59 +00:00
|
|
|
,HTTP_PARSEOPT_METHOD_GET_BODY =0x8000
|
2018-05-01 04:20:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int burl_normalize (buffer *b, buffer *t, int flags);
|
|
|
|
|
2018-07-01 00:44:47 +00:00
|
|
|
enum burl_recoding_e {
|
|
|
|
BURL_TOLOWER = 0x0001
|
|
|
|
,BURL_TOUPPER = 0x0002
|
|
|
|
,BURL_ENCODE_NONE = 0x0004
|
|
|
|
,BURL_ENCODE_ALL = 0x0008
|
|
|
|
,BURL_ENCODE_NDE = 0x0010 /* encode delims, but no-double-encode (NDE) */
|
|
|
|
,BURL_ENCODE_PSNDE = 0x0020 /* similar to NDE, but preserve literal slash */
|
2018-07-08 20:16:00 +00:00
|
|
|
,BURL_ENCODE_B64U = 0x0040
|
|
|
|
,BURL_DECODE_B64U = 0x0080
|
2018-07-01 00:44:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void burl_append (buffer * const b, const char * const str, const size_t len, const int flags);
|
|
|
|
|
2018-05-01 04:20:26 +00:00
|
|
|
#endif
|