MySQL 9.0.0
Source Code Documentation
request.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 override; 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 override; 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 override; 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_SRC_HTTP_SERVER_REQUEST_H_
27#define ROUTER_SRC_HTTP_SRC_HTTP_SERVER_REQUEST_H_
28
29#include <ctime>
30#include <memory>
31#include <string>
32#include <system_error> // NOLINT(build/c++11)
33
34#include "http/base/request.h"
35
37
38namespace http {
39namespace server {
40
41/**
42 * a HTTP request and response.
43 *
44 * wraps evhttp_request
45 */
47 public:
48 struct Holder {
49 uint32_t stream_id_{0};
55 };
56
57 public:
58 ServerRequest() = default;
59 ServerRequest(ConnectionInterface *connection, const uint32_t session_id,
60 const base::method::key_type method, const std::string &path,
61 Headers &&headers);
62
63 Headers &get_output_headers() override;
64 IOBuffer &get_output_buffer() override;
65
66 const std::string &get_input_body() const override;
67 const Headers &get_input_headers() const override;
68 IOBuffer &get_input_buffer() const override;
69
70 MethodType get_method() const override;
71
72 const Uri &get_uri() const override;
73
74 void send_reply(StatusType status_code) override;
75 void send_reply(StatusType status_code,
76 const std::string &status_text) override;
77 void send_reply(StatusType status_code, const std::string &status_text,
78 const IOBuffer &buffer) override;
79
80 void send_error(StatusType status_code) override;
81 void send_error(StatusType status_code,
82 const std::string &status_text) override;
83
84 static void sync_callback(Request *, void *);
85
86 /**
87 * is request modified since 'last_modified'.
88 *
89 * @return true, if local content is newer than the clients last known date,
90 * false otherwise
91 */
92 bool is_modified_since(time_t last_modified) override;
93
94 /**
95 * add a Last-Modified-Since header to the response headers.
96 */
97 bool add_last_modified(time_t last_modified) override;
98
99 ConnectionInterface *get_connection() const override { return connection_; }
100
101 Holder &get_data() { return holder_; }
102
103 private:
105 ConnectionInterface *connection_{nullptr};
107};
108
109} // namespace server
110} // namespace http
111
112#endif // ROUTER_SRC_HTTP_SRC_HTTP_SERVER_REQUEST_H_
Definition: connection_interface.h:41
headers of a HTTP response/request.
Definition: headers.h:43
Definition: io_buffer.h:41
Definition: request.h:44
http::base::method::key_type MethodType
Definition: request.h:49
http::base::status_code::key_type StatusType
Definition: request.h:50
Definition: uri.h:38
Definition: request.h:39
a HTTP request and response.
Definition: request.h:46
static void sync_callback(Request *, void *)
Uri uri_
Definition: request.h:104
Holder holder_
Definition: request.h:106
ConnectionInterface * get_connection() const override
Definition: request.h:99
Holder & get_data()
Definition: request.h:101
#define HTTP_SERVER_LIB_EXPORT
Definition: http_server_lib_export.h:15
static char * path
Definition: mysqldump.cc:149
constexpr key_type Get
Definition: method.h:60
int key_type
Definition: method.h:38
Definition: connection.h:56
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Definition: request.h:48
IOBuffer input_body_
Definition: request.h:53
Headers output_headers_
Definition: request.h:52
IOBuffer output_body_
Definition: request.h:54
Headers input_headers_
Definition: request.h:51
Definition: server_struct.h:39