MySQL 8.4.0
Source Code Documentation
uri.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_URI_H_
27#define ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_URI_H_
28
29#include <string>
30
31#include "mysqlrouter/uri.h"
32
34
35namespace http {
36namespace base {
37
39 public:
40 Uri();
41 Uri(const std::string &uri); // NOLINT(runtime/explicit)
42 Uri(Uri &&uri);
43 Uri(const Uri &uri);
44 virtual ~Uri();
45
46 /**
47 * convert URI to string.
48 */
49 virtual std::string join() const;
50 virtual std::string join_path() const;
51
52 virtual std::string get_scheme() const;
53 virtual void set_scheme(const std::string &scheme);
54
55 virtual std::string get_userinfo() const;
56 virtual void set_userinfo(const std::string &userinfo);
57
58 virtual std::string get_host() const;
59 virtual void set_host(const std::string &host);
60
61 // Return -1 and uint16_t range
62 virtual int32_t get_port() const;
63 virtual void set_port(int32_t port);
64 /**
65 * get path part of the URI.
66 */
67 virtual std::string get_path() const;
68 virtual void set_path(const std::string &path);
69
70 virtual std::string get_fragment() const;
71 virtual void set_fragment(const std::string &fragment);
72
73 virtual std::string get_query() const;
74 virtual bool set_query(const std::string &query);
75
76 /**
77 * check if URI is valid.
78 */
79 operator bool() const;
80
81 Uri &operator=(Uri &&other);
82 Uri &operator=(const Uri &other);
83
84 private:
86};
87
88/**
89 * canonicalize a URI path.
90 *
91 * input | output
92 * -------|-------
93 * / | /
94 * /./ | /
95 * // | /
96 * /../ | /
97 * /a/../ | /
98 * /../a/ | /a/
99 * /../a | /a
100 */
102 const std::string &uri_path);
103
104} // namespace base
105} // namespace http
106
107#endif // ROUTER_SRC_HTTP_INCLUDE_HTTP_BASE_URI_H_
Definition: uri.h:38
virtual ~Uri()
mysqlrouter::URI uri_impl_
Definition: uri.h:85
Parse and create URIs according to RFC3986.
Definition: uri.h:70
#define HTTP_COMMON_EXPORT
Definition: http_common_export.h:40
static char * query
Definition: myisam_ftdump.cc:47
const char * host
Definition: mysqladmin.cc:65
static char * path
Definition: mysqldump.cc:149
HTTP_COMMON_EXPORT std::string http_uri_path_canonicalize(const std::string &uri_path)
canonicalize a URI path.
Definition: uri.cc:182
Request::Uri Uri
Definition: request.cc:37
Definition: connection.h:56
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33