-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhttp_request.h
33 lines (23 loc) · 872 Bytes
/
http_request.h
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
// Copyright (c) 2022, Eugene Gershnik
// SPDX-License-Identifier: BSD-3-Clause
#ifndef HEADER_HTTP_REQUEST_H_INCLUDED
#define HEADER_HTTP_REQUEST_H_INCLUDED
struct HttpRequest {
enum class HeaderError {
NotUnique = 1,
BadFormat
};
template<class T>
using Outcome = outcome::outcome<T, HeaderError>;
auto getUniqueHeader(const sys_string & name) const -> Outcome<std::optional<sys_string>>;
auto getHeaderList(const sys_string & name) const -> std::optional<sys_string>;
auto getContentLength() const -> Outcome<std::optional<size_t>>;
auto getContentType() const -> Outcome<std::optional<std::vector<sys_string>>>;
auto getKeepAlive() const -> bool;
sys_string method;
sys_string uri;
unsigned versionMajor;
unsigned versionMinor;
std::multimap<sys_string, sys_string> headers;
};
#endif