Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.189.3.134
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
include /
Delete
Unzip
Name
Size
Permission
Date
Action
X11
[ DIR ]
drwxr-xr-x
2021-11-09 08:51
alsa
[ DIR ]
drwxr-xr-x
2021-11-09 08:48
arpa
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
asm
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
asm-generic
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
atk-1.0
[ DIR ]
drwxr-xr-x
2021-11-09 08:47
bits
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
brotli
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
c++
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
drm
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
et
[ DIR ]
drwxr-xr-x
2022-01-26 14:47
gio-unix-2.0
[ DIR ]
drwxr-xr-x
2021-11-09 08:47
glib-2.0
[ DIR ]
drwxr-xr-x
2021-11-09 08:47
gnu
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
gssapi
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
gssrpc
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
kadm5
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
krb5
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
linux
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
misc
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
mtd
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
net
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netash
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netatalk
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netax25
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
neteconet
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netinet
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netipx
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netiucv
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netpacket
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netrom
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
netrose
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
nfs
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
nspr4
[ DIR ]
drwxr-xr-x
2021-11-09 08:47
nss3
[ DIR ]
drwxr-xr-x
2021-11-09 08:47
openssl
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
protocols
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
python2.7
[ DIR ]
drwxr-xr-x
2021-11-01 09:21
python3.6m
[ DIR ]
drwxr-xr-x
2022-01-26 14:47
rdma
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
rpc
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
rpcsvc
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
scsi
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
selinux
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
sepol
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
sound
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
sys
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
telepathy-1.0
[ DIR ]
drwxr-xr-x
2014-06-09 22:16
uapi
[ DIR ]
drwxr-xr-x
2022-01-14 14:10
uv
[ DIR ]
drwxr-xr-x
2022-01-26 14:47
video
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
xen
[ DIR ]
drwxr-xr-x
2022-01-26 14:48
_G_config.h
1.26
KB
-rw-r--r--
2021-10-13 18:06
a.out.h
4.25
KB
-rw-r--r--
2021-10-13 18:06
aio.h
7.27
KB
-rw-r--r--
2021-10-13 18:07
aliases.h
2
KB
-rw-r--r--
2021-10-13 18:07
alloca.h
1.19
KB
-rw-r--r--
2021-10-13 18:06
ar.h
1.68
KB
-rw-r--r--
2021-10-13 18:06
argp.h
24.75
KB
-rw-r--r--
2021-10-13 18:06
argz.h
6.96
KB
-rw-r--r--
2021-10-13 18:06
assert.h
3.52
KB
-rw-r--r--
2021-10-13 18:06
byteswap.h
1.41
KB
-rw-r--r--
2021-10-13 18:06
com_err.h
2.07
KB
-rw-r--r--
2012-07-06 13:37
complex.h
3.62
KB
-rw-r--r--
2021-10-13 18:06
cpio.h
2.21
KB
-rw-r--r--
2021-10-13 18:06
cpufreq.h
5.8
KB
-rw-r--r--
2022-01-14 14:10
crypt.h
2.22
KB
-rw-r--r--
2021-10-13 18:06
ctype.h
11.52
KB
-rw-r--r--
2021-10-13 18:06
dirent.h
12.34
KB
-rw-r--r--
2021-10-13 18:06
dlfcn.h
6.88
KB
-rw-r--r--
2021-10-13 18:06
elf.h
141.01
KB
-rw-r--r--
2021-10-13 18:07
endian.h
2.95
KB
-rw-r--r--
2021-10-13 18:06
envz.h
2.82
KB
-rw-r--r--
2021-10-13 18:06
err.h
2.18
KB
-rw-r--r--
2021-10-13 18:06
errno.h
2.33
KB
-rw-r--r--
2021-10-13 18:06
error.h
2.01
KB
-rw-r--r--
2021-10-13 18:06
execinfo.h
1.5
KB
-rw-r--r--
2021-10-13 18:07
fcntl.h
9.89
KB
-rw-r--r--
2021-10-13 18:06
features.h
12.87
KB
-rw-r--r--
2021-10-13 18:06
fenv.h
4.5
KB
-rw-r--r--
2021-10-13 18:06
fmtmsg.h
3.18
KB
-rw-r--r--
2021-10-13 18:06
fnmatch.h
2.27
KB
-rw-r--r--
2021-10-13 18:06
fpu_control.h
3.5
KB
-rw-r--r--
2021-10-13 18:06
fstab.h
3.04
KB
-rw-r--r--
2021-10-13 18:06
fts.h
5.17
KB
-rw-r--r--
2021-10-13 18:06
ftw.h
5.15
KB
-rw-r--r--
2021-10-13 18:06
gconv.h
5.16
KB
-rw-r--r--
2021-10-13 18:06
getopt.h
6.53
KB
-rw-r--r--
2021-10-13 18:06
glob.h
6.51
KB
-rw-r--r--
2021-10-13 18:06
gnu-versions.h
2.29
KB
-rw-r--r--
2021-10-13 18:06
grp.h
6.75
KB
-rw-r--r--
2021-10-13 18:06
gshadow.h
4.43
KB
-rw-r--r--
2021-10-13 18:06
gssapi.h
181
B
-rw-r--r--
2021-12-02 15:32
http_parser.h
18.55
KB
-rw-r--r--
2020-09-30 16:32
iconv.h
1.83
KB
-rw-r--r--
2021-10-13 18:06
ieee754.h
4.81
KB
-rw-r--r--
2021-10-13 18:06
ifaddrs.h
2.77
KB
-rw-r--r--
2021-10-13 18:07
inttypes.h
11.61
KB
-rw-r--r--
2021-10-13 18:06
kdb.h
60.12
KB
-rw-r--r--
2021-12-02 15:32
keyutils.h
7.08
KB
-rw-r--r--
2014-06-10 02:17
krad.h
8.72
KB
-rw-r--r--
2021-12-02 15:32
krb5.h
402
B
-rw-r--r--
2021-12-02 15:32
langinfo.h
15.57
KB
-rw-r--r--
2021-10-13 18:06
lastlog.h
126
B
-rw-r--r--
2021-10-13 18:07
libgen.h
1.37
KB
-rw-r--r--
2021-10-13 18:06
libintl.h
4.49
KB
-rw-r--r--
2021-10-13 18:06
libio.h
16.87
KB
-rw-r--r--
2021-10-13 18:06
limits.h
4.42
KB
-rw-r--r--
2021-10-13 18:06
link.h
6.99
KB
-rw-r--r--
2021-10-13 18:07
locale.h
7.78
KB
-rw-r--r--
2021-10-13 18:06
malloc.h
6.44
KB
-rw-r--r--
2021-10-13 18:06
math.h
15.7
KB
-rw-r--r--
2021-10-13 18:06
mcheck.h
2.4
KB
-rw-r--r--
2021-10-13 18:06
memory.h
962
B
-rw-r--r--
2021-10-13 18:06
mntent.h
3.3
KB
-rw-r--r--
2021-10-13 18:06
monetary.h
1.73
KB
-rw-r--r--
2021-10-13 18:06
mqueue.h
3.7
KB
-rw-r--r--
2021-10-13 18:07
netdb.h
27.46
KB
-rw-r--r--
2021-10-13 18:06
nl_types.h
1.73
KB
-rw-r--r--
2021-10-13 18:06
nss.h
1.85
KB
-rw-r--r--
2021-10-13 18:07
obstack.h
18.84
KB
-rw-r--r--
2021-10-13 18:06
paths.h
2.91
KB
-rw-r--r--
2021-10-13 18:06
pcre.h
29.73
KB
-rw-r--r--
2017-08-02 03:07
pcre_scanner.h
6.45
KB
-rw-r--r--
2017-08-02 03:07
pcre_stringpiece.h
6.11
KB
-rw-r--r--
2017-08-02 03:07
pcrecpp.h
25.91
KB
-rw-r--r--
2017-08-02 03:07
pcrecpparg.h
6.62
KB
-rw-r--r--
2017-08-02 03:07
pcreposix.h
5.32
KB
-rw-r--r--
2017-08-02 03:07
poll.h
22
B
-rw-r--r--
2021-10-13 18:06
printf.h
6.56
KB
-rw-r--r--
2021-10-13 18:06
profile.h
11.87
KB
-rw-r--r--
2021-12-02 15:32
pthread.h
39.95
KB
-rw-r--r--
2021-10-13 18:06
pty.h
1.51
KB
-rw-r--r--
2021-10-13 18:07
pwd.h
5.87
KB
-rw-r--r--
2021-10-13 18:06
re_comp.h
957
B
-rw-r--r--
2021-10-13 18:06
regex.h
21.58
KB
-rw-r--r--
2021-10-13 18:06
regexp.h
6.89
KB
-rw-r--r--
2021-10-13 18:06
resolv.h
14.67
KB
-rw-r--r--
2021-10-13 18:06
sched.h
4.55
KB
-rw-r--r--
2021-10-13 18:06
search.h
5.11
KB
-rw-r--r--
2021-10-13 18:06
semaphore.h
2.36
KB
-rw-r--r--
2021-10-13 18:06
setjmp.h
3.97
KB
-rw-r--r--
2021-10-13 18:06
sgtty.h
1.33
KB
-rw-r--r--
2021-10-13 18:06
shadow.h
5.1
KB
-rw-r--r--
2021-10-13 18:06
signal.h
13.3
KB
-rw-r--r--
2021-10-13 18:06
spawn.h
6.53
KB
-rw-r--r--
2021-10-13 18:06
stab.h
264
B
-rw-r--r--
2021-10-13 18:06
stdc-predef.h
1.59
KB
-rw-r--r--
2021-10-13 18:06
stdint.h
7.94
KB
-rw-r--r--
2021-10-13 18:06
stdio.h
30.9
KB
-rw-r--r--
2021-10-13 18:06
stdio_ext.h
2.74
KB
-rw-r--r--
2021-10-13 18:06
stdlib.h
33.23
KB
-rw-r--r--
2021-10-13 18:06
string.h
21.75
KB
-rw-r--r--
2021-10-13 18:06
strings.h
4.55
KB
-rw-r--r--
2021-10-13 18:06
syscall.h
25
B
-rw-r--r--
2021-10-13 18:06
sysexits.h
5.11
KB
-rw-r--r--
2021-10-13 18:06
syslog.h
24
B
-rw-r--r--
2021-10-13 18:06
tar.h
3.67
KB
-rw-r--r--
2021-10-13 18:06
termio.h
214
B
-rw-r--r--
2021-10-13 18:06
termios.h
3.52
KB
-rw-r--r--
2021-10-13 18:06
tgmath.h
18.11
KB
-rw-r--r--
2021-10-13 18:06
thread_db.h
15.65
KB
-rw-r--r--
2021-10-13 18:07
time.h
13.4
KB
-rw-r--r--
2021-10-13 18:06
ttyent.h
2.44
KB
-rw-r--r--
2021-10-13 18:06
uchar.h
2.42
KB
-rw-r--r--
2021-10-13 18:06
ucontext.h
1.92
KB
-rw-r--r--
2021-10-13 18:06
ulimit.h
1.55
KB
-rw-r--r--
2021-10-13 18:06
unistd.h
41.78
KB
-rw-r--r--
2021-10-13 18:06
ustat.h
23
B
-rw-r--r--
2021-10-13 18:06
utime.h
1.5
KB
-rw-r--r--
2021-10-13 18:06
utmp.h
3.16
KB
-rw-r--r--
2021-10-13 18:07
utmpx.h
4.02
KB
-rw-r--r--
2021-10-13 18:07
uv.h
65.59
KB
-rw-r--r--
2022-01-05 22:31
values.h
1.92
KB
-rw-r--r--
2021-10-13 18:06
verto-module.h
6.48
KB
-rw-r--r--
2014-06-10 07:44
verto.h
18.57
KB
-rw-r--r--
2014-06-10 07:44
wait.h
22
B
-rw-r--r--
2021-10-13 18:06
wchar.h
31.37
KB
-rw-r--r--
2021-10-13 18:06
wctype.h
10.89
KB
-rw-r--r--
2021-10-13 18:06
wordexp.h
2.47
KB
-rw-r--r--
2021-10-13 18:06
xlocale.h
1.66
KB
-rw-r--r--
2021-10-13 18:06
zconf.h
14.92
KB
-rw-r--r--
2021-02-02 16:35
zlib.h
84.68
KB
-rw-r--r--
2021-02-02 16:35
Save
Rename
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef http_parser_h #define http_parser_h #ifdef __cplusplus extern "C" { #endif /* Also update SONAME in the Makefile whenever you change these. */ #define HTTP_PARSER_VERSION_MAJOR 2 #define HTTP_PARSER_VERSION_MINOR 7 #define HTTP_PARSER_VERSION_PATCH 1 #include <sys/types.h> #if defined(_WIN32) && !defined(__MINGW32__) && \ (!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__) #include <BaseTsd.h> #include <stddef.h> typedef __int8 int8_t; typedef unsigned __int8 uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else #include <stdint.h> #endif /* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run * faster */ #ifndef HTTP_PARSER_STRICT # define HTTP_PARSER_STRICT 1 #endif /* Maximium header size allowed. If the macro is not defined * before including this header then the default is used. To * change the maximum header size, define the macro in the build * environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove * the effective limit on the size of the header, define the macro * to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff) */ #ifndef HTTP_MAX_HEADER_SIZE # define HTTP_MAX_HEADER_SIZE (80*1024) #endif typedef struct http_parser http_parser; typedef struct http_parser_settings http_parser_settings; /* Callbacks should return non-zero to indicate an error. The parser will * then halt execution. * * The one exception is on_headers_complete. In a HTTP_RESPONSE parser * returning '1' from on_headers_complete will tell the parser that it * should not expect a body. This is used when receiving a response to a * HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: * chunked' headers that indicate the presence of a body. * * Returning `2` from on_headers_complete will tell parser that it should not * expect neither a body nor any futher responses on this connection. This is * useful for handling responses to a CONNECT request which may not contain * `Upgrade` or `Connection: upgrade` headers. * * http_data_cb does not return data chunks. It will be called arbitrarily * many times for each string. E.G. you might get 10 callbacks for "on_url" * each providing just a few characters more data. */ typedef int (*http_data_cb) (http_parser*, const char *at, size_t length); typedef int (*http_cb) (http_parser*); /* Status Codes */ #define HTTP_STATUS_MAP(XX) \ XX(100, CONTINUE, Continue) \ XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \ XX(102, PROCESSING, Processing) \ XX(200, OK, OK) \ XX(201, CREATED, Created) \ XX(202, ACCEPTED, Accepted) \ XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information) \ XX(204, NO_CONTENT, No Content) \ XX(205, RESET_CONTENT, Reset Content) \ XX(206, PARTIAL_CONTENT, Partial Content) \ XX(207, MULTI_STATUS, Multi-Status) \ XX(208, ALREADY_REPORTED, Already Reported) \ XX(226, IM_USED, IM Used) \ XX(300, MULTIPLE_CHOICES, Multiple Choices) \ XX(301, MOVED_PERMANENTLY, Moved Permanently) \ XX(302, FOUND, Found) \ XX(303, SEE_OTHER, See Other) \ XX(304, NOT_MODIFIED, Not Modified) \ XX(305, USE_PROXY, Use Proxy) \ XX(307, TEMPORARY_REDIRECT, Temporary Redirect) \ XX(308, PERMANENT_REDIRECT, Permanent Redirect) \ XX(400, BAD_REQUEST, Bad Request) \ XX(401, UNAUTHORIZED, Unauthorized) \ XX(402, PAYMENT_REQUIRED, Payment Required) \ XX(403, FORBIDDEN, Forbidden) \ XX(404, NOT_FOUND, Not Found) \ XX(405, METHOD_NOT_ALLOWED, Method Not Allowed) \ XX(406, NOT_ACCEPTABLE, Not Acceptable) \ XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required) \ XX(408, REQUEST_TIMEOUT, Request Timeout) \ XX(409, CONFLICT, Conflict) \ XX(410, GONE, Gone) \ XX(411, LENGTH_REQUIRED, Length Required) \ XX(412, PRECONDITION_FAILED, Precondition Failed) \ XX(413, PAYLOAD_TOO_LARGE, Payload Too Large) \ XX(414, URI_TOO_LONG, URI Too Long) \ XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type) \ XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable) \ XX(417, EXPECTATION_FAILED, Expectation Failed) \ XX(421, MISDIRECTED_REQUEST, Misdirected Request) \ XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity) \ XX(423, LOCKED, Locked) \ XX(424, FAILED_DEPENDENCY, Failed Dependency) \ XX(426, UPGRADE_REQUIRED, Upgrade Required) \ XX(428, PRECONDITION_REQUIRED, Precondition Required) \ XX(429, TOO_MANY_REQUESTS, Too Many Requests) \ XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large) \ XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons) \ XX(500, INTERNAL_SERVER_ERROR, Internal Server Error) \ XX(501, NOT_IMPLEMENTED, Not Implemented) \ XX(502, BAD_GATEWAY, Bad Gateway) \ XX(503, SERVICE_UNAVAILABLE, Service Unavailable) \ XX(504, GATEWAY_TIMEOUT, Gateway Timeout) \ XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported) \ XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates) \ XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \ XX(508, LOOP_DETECTED, Loop Detected) \ XX(510, NOT_EXTENDED, Not Extended) \ XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \ enum http_status { #define XX(num, name, string) HTTP_STATUS_##name = num, HTTP_STATUS_MAP(XX) #undef XX }; /* Request Methods */ #define HTTP_METHOD_MAP(XX) \ XX(0, DELETE, DELETE) \ XX(1, GET, GET) \ XX(2, HEAD, HEAD) \ XX(3, POST, POST) \ XX(4, PUT, PUT) \ /* pathological */ \ XX(5, CONNECT, CONNECT) \ XX(6, OPTIONS, OPTIONS) \ XX(7, TRACE, TRACE) \ /* WebDAV */ \ XX(8, COPY, COPY) \ XX(9, LOCK, LOCK) \ XX(10, MKCOL, MKCOL) \ XX(11, MOVE, MOVE) \ XX(12, PROPFIND, PROPFIND) \ XX(13, PROPPATCH, PROPPATCH) \ XX(14, SEARCH, SEARCH) \ XX(15, UNLOCK, UNLOCK) \ XX(16, BIND, BIND) \ XX(17, REBIND, REBIND) \ XX(18, UNBIND, UNBIND) \ XX(19, ACL, ACL) \ /* subversion */ \ XX(20, REPORT, REPORT) \ XX(21, MKACTIVITY, MKACTIVITY) \ XX(22, CHECKOUT, CHECKOUT) \ XX(23, MERGE, MERGE) \ /* upnp */ \ XX(24, MSEARCH, M-SEARCH) \ XX(25, NOTIFY, NOTIFY) \ XX(26, SUBSCRIBE, SUBSCRIBE) \ XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ /* RFC-5789 */ \ XX(28, PATCH, PATCH) \ XX(29, PURGE, PURGE) \ /* CalDAV */ \ XX(30, MKCALENDAR, MKCALENDAR) \ /* RFC-2068, section 19.6.1.2 */ \ XX(31, LINK, LINK) \ XX(32, UNLINK, UNLINK) \ enum http_method { #define XX(num, name, string) HTTP_##name = num, HTTP_METHOD_MAP(XX) #undef XX }; enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; /* Flag values for http_parser.flags field */ enum flags { F_CHUNKED = 1 << 0 , F_CONNECTION_KEEP_ALIVE = 1 << 1 , F_CONNECTION_CLOSE = 1 << 2 , F_CONNECTION_UPGRADE = 1 << 3 , F_TRAILING = 1 << 4 , F_UPGRADE = 1 << 5 , F_SKIPBODY = 1 << 6 , F_CONTENTLENGTH = 1 << 7 }; /* Map for errno-related constants * * The provided argument should be a macro that takes 2 arguments. */ #define HTTP_ERRNO_MAP(XX) \ /* No error */ \ XX(OK, "success") \ \ /* Callback-related errors */ \ XX(CB_message_begin, "the on_message_begin callback failed") \ XX(CB_url, "the on_url callback failed") \ XX(CB_header_field, "the on_header_field callback failed") \ XX(CB_header_value, "the on_header_value callback failed") \ XX(CB_headers_complete, "the on_headers_complete callback failed") \ XX(CB_body, "the on_body callback failed") \ XX(CB_message_complete, "the on_message_complete callback failed") \ XX(CB_status, "the on_status callback failed") \ XX(CB_chunk_header, "the on_chunk_header callback failed") \ XX(CB_chunk_complete, "the on_chunk_complete callback failed") \ \ /* Parsing-related errors */ \ XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \ XX(HEADER_OVERFLOW, \ "too many header bytes seen; overflow detected") \ XX(CLOSED_CONNECTION, \ "data received after completed connection: close message") \ XX(INVALID_VERSION, "invalid HTTP version") \ XX(INVALID_STATUS, "invalid HTTP status code") \ XX(INVALID_METHOD, "invalid HTTP method") \ XX(INVALID_URL, "invalid URL") \ XX(INVALID_HOST, "invalid host") \ XX(INVALID_PORT, "invalid port") \ XX(INVALID_PATH, "invalid path") \ XX(INVALID_QUERY_STRING, "invalid query string") \ XX(INVALID_FRAGMENT, "invalid fragment") \ XX(LF_EXPECTED, "LF character expected") \ XX(INVALID_HEADER_TOKEN, "invalid character in header") \ XX(INVALID_CONTENT_LENGTH, \ "invalid character in content-length header") \ XX(UNEXPECTED_CONTENT_LENGTH, \ "unexpected content-length header") \ XX(INVALID_CHUNK_SIZE, \ "invalid character in chunk size header") \ XX(INVALID_CONSTANT, "invalid constant string") \ XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ XX(STRICT, "strict mode assertion failed") \ XX(PAUSED, "parser is paused") \ XX(UNKNOWN, "an unknown error occurred") \ XX(INVALID_TRANSFER_ENCODING, \ "request has invalid transfer-encoding") /* Define HPE_* values for each errno value above */ #define HTTP_ERRNO_GEN(n, s) HPE_##n, enum http_errno { HTTP_ERRNO_MAP(HTTP_ERRNO_GEN) }; #undef HTTP_ERRNO_GEN /* Get an http_errno value from an http_parser */ #define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) struct http_parser { /** PRIVATE **/ unsigned int type : 2; /* enum http_parser_type */ unsigned int flags : 8; /* F_* values from 'flags' enum; semi-public */ unsigned int state : 7; /* enum state from http_parser.c */ unsigned int header_state : 7; /* enum header_state from http_parser.c */ unsigned int index : 7; /* index into current matcher */ unsigned int lenient_http_headers : 1; uint32_t nread; /* # bytes read in various scenarios */ uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */ /** READ-ONLY **/ unsigned short http_major; unsigned short http_minor; unsigned int status_code : 16; /* responses only */ unsigned int method : 8; /* requests only */ unsigned int http_errno : 7; /* 1 = Upgrade header was present and the parser has exited because of that. * 0 = No upgrade header present. * Should be checked when http_parser_execute() returns in addition to * error checking. */ unsigned int upgrade : 1; /** PUBLIC **/ void *data; /* A pointer to get hook to the "connection" or "socket" object */ unsigned int transfer_encoding : 8; /* CVE-2019-15605 */ }; struct http_parser_settings { http_cb on_message_begin; http_data_cb on_url; http_data_cb on_status; http_data_cb on_header_field; http_data_cb on_header_value; http_cb on_headers_complete; http_data_cb on_body; http_cb on_message_complete; /* When on_chunk_header is called, the current chunk length is stored * in parser->content_length. */ http_cb on_chunk_header; http_cb on_chunk_complete; }; enum http_parser_url_fields { UF_SCHEMA = 0 , UF_HOST = 1 , UF_PORT = 2 , UF_PATH = 3 , UF_QUERY = 4 , UF_FRAGMENT = 5 , UF_USERINFO = 6 , UF_MAX = 7 }; /* Result structure for http_parser_parse_url(). * * Callers should index into field_data[] with UF_* values iff field_set * has the relevant (1 << UF_*) bit set. As a courtesy to clients (and * because we probably have padding left over), we convert any port to * a uint16_t. */ struct http_parser_url { uint16_t field_set; /* Bitmask of (1 << UF_*) values */ uint16_t port; /* Converted UF_PORT string */ struct { uint16_t off; /* Offset into buffer in which field starts */ uint16_t len; /* Length of run in buffer */ } field_data[UF_MAX]; }; /* Returns the library version. Bits 16-23 contain the major version number, * bits 8-15 the minor version number and bits 0-7 the patch level. * Usage example: * * unsigned long version = http_parser_version(); * unsigned major = (version >> 16) & 255; * unsigned minor = (version >> 8) & 255; * unsigned patch = version & 255; * printf("http_parser v%u.%u.%u\n", major, minor, patch); */ unsigned long http_parser_version(void); void http_parser_init(http_parser *parser, enum http_parser_type type); /* Initialize http_parser_settings members to 0 */ void http_parser_settings_init(http_parser_settings *settings); /* Executes the parser. Returns number of parsed bytes. Sets * `parser->http_errno` on error. */ size_t http_parser_execute(http_parser *parser, const http_parser_settings *settings, const char *data, size_t len); /* If http_should_keep_alive() in the on_headers_complete or * on_message_complete callback returns 0, then this should be * the last message on the connection. * If you are the server, respond with the "Connection: close" header. * If you are the client, close the connection. */ int http_should_keep_alive(const http_parser *parser); /* Returns a string version of the HTTP method. */ const char *http_method_str(enum http_method m); /* Return a string name of the given error */ const char *http_errno_name(enum http_errno err); /* Return a string description of the given error */ const char *http_errno_description(enum http_errno err); /* Initialize all http_parser_url members to 0 */ void http_parser_url_init(struct http_parser_url *u); /* Parse a URL; return nonzero on failure */ int http_parser_parse_url(const char *buf, size_t buflen, int is_connect, struct http_parser_url *u); /* Pause or un-pause the parser; a nonzero value pauses */ void http_parser_pause(http_parser *parser, int paused); /* Checks if this is the final chunk of the body. */ int http_body_is_final(const http_parser *parser); /* Change the maximum header size provided at compile time. */ void http_parser_set_max_header_size(uint32_t size); #ifdef __cplusplus } #endif #endif