MySQL 9.1.0
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 virtual void insert(Iterator it, const std::string_view &key,
57 std::string &&value);
58
59 virtual const std::string *find(const std::string_view &) const;
60 virtual const char *find_cstr(const char *) const;
61
62 virtual Iterator begin();
63 virtual Iterator end();
64
65 virtual CIterator begin() const;
66 virtual CIterator end() const;
67
68 virtual uint32_t size() const;
69
70 virtual void clear();
71
72 private:
73 void remove(const std::string_view &key);
74 mutable Map map_;
75};
76
77HTTP_COMMON_EXPORT bool compare_case_insensitive(const std::string &l,
78 const std::string_view &r);
79
80} // namespace base
81} // namespace http
82
83#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:74
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
void insert(dd::cache::SPI_lru_cache_owner_ptr &c, dd::Object_id id)
Definition: dictionary_client.cc:3252
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