Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_http_req.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
39
40#ifndef N_HTTP_REQ_H
41#define N_HTTP_REQ_H
42
43#include <stddef.h>
44
46#define N_HTTP_REQ_HEAD_MAX 16384u
48#define N_HTTP_REQ_PATH_MAX 2048u
50#define N_HTTP_REQ_HEADERS_MAX 64u
52#define N_HTTP_REQ_BODY_MAX (1024u * 1024u)
54#define N_HTTP_REQ_AUTH_MAX 256u
55
61
75
83
105n_http_req_status n_http_request_parse(const char* buf, size_t len, n_http_request* out);
106
107#endif /* N_HTTP_REQ_H */
n_http_req_status
Result of n_http_request_parse.
Definition n_http_req.h:78
@ N_HTTP_REQ_INCOMPLETE
no CRLFCRLF yet, still under the cap
Definition n_http_req.h:80
@ N_HTTP_REQ_ERROR
malformed / oversized / unsupported
Definition n_http_req.h:81
@ N_HTTP_REQ_OK
a complete, valid head was parsed
Definition n_http_req.h:79
size_t head_len
Definition n_http_req.h:72
n_http_req_status n_http_request_parse(const char *buf, size_t len, n_http_request *out)
parse an HTTP/1.1 request head from [buf, buf+len)
Definition n_http_req.c:83
char authorization[256u+1]
Definition n_http_req.h:73
char path[2048u+1]
Definition n_http_req.h:70
#define N_HTTP_REQ_AUTH_MAX
Longest captured Authorization header value.
Definition n_http_req.h:54
long long content_length
Definition n_http_req.h:71
n_http_req_method method
Definition n_http_req.h:69
n_http_req_method
The methods accepted.
Definition n_http_req.h:57
@ N_HTTP_REQ_POST
Definition n_http_req.h:59
@ N_HTTP_REQ_GET
Definition n_http_req.h:58
#define N_HTTP_REQ_PATH_MAX
Longest origin-form request target ('/'-prefixed, query included).
Definition n_http_req.h:48
A parsed request head.
Definition n_http_req.h:68