]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_civetweb.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / rgw / rgw_civetweb.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 #ifndef CEPH_RGW_MONGOOSE_H
5 #define CEPH_RGW_MONGOOSE_H
6 #define TIME_BUF_SIZE 128
7
8 #include "rgw_client_io.h"
9
10
11 struct mg_connection;
12
13 class RGWCivetWeb : public rgw::io::RestfulClient,
14 public rgw::io::BuffererSink {
15 RGWEnv env;
16 mg_connection *conn;
17
18 int port;
19
20 bool explicit_keepalive;
21 bool explicit_conn_close;
22 bool got_eof_on_read;
23
24 rgw::io::StaticOutputBufferer<> txbuf;
25
26 size_t write_data(const char *buf, size_t len) override;
27 size_t read_data(char *buf, size_t len);
28 size_t dump_date_header();
29
30 public:
31 [[nodiscard]] int init_env(CephContext *cct) override;
32
33 size_t send_status(int status, const char *status_name) override;
34 size_t send_100_continue() override;
35 size_t send_header(const boost::string_ref& name,
36 const boost::string_ref& value) override;
37 size_t send_content_length(uint64_t len) override;
38 size_t complete_header() override;
39
40 size_t recv_body(char* buf, size_t max) override {
41 return read_data(buf, max);
42 }
43
44 size_t send_body(const char* buf, size_t len) override {
45 return write_data(buf, len);
46 }
47
48 size_t complete_request() override;
49
50 void flush() override;
51
52 RGWEnv& get_env() noexcept override {
53 return env;
54 }
55
56 explicit RGWCivetWeb(mg_connection *_conn);
57 };
58
59 #endif