parse_buffer& buffer, bool is_ssl,
SharedMutex& pause_mutex,
rgw::dmclock::Scheduler *scheduler,
+ const std::string& uri_prefix,
boost::system::error_code& ec,
yield_context yield)
{
// don't impose a limit on the body, since we read it in pieces
static constexpr size_t body_limit = std::numeric_limits<size_t>::max();
- auto cct = env.store->ctx();
+ auto cct = env.driver->ctx();
// read messages from the stream until eof
for (;;) {
}
// process the request
- RGWRequest req{env.store->get_new_req_id()};
+ RGWRequest req{env.driver->get_new_req_id()};
auto& socket = stream.lowest_layer();
const auto& remote_endpoint = socket.remote_endpoint(ec);
ldout(cct, 1) << "failed to connect client: " << ec.message() << dendl;
return;
}
+ const auto& local_endpoint = socket.local_endpoint(ec);
+ if (ec) {
+ ldout(cct, 1) << "failed to connect client: " << ec.message() << dendl;
+ return;
+ }
StreamIO real_client{cct, stream, timeout, parser, yield, buffer,
- is_ssl, socket.local_endpoint(),
- remote_endpoint};
+ is_ssl, local_endpoint, remote_endpoint};
auto real_client_io = rgw::io::add_reordering(
rgw::io::add_buffering(cct,
string user = "-";
const auto started = ceph::coarse_real_clock::now();
ceph::coarse_real_clock::duration latency{};
- process_request(env.store, env.rest, &req, env.uri_prefix,
- *env.auth_registry, &client, env.olog, y,
- scheduler, &user, &latency,
- env.ratelimiting->get_active(),
- &http_ret);
+ process_request(env, &req, uri_prefix, &client, y,
+ scheduler, &user, &latency, &http_ret);
- if (cct->_conf->subsys.should_gather(dout_subsys, 1)) {
+ if (cct->_conf->subsys.should_gather(ceph_subsys_rgw_access, 1)) {
// access log line elements begin per Apache Combined Log Format with additions following
- ldout(cct, 1) << "beast: " << std::hex << &req << std::dec << ": "
+ lsubdout(cct, rgw_access, 1) << "beast: " << std::hex << &req << std::dec << ": "
<< remote_endpoint.address() << " - " << user << " [" << log_apache_time{started} << "] \""
<< message.method_string() << ' ' << message.target() << ' '
<< http_version{message.version()} << "\" " << http_ret << ' '
namespace dmc = rgw::dmclock;
class AsioFrontend {
- RGWProcessEnv env;
+ RGWProcessEnv& env;
RGWFrontendConfig* conf;
boost::asio::io_context context;
+ std::string uri_prefix;
ceph::timespan request_timeout = std::chrono::milliseconds(REQUEST_TIMEOUT);
size_t header_limit = 16384;
#ifdef WITH_RADOSGW_BEAST_OPENSSL
std::vector<std::thread> threads;
std::atomic<bool> going_down{false};
- CephContext* ctx() const { return env.store->ctx(); }
+ CephContext* ctx() const { return env.driver->ctx(); }
std::optional<dmc::ClientCounters> client_counters;
std::unique_ptr<dmc::ClientConfig> client_config;
void accept(Listener& listener, boost::system::error_code ec);
public:
- AsioFrontend(const RGWProcessEnv& env, RGWFrontendConfig* conf,
+ AsioFrontend(RGWProcessEnv& env, RGWFrontendConfig* conf,
dmc::SchedulerCtx& sched_ctx)
: env(env), conf(conf), pause_mutex(context.get_executor())
{
void stop();
void join();
void pause();
- void unpause(rgw::sal::Store* store, rgw_auth_registry_ptr_t);
+ void unpause();
};
unsigned short parse_port(const char *input, boost::system::error_code& ec)
boost::system::error_code ec;
auto& config = conf->get_config_map();
+ if (auto i = config.find("prefix"); i != config.end()) {
+ uri_prefix = i->second;
+ }
+
// Setting global timeout
auto timeout = config.find("request_timeout_ms");
if (timeout != config.end()) {
public:
ExpandMetaVar(rgw::sal::Zone* zone_svc) {
- meta_map["realm"] = zone_svc->get_realm().get_name();
- meta_map["realm_id"] = zone_svc->get_realm().get_id();
+ meta_map["realm"] = zone_svc->get_realm_name();
+ meta_map["realm_id"] = zone_svc->get_realm_id();
meta_map["zonegroup"] = zone_svc->get_zonegroup().get_name();
meta_map["zonegroup_id"] = zone_svc->get_zonegroup().get_id();
meta_map["zone"] = zone_svc->get_name();
- meta_map["zone_id"] = zone_svc->get_id().id;
+ meta_map["zone_id"] = zone_svc->get_id();
}
string process_str(const string& in);
return -EINVAL;
}
- int r = env.store->get_config_key_val(name, pbl);
+ int r = env.driver->get_config_key_val(name, pbl);
if (r < 0) {
lderr(ctx()) << type << " was not found: " << name << dendl;
return r;
key_is_cert = true;
}
- ExpandMetaVar emv(env.store->get_zone());
+ ExpandMetaVar emv(env.driver->get_zone());
cert = emv.process_str(*cert);
key = emv.process_str(*key);
conn->buffer.consume(bytes);
handle_connection(context, env, stream, timeout, header_limit,
conn->buffer, true, pause_mutex, scheduler.get(),
- ec, yield);
+ uri_prefix, ec, yield);
if (!ec) {
// ssl shutdown (ignoring errors)
stream.async_shutdown(yield[ec]);
boost::system::error_code ec;
handle_connection(context, env, conn->socket, timeout, header_limit,
conn->buffer, false, pause_mutex, scheduler.get(),
- ec, yield);
+ uri_prefix, ec, yield);
conn->socket.shutdown(tcp_socket::shutdown_both, ec);
}, make_stack_allocator());
}
work.emplace(boost::asio::make_work_guard(context));
for (int i = 0; i < thread_count; i++) {
- threads.emplace_back([=]() noexcept {
+ threads.emplace_back([this]() noexcept {
// request warnings on synchronous librados calls in this thread
is_asio_thread = true;
// Have uncaught exceptions kill the process and give a
}
}
-void AsioFrontend::unpause(rgw::sal::Store* const store,
- rgw_auth_registry_ptr_t auth_registry)
+void AsioFrontend::unpause()
{
- env.store = store;
- env.auth_registry = std::move(auth_registry);
-
// unpause to unblock connections
pause_mutex.unlock();
class RGWAsioFrontend::Impl : public AsioFrontend {
public:
- Impl(const RGWProcessEnv& env, RGWFrontendConfig* conf,
+ Impl(RGWProcessEnv& env, RGWFrontendConfig* conf,
rgw::dmclock::SchedulerCtx& sched_ctx)
: AsioFrontend(env, conf, sched_ctx) {}
};
-RGWAsioFrontend::RGWAsioFrontend(const RGWProcessEnv& env,
+RGWAsioFrontend::RGWAsioFrontend(RGWProcessEnv& env,
RGWFrontendConfig* conf,
rgw::dmclock::SchedulerCtx& sched_ctx)
: impl(new Impl(env, conf, sched_ctx))
impl->pause();
}
-void RGWAsioFrontend::unpause_with_new_config(
- rgw::sal::Store* const store,
- rgw_auth_registry_ptr_t auth_registry
-) {
- impl->unpause(store, std::move(auth_registry));
+void RGWAsioFrontend::unpause_with_new_config()
+{
+ impl->unpause();
}