auto bytes = boost::asio::write(socket, boost::asio::buffer(buf, len), ec);
if (ec) {
derr << "write_data failed with " << ec.message() << dendl;
- throw RGWStreamIOEngine::Exception(-ec.value());
+ throw RGWRestfulIOEngine::Exception(-ec.value());
}
return bytes;
}
Headers>;
};
-class RGWAsioClientIO : public RGWStreamIOEngine {
+class RGWAsioClientIO : public RGWRestfulIOEngine {
using tcp = boost::asio::ip::tcp;
tcp::socket socket;
}
RGWRequest req{env.store->get_new_req_id()};
RGWAsioClientIO real_client{std::move(socket), std::move(request)};
- RGWStreamIOLegacyWrapper client(&real_client);
+ RGWRestfulIO client(&real_client);
process_request(env.store, env.rest, &req, &client, env.olog);
}
const int ret = mg_write(conn, buf, len);
if (ret == 0) {
/* didn't send anything, error out */
- throw RGWStreamIOEngine::Exception(-EIO);
+ throw RGWRestfulIOEngine::Exception(-EIO);
} else if (ret < 0) {
- throw RGWStreamIOEngine::Exception(ret);
+ throw RGWRestfulIOEngine::Exception(ret);
}
return ret;
}
{
const int ret = mg_read(conn, buf, len);
if (ret < 0) {
- throw RGWStreamIOEngine::Exception(ret);
+ throw RGWRestfulIOEngine::Exception(ret);
}
return ret;
}
const int ret = mg_printf(std::forward<Args>(args)...);
if (ret == 0) {
/* didn't send anything, error out */
- throw RGWStreamIOEngine::Exception(-EIO);
+ throw RGWRestfulIOEngine::Exception(-EIO);
} else if (ret < 0) {
- throw RGWStreamIOEngine::Exception(ret);
+ throw RGWRestfulIOEngine::Exception(ret);
}
return static_cast<std::size_t>(ret);
}
struct mg_connection;
-class RGWCivetWeb : public RGWStreamIOEngine
+class RGWCivetWeb : public RGWRestfulIOEngine
{
RGWEnv env;
mg_connection *conn;
RWLock::RLocker lock(env.mutex);
RGWRequest req(env.store->get_new_req_id());
- RGWCivetWeb real_client_io(conn, env.port);
- RGWStreamIOLegacyWrapper client_io(&real_client_io);
+ auto real_client_io = rgw_restful_io_add_reordering(
+ rgw_restful_io_add_buffering(
+ rgw_restful_io_add_chunking(
+ rgw_restful_io_add_conlen_controlling(
+ RGWCivetWeb(conn, env.port)))));
+ RGWRestfulIO client_io(&real_client_io);
int ret = process_request(env.store, env.rest, &req, &client_io, env.olog);
if (ret < 0) {
}
-int RGWStreamIO::recv_body(char *buf, std::size_t max, bool calculate_hash)
+int RGWRestfulIO::recv_body(char *buf, std::size_t max, bool calculate_hash)
{
try {
const auto sent = recv_body(buf, max);
calc_hash_sha256_update_stream(sha256_hash, buf, sent);
}
return sent;
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
return e.value();
}
}
-string RGWStreamIO::grab_aws4_sha256_hash()
+string RGWRestfulIO::grab_aws4_sha256_hash()
{
return calc_hash_sha256_close_stream(&sha256_hash);
}
};
-class RGWStreamIOEngine : public RGWClientIO {
- friend class RGWStreamIOLegacyWrapper;
- template<typename T> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOEngine : public RGWClientIO {
+ template<typename T> friend class RGWDecoratedRestfulIO;
public:
class Exception : public std::exception {
};
-/* Abstract decorator over any implementation of RGWStreamIOEngine. */
+/* Abstract decorator over any implementation of RGWRestfulIOEngine. */
template <typename DecorateeT>
-class RGWDecoratedStreamIO : public RGWStreamIOEngine {
- template<typename T> friend class RGWDecoratedStreamIO;
+class RGWDecoratedRestfulIO : public RGWRestfulIOEngine {
+ template<typename T> friend class RGWDecoratedRestfulIO;
typedef typename std::remove_pointer<DecorateeT>::type DerefedDecorateeT;
- static_assert(std::is_base_of<RGWStreamIOEngine, DerefedDecorateeT>::value,
- "DecorateeT must be a subclass of RGWStreamIOEngine");
+ static_assert(std::is_base_of<RGWRestfulIOEngine, DerefedDecorateeT>::value,
+ "DecorateeT must be a subclass of RGWRestfulIOEngine");
DecorateeT decoratee;
}
public:
- RGWDecoratedStreamIO(DecorateeT&& decoratee)
+ RGWDecoratedRestfulIO(DecorateeT&& decoratee)
: decoratee(std::move(decoratee)) {
}
/* HTTP IO: compatibility layer */
-class RGWStreamIO : public RGWClientIOAccounter,
- public RGWDecoratedStreamIO<RGWStreamIOEngine*> {
+class RGWRestfulIO : public RGWClientIOAccounter,
+ public RGWDecoratedRestfulIO<RGWRestfulIOEngine*> {
protected:
bool _account;
size_t bytes_sent;
RGWEnv env;
public:
- virtual ~RGWStreamIO() {}
+ virtual ~RGWRestfulIO() {}
- RGWStreamIO(RGWStreamIOEngine* engine)
- : RGWDecoratedStreamIO<RGWStreamIOEngine*>(std::move(engine)),
+ RGWRestfulIO(RGWRestfulIOEngine* engine)
+ : RGWDecoratedRestfulIO<RGWRestfulIOEngine*>(std::move(engine)),
_account(false),
bytes_sent(0),
bytes_received(0),
sha256_hash(nullptr) {
}
- using RGWDecoratedStreamIO<RGWStreamIOEngine*>::recv_body;
+ using RGWDecoratedRestfulIO<RGWRestfulIOEngine*>::recv_body;
virtual int recv_body(char* buf, std::size_t max, bool calculate_hash);
std::string grab_aws4_sha256_hash();
uint64_t get_bytes_received() const override {
return bytes_received;
}
-}; /* RGWStreamIO */
-
-
-/* A class for preserving interface compatibility with RGWStreamIO clients
- * while allowing front-end migration to the new API. We don't multi-inherit
- * from RGWDecoratedStreamIO<> to avoid using virtual inheritance in engine.
- * Should be removed after converting all clients. */
-class RGWStreamIOLegacyWrapper : public RGWStreamIO {
-public:
- RGWStreamIOLegacyWrapper(RGWStreamIOEngine * const engine)
- : RGWStreamIO(std::move(engine)) {
- }
-};
+}; /* RGWRestfulIO */
class RGWClientIOStreamBuf : public std::streambuf {
protected:
- RGWStreamIO &sio;
+ RGWRestfulIO &rio;
std::size_t const window_size;
std::size_t const putback_size;
std::vector<char> buffer;
public:
- RGWClientIOStreamBuf(RGWStreamIO &s, std::size_t ws, std::size_t ps = 1)
- : sio(s),
+ RGWClientIOStreamBuf(RGWRestfulIO &rio, std::size_t ws, std::size_t ps = 1)
+ : rio(rio),
window_size(ws),
putback_size(ps),
buffer(ws + ps)
start = base;
}
- const int read_len = sio.recv_body(base, window_size, false);
+ const int read_len = rio.recv_body(base, window_size, false);
if (read_len < 0 || 0 == read_len) {
return traits_type::eof();
}
* ctor is being called prior to construction of any member of this class. */
public:
- explicit RGWClientIOStream(RGWStreamIO &s)
+ explicit RGWClientIOStream(RGWRestfulIO &s)
: RGWClientIOStreamBuf(s, 1, 2),
istream(static_cast<RGWClientIOStreamBuf *>(this)) {
}
#include "rgw_client_io.h"
template <typename T>
-class RGWStreamIOAccountingEngine : public RGWDecoratedStreamIO<T>,
- public RGWClientIOAccounter {
+class RGWRestfulIOAccountingEngine : public RGWDecoratedRestfulIO<T>,
+ public RGWClientIOAccounter {
bool enabled;
uint64_t total_sent;
uint64_t total_received;
public:
template <typename U>
- RGWStreamIOAccountingEngine(U&& decoratee)
- : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+ RGWRestfulIOAccountingEngine(U&& decoratee)
+ : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
enabled(false),
total_sent(0),
total_received(0) {
std::size_t send_status(const int status,
const char* const status_name) override {
- const auto sent = RGWDecoratedStreamIO<T>::send_status(status, status_name);
+ const auto sent = RGWDecoratedRestfulIO<T>::send_status(status, status_name);
if (enabled) {
total_sent += sent;
}
}
std::size_t send_100_continue() override {
- const auto sent = RGWDecoratedStreamIO<T>::send_100_continue();
+ const auto sent = RGWDecoratedRestfulIO<T>::send_100_continue();
if (enabled) {
total_sent += sent;
}
std::size_t send_header(const boost::string_ref& name,
const boost::string_ref& value) override {
- const auto sent = RGWDecoratedStreamIO<T>::send_header(name, value);
+ const auto sent = RGWDecoratedRestfulIO<T>::send_header(name, value);
if (enabled) {
total_sent += sent;
}
}
std::size_t send_content_length(const uint64_t len) override {
- const auto sent = RGWDecoratedStreamIO<T>::send_content_length(len);
+ const auto sent = RGWDecoratedRestfulIO<T>::send_content_length(len);
if (enabled) {
total_sent += sent;
}
}
std::size_t send_chunked_transfer_encoding() override {
- const auto sent = RGWDecoratedStreamIO<T>::send_chunked_transfer_encoding();
+ const auto sent = RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
if (enabled) {
total_sent += sent;
}
}
std::size_t complete_header() override {
- const auto sent = RGWDecoratedStreamIO<T>::complete_header();
+ const auto sent = RGWDecoratedRestfulIO<T>::complete_header();
if (enabled) {
total_sent += sent;
}
}
std::size_t recv_body(char* buf, std::size_t max) override {
- const auto received = RGWDecoratedStreamIO<T>::recv_body(buf, max);
+ const auto received = RGWDecoratedRestfulIO<T>::recv_body(buf, max);
if (enabled) {
total_received += received;
}
std::size_t send_body(const char* const buf,
const std::size_t len) override {
- const auto sent = RGWDecoratedStreamIO<T>::send_body(buf, len);
+ const auto sent = RGWDecoratedRestfulIO<T>::send_body(buf, len);
if (enabled) {
total_sent += sent;
}
/* Filter for in-memory buffering incoming data and calculating the content
* length header if it isn't present. */
template <typename T>
-class RGWStreamIOBufferingEngine : public RGWDecoratedStreamIO<T> {
- template<typename Td> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOBufferingEngine : public RGWDecoratedRestfulIO<T> {
+ template<typename Td> friend class RGWDecoratedRestfulIO;
protected:
ceph::bufferlist data;
public:
template <typename U>
- RGWStreamIOBufferingEngine(U&& decoratee)
- : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+ RGWRestfulIOBufferingEngine(U&& decoratee)
+ : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
has_content_length(false),
buffer_data(false) {
}
};
template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_body(const char* const buf,
- const std::size_t len)
+std::size_t RGWRestfulIOBufferingEngine<T>::send_body(const char* const buf,
+ const std::size_t len)
{
if (buffer_data) {
data.append(buf, len);
return 0;
}
- return RGWDecoratedStreamIO<T>::send_body(buf, len);
+ return RGWDecoratedRestfulIO<T>::send_body(buf, len);
}
template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_content_length(const uint64_t len)
+std::size_t RGWRestfulIOBufferingEngine<T>::send_content_length(const uint64_t len)
{
has_content_length = true;
- return RGWDecoratedStreamIO<T>::send_content_length(len);
+ return RGWDecoratedRestfulIO<T>::send_content_length(len);
}
template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::send_chunked_transfer_encoding()
+std::size_t RGWRestfulIOBufferingEngine<T>::send_chunked_transfer_encoding()
{
has_content_length = true;
- return RGWDecoratedStreamIO<T>::send_chunked_transfer_encoding();
+ return RGWDecoratedRestfulIO<T>::send_chunked_transfer_encoding();
}
template <typename T>
-std::size_t RGWStreamIOBufferingEngine<T>::complete_header()
+std::size_t RGWRestfulIOBufferingEngine<T>::complete_header()
{
if (! has_content_length) {
/* We will dump everything in complete_request(). */
return 0;
}
- return RGWDecoratedStreamIO<T>::complete_header();
+ return RGWDecoratedRestfulIO<T>::complete_header();
}
template <typename T>
-int RGWStreamIOBufferingEngine<T>::complete_request()
+int RGWRestfulIOBufferingEngine<T>::complete_request()
{
size_t sent = 0;
if (! has_content_length) {
- sent += RGWDecoratedStreamIO<T>::send_content_length(data.length());
- sent += RGWDecoratedStreamIO<T>::complete_header();
+ sent += RGWDecoratedRestfulIO<T>::send_content_length(data.length());
+ sent += RGWDecoratedRestfulIO<T>::complete_header();
}
if (buffer_data) {
/* We are sending each buffer separately to avoid extra memory shuffling
* that would occur on data.c_str() to provide a continuous memory area. */
for (const auto& ptr : data.buffers()) {
- sent += RGWDecoratedStreamIO<T>::send_body(ptr.c_str(),
- ptr.length());
+ sent += RGWDecoratedRestfulIO<T>::send_body(ptr.c_str(),
+ ptr.length());
}
data.clear();
buffer_data = false;
}
- return sent + RGWDecoratedStreamIO<T>::complete_request();
+ return sent + RGWDecoratedRestfulIO<T>::complete_request();
+}
+
+template <typename T> static inline
+RGWRestfulIOBufferingEngine<T> rgw_restful_io_add_buffering(T&& t) {
+ return RGWRestfulIOBufferingEngine<T>(std::move(t));
}
template <typename T>
-class RGWStreamIOChunkingEngine : public RGWDecoratedStreamIO<T> {
- template<typename Td> friend class RGWDecoratedStreamIO;
+class RGWRestfulIOChunkingEngine : public RGWDecoratedRestfulIO<T> {
+ template<typename Td> friend class RGWDecoratedRestfulIO;
protected:
bool has_content_length;
bool chunking_enabled;
public:
template <typename U>
- RGWStreamIOChunkingEngine(U&& decoratee)
- : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+ RGWRestfulIOChunkingEngine(U&& decoratee)
+ : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
has_content_length(false),
chunking_enabled(false) {
}
std::size_t send_content_length(const uint64_t len) override {
has_content_length = true;
- return RGWDecoratedStreamIO<T>::send_content_length(len);
+ return RGWDecoratedRestfulIO<T>::send_content_length(len);
}
std::size_t send_chunked_transfer_encoding() override {
has_content_length = false;
chunking_enabled = true;
- return RGWDecoratedStreamIO<T>::send_header("Transfer-Encoding", "chunked");
+ return RGWDecoratedRestfulIO<T>::send_header("Transfer-Encoding", "chunked");
}
std::size_t send_body(const char* buf,
const std::size_t len) override {
if (! chunking_enabled) {
- return RGWDecoratedStreamIO<T>::send_body(buf, len);
+ return RGWDecoratedRestfulIO<T>::send_body(buf, len);
} else {
static constexpr char HEADER_END[] = "\r\n";
char sizebuf[32];
const auto slen = snprintf(sizebuf, sizeof(buf), "%" PRIx64 "\r\n", len);
std::size_t sent = 0;
- sent += RGWDecoratedStreamIO<T>::send_body(sizebuf, slen);
- sent += RGWDecoratedStreamIO<T>::send_body(buf, len);
- sent += RGWDecoratedStreamIO<T>::send_body(HEADER_END,
+ sent += RGWDecoratedRestfulIO<T>::send_body(sizebuf, slen);
+ sent += RGWDecoratedRestfulIO<T>::send_body(buf, len);
+ sent += RGWDecoratedRestfulIO<T>::send_body(HEADER_END,
sizeof(HEADER_END) - 1);
return sent;
}
if (chunking_enabled) {
static constexpr char CHUNKED_RESP_END[] = "0\r\n\r\n";
- sent += RGWDecoratedStreamIO<T>::send_body(CHUNKED_RESP_END,
- sizeof(CHUNKED_RESP_END) - 1);
+ sent += RGWDecoratedRestfulIO<T>::send_body(CHUNKED_RESP_END,
+ sizeof(CHUNKED_RESP_END) - 1);
}
- return sent + RGWDecoratedStreamIO<T>::complete_request();
+ return sent + RGWDecoratedRestfulIO<T>::complete_request();
}
};
-template <typename T>
-RGWStreamIOChunkingEngine<T> add_chunking(T&& t) {
- return RGWStreamIOChunkingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOChunkingEngine<T> rgw_restful_io_add_chunking(T&& t) {
+ return RGWRestfulIOChunkingEngine<T>(std::move(t));
}
* header where RFC 7230 requests so. The cases worth our attention are 204 No
* Content as well as 304 Not Modified. */
template <typename T>
-class RGWStreamIOConLenControllingEngine : public RGWDecoratedStreamIO<T> {
+class RGWRestfulIOConLenControllingEngine : public RGWDecoratedRestfulIO<T> {
protected:
enum class ContentLengthAction {
FORWARD,
public:
template <typename U>
- RGWStreamIOConLenControllingEngine(U&& decoratee)
- : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+ RGWRestfulIOConLenControllingEngine(U&& decoratee)
+ : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
action(ContentLengthAction::UNKNOWN) {
}
action = ContentLengthAction::FORWARD;
}
- return RGWDecoratedStreamIO<T>::send_status(status, status_name);
+ return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
}
std::size_t send_content_length(const uint64_t len) override {
switch(action) {
case ContentLengthAction::FORWARD:
- return RGWDecoratedStreamIO<T>::send_content_length(len);
+ return RGWDecoratedRestfulIO<T>::send_content_length(len);
case ContentLengthAction::INHIBIT:
return 0;
case ContentLengthAction::UNKNOWN:
}
};
-template <typename T>
-RGWStreamIOConLenControllingEngine<T> add_conlen_controlling(T&& t) {
- return RGWStreamIOConLenControllingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOConLenControllingEngine<T> rgw_restful_io_add_conlen_controlling(T&& t) {
+ return RGWRestfulIOConLenControllingEngine<T>(std::move(t));
}
-/* Filter that rectifies the wrong behaviour of some clients of the RGWStreamIO
+/* Filter that rectifies the wrong behaviour of some clients of the RGWRestfulIO
* interface. Should be removed after fixing those clients. */
template <typename T>
-class RGWStreamIOReorderingEngine : public RGWDecoratedStreamIO<T> {
+class RGWRestfulIOReorderingEngine : public RGWDecoratedRestfulIO<T> {
protected:
enum class ReorderState {
RGW_EARLY_HEADERS, /* Got headers sent before calling send_status. */
value.to_string()));
return 0;
case ReorderState::RGW_DATA:
- return RGWDecoratedStreamIO<T>::send_header(name, value);
+ return RGWDecoratedRestfulIO<T>::send_header(name, value);
}
return -EIO;
public:
template <typename U>
- RGWStreamIOReorderingEngine(U&& decoratee)
- : RGWDecoratedStreamIO<T>(std::move(decoratee)),
+ RGWRestfulIOReorderingEngine(U&& decoratee)
+ : RGWDecoratedRestfulIO<T>(std::move(decoratee)),
phase(ReorderState::RGW_EARLY_HEADERS) {
}
const char* const status_name) override {
phase = ReorderState::RGW_STATUS_SEEN;
- return RGWDecoratedStreamIO<T>::send_status(status, status_name);
+ return RGWDecoratedRestfulIO<T>::send_status(status, status_name);
}
std::size_t send_content_length(const uint64_t len) override {
content_length = len;
return 0;
} else {
- return RGWDecoratedStreamIO<T>::send_content_length(len);
+ return RGWDecoratedRestfulIO<T>::send_content_length(len);
}
}
/* Sent content length if necessary. */
if (content_length) {
- sent += RGWDecoratedStreamIO<T>::send_content_length(*content_length);
+ sent += RGWDecoratedRestfulIO<T>::send_content_length(*content_length);
}
/* Header data in buffers are already counted. */
for (const auto& kv : headers) {
- sent += RGWDecoratedStreamIO<T>::send_header(kv.first, kv.second);
+ sent += RGWDecoratedRestfulIO<T>::send_header(kv.first, kv.second);
}
headers.clear();
- return sent + RGWDecoratedStreamIO<T>::complete_header();
+ return sent + RGWDecoratedRestfulIO<T>::complete_header();
}
};
-template <typename T>
-RGWStreamIOReorderingEngine<T> add_reordering(T&& t) {
- return RGWStreamIOReorderingEngine<T>(std::move(t));
+template <typename T> static inline
+RGWRestfulIOReorderingEngine<T> rgw_restful_io_add_reordering(T&& t) {
+ return RGWRestfulIOReorderingEngine<T>(std::move(t));
}
#endif /* CEPH_RGW_CLIENT_IO_DECOIMPL_H */
{
const auto ret = FCGX_PutStr(buf, len, fcgx->out);
if (ret < 0) {
- throw RGWStreamIOEngine::Exception(ret);
+ throw RGWRestfulIOEngine::Exception(ret);
}
return ret;
}
{
const auto ret = FCGX_GetStr(buf, len, fcgx->in);
if (ret < 0) {
- throw RGWStreamIOEngine::Exception(ret);
+ throw RGWRestfulIOEngine::Exception(ret);
}
return ret;
}
struct FCGX_Request;
-class RGWFCGX : public RGWStreamIOEngine
+class RGWFCGX : public RGWRestfulIOEngine
{
FCGX_Request *fcgx;
RGWEnv env;
{
RGWFCGXRequest* req = static_cast<RGWFCGXRequest*>(r);
FCGX_Request* fcgx = req->fcgx;
- auto real_client_io = add_conlen_controlling(
+ auto real_client_io = rgw_restful_io_add_conlen_controlling(
RGWFCGX(fcgx));
- RGWStreamIOLegacyWrapper client_io(&real_client_io);
+ RGWRestfulIO client_io(&real_client_io);
int ret = process_request(store, rest, req, &client_io, olog);
/* XXX does RGWLoadGenIO actually want to perform stream/HTTP I/O,
* or (e.g) are these NOOPs? */
-class RGWLoadGenIO : public RGWStreamIOEngine
+class RGWLoadGenIO : public RGWRestfulIOEngine
{
uint64_t left_to_read;
RGWLoadGenRequestEnv* req;
env.sign(access_key);
RGWLoadGenIO real_client_io(&env);
- RGWStreamIOLegacyWrapper client_io(&real_client_io);
+ RGWRestfulIO client_io(&real_client_io);
int ret = process_request(store, rest, req, &client_io, olog);
if (ret < 0) {
}
int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req,
- RGWStreamIO* client_io, OpsLogSocket* olog)
+ RGWRestfulIO* client_io, OpsLogSocket* olog)
{
int ret = 0;
extern int process_request(RGWRados* store,
RGWREST* rest,
RGWRequest* req,
- RGWStreamIO* client_io,
+ RGWRestfulIO* client_io,
OpsLogSocket* olog);
extern int rgw_process_authenticated(RGWHandler_REST* handler,
s->formatter->set_status(status, status_name);
try {
STREAM_IO(s)->send_status(status, status_name);
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
ldout(s->cct, 0) << "ERROR: s->cio->send_status() returned err="
<< e.value() << dendl;
}
{
try {
STREAM_IO(s)->send_header(name, val);
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
ldout(s->cct, 0) << "ERROR: s->cio->send_header() returned err="
<< e.value() << dendl;
}
{
try {
STREAM_IO(s)->send_content_length(len);
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
ldout(s->cct, 0) << "ERROR: s->cio->send_content_length() returned err="
<< e.value() << dendl;
}
try {
STREAM_IO(s)->complete_header();
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->complete_header() returned err="
<< e.value() << dendl;
}
{
try {
STREAM_IO(s)->send_100_continue();
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
ldout(s->cct, 0) << "ERROR: STREAM_IO(s)->send_100_continue() returned err="
<< e.value() << dendl;
}
{
try {
return STREAM_IO(s)->send_body(buf, len);
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
return e.value();
}
}
{
try {
return STREAM_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete);
- } catch (RGWStreamIOEngine::Exception& e) {
+ } catch (RGWRestfulIOEngine::Exception& e) {
return e.value();
}
}
}
RGWHandler_REST* RGWREST::get_handler(RGWRados *store, struct req_state *s,
- RGWStreamIO *sio, RGWRESTMgr **pmgr,
+ RGWRestfulIO *rio, RGWRESTMgr **pmgr,
int *init_error)
{
RGWHandler_REST* handler;
- *init_error = preprocess(s, sio);
+ *init_error = preprocess(s, rio);
if (*init_error < 0)
return NULL;
*init_error = -ERR_METHOD_NOT_ALLOWED;
return NULL;
}
- *init_error = handler->init(store, s, sio);
+ *init_error = handler->init(store, s, rio);
if (*init_error < 0) {
m->put_handler(handler);
return NULL;
/* type conversions to work around lack of req_state type
* hierarchy matching (e.g.) REST backends (may be replaced w/dynamic
* typed req_state) */
-static inline RGWStreamIO* STREAM_IO(struct req_state* s) {
- return static_cast<RGWStreamIO*>(s->cio);
+static inline RGWRestfulIO* STREAM_IO(struct req_state* s) {
+ return static_cast<RGWRestfulIO*>(s->cio);
}
template <class T>
}
};
-class RGWStreamIO;
-
class RGWGetObj_ObjStore : public RGWGetObj
{
protected:
};
class RGWLibIO;
+class RGWRestfulIO;
class RGWREST {
RGWRESTMgr mgr;
- static int preprocess(struct req_state *s, RGWClientIO *sio);
+ static int preprocess(struct req_state *s, RGWClientIO *rio);
public:
RGWREST() {}
- RGWHandler_REST *get_handler(RGWRados *store, struct req_state *s,
- RGWStreamIO *sio,
- RGWRESTMgr **pmgr, int *init_error);
+ RGWHandler_REST *get_handler(RGWRados *store,
+ struct req_state *s,
+ RGWRestfulIO *rio,
+ RGWRESTMgr **pmgr,
+ int *init_error);
#if 0
RGWHandler *get_handler(RGWRados *store, struct req_state *s,
RGWLibIO *io, RGWRESTMgr **pmgr,
{
constexpr size_t MAX_LINE_SIZE = 2048;
- RGWClientIOStreamBuf ciosb(static_cast<RGWStreamIO&>(*(s->cio)),
+ RGWClientIOStreamBuf ciosb(static_cast<RGWRestfulIO&>(*(s->cio)),
std::size_t(s->cct->_conf->rgw_max_chunk_size));
istream cioin(&ciosb);