]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_asio_client.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rgw / rgw_asio_client.h
CommitLineData
7c673cae 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
11fdf7f2 3
1e59de90 4#pragma once
7c673cae
FG
5
6#include <boost/asio/ip/tcp.hpp>
b32b8144
FG
7#include <boost/beast/core.hpp>
8#include <boost/beast/http.hpp>
11fdf7f2 9#include "include/ceph_assert.h"
7c673cae
FG
10
11#include "rgw_client_io.h"
12
13namespace rgw {
14namespace asio {
15
b32b8144
FG
16namespace beast = boost::beast;
17using parser_type = beast::http::request_parser<beast::http::buffer_body>;
7c673cae
FG
18
19class ClientIO : public io::RestfulClient,
20 public io::BuffererSink {
f64942e4 21 protected:
7c673cae 22 parser_type& parser;
f64942e4
AA
23 private:
24 const bool is_ssl;
25 using endpoint_type = boost::asio::ip::tcp::endpoint;
26 endpoint_type local_endpoint;
27 endpoint_type remote_endpoint;
7c673cae 28
7c673cae
FG
29 RGWEnv env;
30
31 rgw::io::StaticOutputBufferer<> txbuf;
39ae355f 32 bool sent100continue = false;
7c673cae 33
7c673cae 34 public:
f64942e4
AA
35 ClientIO(parser_type& parser, bool is_ssl,
36 const endpoint_type& local_endpoint,
37 const endpoint_type& remote_endpoint);
7c673cae
FG
38 ~ClientIO() override;
39
3a9019d9 40 int init_env(CephContext *cct) override;
7c673cae
FG
41 size_t complete_request() override;
42 void flush() override;
43 size_t send_status(int status, const char *status_name) override;
44 size_t send_100_continue() override;
f67539c2
TL
45 size_t send_header(const std::string_view& name,
46 const std::string_view& value) override;
7c673cae
FG
47 size_t send_content_length(uint64_t len) override;
48 size_t complete_header() override;
49
7c673cae
FG
50 size_t send_body(const char* buf, size_t len) override {
51 return write_data(buf, len);
52 }
53
54 RGWEnv& get_env() noexcept override {
55 return env;
56 }
39ae355f
TL
57
58 bool sent_100_continue() const { return sent100continue; }
7c673cae
FG
59};
60
61} // namespace asio
62} // namespace rgw