Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / 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
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
23   rgw::io::StaticOutputBufferer<> txbuf;
24
25   size_t write_data(const char *buf, size_t len) override;
26   size_t read_data(char *buf, size_t len);
27   size_t dump_date_header();
28
29 public:
30   void init_env(CephContext *cct) override;
31
32   size_t send_status(int status, const char *status_name) override;
33   size_t send_100_continue() override;
34   size_t send_header(const boost::string_ref& name,
35                      const boost::string_ref& value) override;
36   size_t send_content_length(uint64_t len) override;
37   size_t complete_header() override;
38
39   size_t recv_body(char* buf, size_t max) override {
40     return read_data(buf, max);
41   }
42
43   size_t send_body(const char* buf, size_t len) override {
44     return write_data(buf, len);
45   }
46
47   size_t complete_request() override;
48
49   void flush() override;
50
51   RGWEnv& get_env() noexcept override {
52     return env;
53   }
54
55   RGWCivetWeb(mg_connection *_conn);
56 };
57
58 #endif