Repository navigation
Expand file tree
/
Copy pathrequest_head.hpp
More file actions
61 lines (49 loc) · 2.12 KB
/
Copy pathrequest_head.hpp
File metadata and controls
61 lines (49 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
This file is part of libhttpserver
Copyright (C) 2011-2026 Sebastiano Merlino
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the file
LICENSE in the distribution; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef SRC_HTTPSERVER_HTTP_REQUEST_HEAD_HPP_
#define SRC_HTTPSERVER_HTTP_REQUEST_HEAD_HPP_
#include <string>
#include <httpserver/http/fields.hpp>
#include <httpserver/http/method.hpp>
#include <httpserver/http/protocol.hpp>
namespace httpserver {
namespace http {
// Seed view of a request head (PRD-V3N-REQ-019). Plain aggregate,
// default constructible, copyable and movable.
//
// Invariants:
// - raw_target holds the exact received bytes of the request-target
// (including any percent-escapes, query, and fragment). It is never
// rewritten by the library.
// - route_path is produced only by validation/normalization and is the
// sole input to route matching. It is a distinct member, so a
// normalized path and the received target can (and routinely do)
// differ explicitly.
//
// head_fields carries the header fields; trailers get their own fields
// instance. Later milestones extend this struct with TLS/peer metadata.
struct request_head {
std::string raw_target;
std::string route_path;
method request_method;
protocol request_protocol = protocol::http_1_0;
fields head_fields;
};
} // namespace http
} // namespace httpserver
#endif // SRC_HTTPSERVER_HTTP_REQUEST_HEAD_HPP_