MySQL 8.4.2
Source Code Documentation
headers.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_HEADERS_H_
27#define ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_HEADERS_H_
28
29#include <cstdint>
30#include <string>
31#include <string_view>
32#include <utility>
33#include <vector>
34
36
37namespace http {
38namespace base {
39
40/**
41 * headers of a HTTP response/request.
42 */
44 public:
46 Headers(Headers &&h);
47 virtual ~Headers();
48
49 // The default implementation was done at std::map,
50 // still it doesn't preserve the fields order.
51 using Map = std::vector<std::pair<std::string, std::string>>;
52 using Iterator = Map::iterator;
53 using CIterator = Map::const_iterator;
54
55 virtual void add(const std::string_view &key, std::string &&value);
56
57 virtual const std::string *find(const std::string_view &) const;
58 virtual const char *find_cstr(const char *) const;
59
60 virtual Iterator begin();
61 virtual Iterator end();
62
63 virtual CIterator begin() const;
64 virtual CIterator end() const;
65
66 virtual uint32_t size() const;
67
68 virtual void clear();
69
70 private:
71 void remove(const std::string_view &key);
72 mutable Map map_;
73};
74
75HTTP_COMMON_EXPORT bool compare_case_insensitive(const std::string &l,
76 const std::string_view &r);
77
78} // namespace base
79} // namespace http
80
81#endif // ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_HEADERS_H_
headers of a HTTP response/request.
Definition: headers.h:43
Map::iterator Iterator
Definition: headers.h:52
Map map_
Definition: headers.h:72
std::vector< std::pair< std::string, std::string > > Map
Definition: headers.h:51
Map::const_iterator CIterator
Definition: headers.h:53
#define HTTP_COMMON_EXPORT
Definition: http_common_export.h:15
Container::const_iterator find(const Container &c, Value &&value)
Definition: generic.h:39
HTTP_COMMON_EXPORT bool compare_case_insensitive(const std::string &l, const std::string_view &r)
Definition: headers.cc:37
Request::Headers Headers
Definition: request.cc:35
Definition: connection.h:56
const char * begin(const char *const c)
Definition: base64.h:44
size_t size(const char *const c)
Definition: base64.h:46
static mysql_service_status_t remove(reference_caching_channel channel, const char *implementation_name) noexcept
Definition: component.cc:137
static mysql_service_status_t clear(reference_caching_channel channel) noexcept
Definition: component.cc:146
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
required string key
Definition: replication_asynchronous_connection_failover.proto:60