1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
6 #define TIME_BUF_SIZE 128
9 #include <boost/container/flat_set.hpp>
10 #include "common/sstring.hh"
11 #include "common/ceph_json.h"
12 #include "include/ceph_assert.h" /* needed because of common/ceph_json.h */
14 #include "rgw_formats.h"
15 #include "rgw_client_io.h"
17 extern std::map
<std::string
, std::string
> rgw_to_http_attrs
;
19 extern void rgw_rest_init(CephContext
*cct
, const RGWZoneGroup
& zone_group
);
21 extern void rgw_flush_formatter_and_reset(struct req_state
*s
,
22 ceph::Formatter
*formatter
);
24 extern void rgw_flush_formatter(struct req_state
*s
,
25 ceph::Formatter
*formatter
);
27 inline std::string_view
rgw_sanitized_hdrval(ceph::buffer::list
& raw
)
29 /* std::string and thus std::string_view ARE OBLIGED to carry multiple
30 * 0x00 and count them to the length of a string. We need to take that
31 * into consideration and sanitize the size of a ceph::buffer::list used
32 * to store metadata values (x-amz-meta-*, X-Container-Meta-*, etags).
33 * Otherwise we might send 0x00 to clients. */
34 const char* const data
= raw
.c_str();
35 size_t len
= raw
.length();
37 if (len
&& data
[len
- 1] == '\0') {
38 /* That's the case - the null byte has been included at the last position
39 * of the bufferlist. We need to restore the proper string length we'll
40 * pass to string_ref. */
44 return std::string_view(data
, len
);
48 std::tuple
<int, bufferlist
> rgw_rest_get_json_input_keep_data(CephContext
*cct
, req_state
*s
, T
& out
, uint64_t max_len
)
52 std::tie(rv
, data
) = rgw_rest_read_all_input(s
, max_len
);
54 return std::make_tuple(rv
, std::move(data
));
58 return std::make_tuple(-EINVAL
, std::move(data
));
63 if (!parser
.parse(data
.c_str(), data
.length())) {
64 return std::make_tuple(-EINVAL
, std::move(data
));
68 decode_json_obj(out
, &parser
);
69 } catch (JSONDecoder::err
& e
) {
70 return std::make_tuple(-EINVAL
, std::move(data
));
73 return std::make_tuple(0, std::move(data
));
78 static int get_string(struct req_state
*s
, const std::string
& name
,
79 const std::string
& def_val
, std::string
*val
,
80 bool *existed
= NULL
);
81 static int get_uint64(struct req_state
*s
, const std::string
& name
,
82 uint64_t def_val
, uint64_t *val
, bool *existed
= NULL
);
83 static int get_int64(struct req_state
*s
, const std::string
& name
,
84 int64_t def_val
, int64_t *val
, bool *existed
= NULL
);
85 static int get_uint32(struct req_state
*s
, const std::string
& name
,
86 uint32_t def_val
, uint32_t *val
, bool *existed
= NULL
);
87 static int get_int32(struct req_state
*s
, const std::string
& name
,
88 int32_t def_val
, int32_t *val
, bool *existed
= NULL
);
89 static int get_time(struct req_state
*s
, const std::string
& name
,
90 const utime_t
& def_val
, utime_t
*val
,
91 bool *existed
= NULL
);
92 static int get_epoch(struct req_state
*s
, const std::string
& name
,
93 uint64_t def_val
, uint64_t *epoch
,
94 bool *existed
= NULL
);
95 static int get_bool(struct req_state
*s
, const std::string
& name
, bool def_val
,
96 bool *val
, bool *existed
= NULL
);
99 class RGWRESTFlusher
: public RGWFormatterFlusher
{
103 void do_flush() override
;
104 void do_start(int ret
) override
;
106 RGWRESTFlusher(struct req_state
*_s
, RGWOp
*_op
) :
107 RGWFormatterFlusher(_s
->formatter
), s(_s
), op(_op
) {}
108 RGWRESTFlusher() : RGWFormatterFlusher(NULL
), s(NULL
), op(NULL
) {}
110 void init(struct req_state
*_s
, RGWOp
*_op
) {
113 set_formatter(s
->formatter
);
117 class RGWGetObj_ObjStore
: public RGWGetObj
122 RGWGetObj_ObjStore() : sent_header(false) {}
124 void init(rgw::sal::Store
* store
, struct req_state
*s
, RGWHandler
*h
) override
{
125 RGWGetObj::init(store
, s
, h
);
129 int get_params(optional_yield y
) override
;
132 class RGWGetObjTags_ObjStore
: public RGWGetObjTags
{
134 RGWGetObjTags_ObjStore() {};
135 ~RGWGetObjTags_ObjStore() {};
138 class RGWPutObjTags_ObjStore
: public RGWPutObjTags
{
140 RGWPutObjTags_ObjStore() {};
141 ~RGWPutObjTags_ObjStore() {};
144 class RGWGetBucketTags_ObjStore
: public RGWGetBucketTags
{
146 RGWGetBucketTags_ObjStore() = default;
147 virtual ~RGWGetBucketTags_ObjStore() = default;
150 class RGWPutBucketTags_ObjStore
: public RGWPutBucketTags
{
152 RGWPutBucketTags_ObjStore() = default;
153 virtual ~RGWPutBucketTags_ObjStore() = default;
156 class RGWGetBucketReplication_ObjStore
: public RGWGetBucketReplication
{
158 RGWGetBucketReplication_ObjStore() {};
159 ~RGWGetBucketReplication_ObjStore() {};
162 class RGWPutBucketReplication_ObjStore
: public RGWPutBucketReplication
{
164 RGWPutBucketReplication_ObjStore() = default;
165 virtual ~RGWPutBucketReplication_ObjStore() = default;
168 class RGWDeleteBucketReplication_ObjStore
: public RGWDeleteBucketReplication
{
170 RGWDeleteBucketReplication_ObjStore() = default;
171 virtual ~RGWDeleteBucketReplication_ObjStore() = default;
174 class RGWListBuckets_ObjStore
: public RGWListBuckets
{
176 RGWListBuckets_ObjStore() {}
177 ~RGWListBuckets_ObjStore() override
{}
180 class RGWGetUsage_ObjStore
: public RGWGetUsage
{
182 RGWGetUsage_ObjStore() {}
183 ~RGWGetUsage_ObjStore() override
{}
186 class RGWListBucket_ObjStore
: public RGWListBucket
{
188 RGWListBucket_ObjStore() {}
189 ~RGWListBucket_ObjStore() override
{}
192 class RGWStatAccount_ObjStore
: public RGWStatAccount
{
194 RGWStatAccount_ObjStore() {}
195 ~RGWStatAccount_ObjStore() override
{}
198 class RGWStatBucket_ObjStore
: public RGWStatBucket
{
200 RGWStatBucket_ObjStore() {}
201 ~RGWStatBucket_ObjStore() override
{}
204 class RGWCreateBucket_ObjStore
: public RGWCreateBucket
{
206 RGWCreateBucket_ObjStore() {}
207 ~RGWCreateBucket_ObjStore() override
{}
210 class RGWDeleteBucket_ObjStore
: public RGWDeleteBucket
{
212 RGWDeleteBucket_ObjStore() {}
213 ~RGWDeleteBucket_ObjStore() override
{}
216 class RGWPutObj_ObjStore
: public RGWPutObj
219 RGWPutObj_ObjStore() {}
220 ~RGWPutObj_ObjStore() override
{}
222 int verify_params() override
;
223 int get_params(optional_yield y
) override
;
224 int get_data(bufferlist
& bl
) override
;
227 class RGWPostObj_ObjStore
: public RGWPostObj
229 std::string boundary
;
232 struct post_part_field
{
234 std::map
<std::string
, std::string
> params
;
237 struct post_form_part
{
239 std::map
<std::string
, post_part_field
, ltstr_nocase
> fields
;
240 ceph::bufferlist data
;
244 using parts_collection_t
= \
245 std::map
<std::string
, post_form_part
, const ltstr_nocase
>;
248 ceph::bufferlist in_data
;
250 int read_with_boundary(ceph::bufferlist
& bl
,
253 bool& reached_boundary
,
256 int read_line(ceph::bufferlist
& bl
,
258 bool& reached_boundary
,
261 int read_data(ceph::bufferlist
& bl
,
263 bool& reached_boundary
,
266 int read_form_part_header(struct post_form_part
*part
, bool& done
);
268 int get_params(optional_yield y
) override
;
270 static int parse_part_field(const std::string
& line
,
271 std::string
& field_name
, /* out */
272 post_part_field
& field
); /* out */
274 static void parse_boundary_params(const std::string
& params_str
,
276 std::map
<std::string
, std::string
>& params
);
278 static bool part_str(parts_collection_t
& parts
,
279 const std::string
& name
,
282 static std::string
get_part_str(parts_collection_t
& parts
,
283 const std::string
& name
,
284 const std::string
& def_val
= std::string());
286 static bool part_bl(parts_collection_t
& parts
,
287 const std::string
& name
,
288 ceph::bufferlist
*pbl
);
291 RGWPostObj_ObjStore() {}
292 ~RGWPostObj_ObjStore() override
{}
294 int verify_params() override
;
298 class RGWPutMetadataAccount_ObjStore
: public RGWPutMetadataAccount
301 RGWPutMetadataAccount_ObjStore() {}
302 ~RGWPutMetadataAccount_ObjStore() override
{}
305 class RGWPutMetadataBucket_ObjStore
: public RGWPutMetadataBucket
308 RGWPutMetadataBucket_ObjStore() {}
309 ~RGWPutMetadataBucket_ObjStore() override
{}
312 class RGWPutMetadataObject_ObjStore
: public RGWPutMetadataObject
315 RGWPutMetadataObject_ObjStore() {}
316 ~RGWPutMetadataObject_ObjStore() override
{}
319 class RGWDeleteObj_ObjStore
: public RGWDeleteObj
{
321 RGWDeleteObj_ObjStore() {}
322 ~RGWDeleteObj_ObjStore() override
{}
325 class RGWGetCrossDomainPolicy_ObjStore
: public RGWGetCrossDomainPolicy
{
327 RGWGetCrossDomainPolicy_ObjStore() = default;
328 ~RGWGetCrossDomainPolicy_ObjStore() override
= default;
331 class RGWGetHealthCheck_ObjStore
: public RGWGetHealthCheck
{
333 RGWGetHealthCheck_ObjStore() = default;
334 ~RGWGetHealthCheck_ObjStore() override
= default;
337 class RGWCopyObj_ObjStore
: public RGWCopyObj
{
339 RGWCopyObj_ObjStore() {}
340 ~RGWCopyObj_ObjStore() override
{}
343 class RGWGetACLs_ObjStore
: public RGWGetACLs
{
345 RGWGetACLs_ObjStore() {}
346 ~RGWGetACLs_ObjStore() override
{}
349 class RGWPutACLs_ObjStore
: public RGWPutACLs
{
351 RGWPutACLs_ObjStore() {}
352 ~RGWPutACLs_ObjStore() override
{}
354 int get_params(optional_yield y
) override
;
357 class RGWGetLC_ObjStore
: public RGWGetLC
{
359 RGWGetLC_ObjStore() {}
360 ~RGWGetLC_ObjStore() override
{}
363 class RGWPutLC_ObjStore
: public RGWPutLC
{
365 RGWPutLC_ObjStore() {}
366 ~RGWPutLC_ObjStore() override
{}
368 int get_params(optional_yield y
) override
;
371 class RGWDeleteLC_ObjStore
: public RGWDeleteLC
{
373 RGWDeleteLC_ObjStore() {}
374 ~RGWDeleteLC_ObjStore() override
{}
378 class RGWGetCORS_ObjStore
: public RGWGetCORS
{
380 RGWGetCORS_ObjStore() {}
381 ~RGWGetCORS_ObjStore() override
{}
384 class RGWPutCORS_ObjStore
: public RGWPutCORS
{
386 RGWPutCORS_ObjStore() {}
387 ~RGWPutCORS_ObjStore() override
{}
390 class RGWDeleteCORS_ObjStore
: public RGWDeleteCORS
{
392 RGWDeleteCORS_ObjStore() {}
393 ~RGWDeleteCORS_ObjStore() override
{}
396 class RGWOptionsCORS_ObjStore
: public RGWOptionsCORS
{
398 RGWOptionsCORS_ObjStore() {}
399 ~RGWOptionsCORS_ObjStore() override
{}
402 class RGWGetBucketEncryption_ObjStore
: public RGWGetBucketEncryption
{
404 RGWGetBucketEncryption_ObjStore() {}
405 ~RGWGetBucketEncryption_ObjStore() override
{}
408 class RGWPutBucketEncryption_ObjStore
: public RGWPutBucketEncryption
{
410 RGWPutBucketEncryption_ObjStore() {}
411 ~RGWPutBucketEncryption_ObjStore() override
{}
414 class RGWDeleteBucketEncryption_ObjStore
: public RGWDeleteBucketEncryption
{
416 RGWDeleteBucketEncryption_ObjStore() {}
417 ~RGWDeleteBucketEncryption_ObjStore() override
{}
420 class RGWInitMultipart_ObjStore
: public RGWInitMultipart
{
422 RGWInitMultipart_ObjStore() {}
423 ~RGWInitMultipart_ObjStore() override
{}
426 class RGWCompleteMultipart_ObjStore
: public RGWCompleteMultipart
{
428 RGWCompleteMultipart_ObjStore() {}
429 ~RGWCompleteMultipart_ObjStore() override
{}
431 int get_params(optional_yield y
) override
;
434 class RGWAbortMultipart_ObjStore
: public RGWAbortMultipart
{
436 RGWAbortMultipart_ObjStore() {}
437 ~RGWAbortMultipart_ObjStore() override
{}
440 class RGWListMultipart_ObjStore
: public RGWListMultipart
{
442 RGWListMultipart_ObjStore() {}
443 ~RGWListMultipart_ObjStore() override
{}
445 int get_params(optional_yield y
) override
;
448 class RGWListBucketMultiparts_ObjStore
: public RGWListBucketMultiparts
{
450 RGWListBucketMultiparts_ObjStore() {}
451 ~RGWListBucketMultiparts_ObjStore() override
{}
453 int get_params(optional_yield y
) override
;
456 class RGWBulkDelete_ObjStore
: public RGWBulkDelete
{
458 RGWBulkDelete_ObjStore() {}
459 ~RGWBulkDelete_ObjStore() override
{}
462 class RGWBulkUploadOp_ObjStore
: public RGWBulkUploadOp
{
464 RGWBulkUploadOp_ObjStore() = default;
465 ~RGWBulkUploadOp_ObjStore() = default;
468 class RGWDeleteMultiObj_ObjStore
: public RGWDeleteMultiObj
{
470 RGWDeleteMultiObj_ObjStore() {}
471 ~RGWDeleteMultiObj_ObjStore() override
{}
473 int get_params(optional_yield y
) override
;
476 class RGWInfo_ObjStore
: public RGWInfo
{
478 RGWInfo_ObjStore() = default;
479 ~RGWInfo_ObjStore() override
= default;
482 class RGWPutBucketObjectLock_ObjStore
: public RGWPutBucketObjectLock
{
484 RGWPutBucketObjectLock_ObjStore() = default;
485 ~RGWPutBucketObjectLock_ObjStore() = default;
486 int get_params(optional_yield y
) override
;
489 class RGWGetBucketObjectLock_ObjStore
: public RGWGetBucketObjectLock
{
491 RGWGetBucketObjectLock_ObjStore() = default;
492 ~RGWGetBucketObjectLock_ObjStore() override
= default;
495 class RGWPutObjRetention_ObjStore
: public RGWPutObjRetention
{
497 RGWPutObjRetention_ObjStore() = default;
498 ~RGWPutObjRetention_ObjStore() override
= default;
501 class RGWGetObjRetention_ObjStore
: public RGWGetObjRetention
{
503 RGWGetObjRetention_ObjStore() = default;
504 ~RGWGetObjRetention_ObjStore() = default;
507 class RGWPutObjLegalHold_ObjStore
: public RGWPutObjLegalHold
{
509 RGWPutObjLegalHold_ObjStore() = default;
510 ~RGWPutObjLegalHold_ObjStore() override
= default;
511 int get_params(optional_yield y
) override
;
514 class RGWGetObjLegalHold_ObjStore
: public RGWGetObjLegalHold
{
516 RGWGetObjLegalHold_ObjStore() = default;
517 ~RGWGetObjLegalHold_ObjStore() = default;
520 class RGWRESTOp
: public RGWOp
{
522 RGWRESTFlusher flusher
;
525 void init(rgw::sal::Store
* store
, struct req_state
*s
,
526 RGWHandler
*dialect_handler
) override
{
527 RGWOp::init(store
, s
, dialect_handler
);
528 flusher
.init(s
, this);
530 void send_response() override
;
531 virtual int check_caps(const RGWUserCaps
& caps
)
532 { return -EPERM
; } /* should to be implemented! */
533 int verify_permission(optional_yield y
) override
;
534 dmc::client_id
dmclock_client() override
{ return dmc::client_id::admin
; }
537 class RGWHandler_REST
: public RGWHandler
{
540 virtual bool is_obj_update_op() const { return false; }
541 virtual RGWOp
*op_get() { return NULL
; }
542 virtual RGWOp
*op_put() { return NULL
; }
543 virtual RGWOp
*op_delete() { return NULL
; }
544 virtual RGWOp
*op_head() { return NULL
; }
545 virtual RGWOp
*op_post() { return NULL
; }
546 virtual RGWOp
*op_copy() { return NULL
; }
547 virtual RGWOp
*op_options() { return NULL
; }
550 static int allocate_formatter(struct req_state
*s
, int default_formatter
,
553 static constexpr int MAX_BUCKET_NAME_LEN
= 255;
554 static constexpr int MAX_OBJ_NAME_LEN
= 1024;
557 ~RGWHandler_REST() override
{}
559 static int validate_bucket_name(const std::string
& bucket
);
560 static int validate_object_name(const std::string
& object
);
561 static int reallocate_formatter(struct req_state
*s
, int type
);
563 int init_permissions(RGWOp
* op
, optional_yield y
) override
;
564 int read_permissions(RGWOp
* op
, optional_yield y
) override
;
566 virtual RGWOp
* get_op(void);
567 virtual void put_op(RGWOp
* op
);
570 class RGWHandler_REST_SWIFT
;
571 class RGWHandler_SWIFT_Auth
;
572 class RGWHandler_REST_S3
;
574 namespace rgw::auth
{
576 class StrategyRegistry
;
584 std::map
<std::string
, RGWRESTMgr
*> resource_mgrs
;
585 std::multimap
<size_t, std::string
> resources_by_size
;
586 RGWRESTMgr
* default_mgr
;
588 virtual RGWRESTMgr
* get_resource_mgr(struct req_state
* s
,
589 const std::string
& uri
,
590 std::string
* out_uri
);
592 virtual RGWRESTMgr
* get_resource_mgr_as_default(struct req_state
* const s
,
593 const std::string
& uri
,
594 std::string
* our_uri
) {
601 default_mgr(nullptr) {
603 virtual ~RGWRESTMgr();
605 void register_resource(std::string resource
, RGWRESTMgr
* mgr
);
606 void register_default_mgr(RGWRESTMgr
* mgr
);
608 virtual RGWRESTMgr
* get_manager(struct req_state
* const s
,
609 /* Prefix to be concatenated with @uri
610 * during the lookup. */
611 const std::string
& frontend_prefix
,
612 const std::string
& uri
,
613 std::string
* out_uri
) final
{
614 return get_resource_mgr(s
, frontend_prefix
+ uri
, out_uri
);
617 virtual RGWHandler_REST
* get_handler(
618 rgw::sal::Store
* store
,
619 struct req_state
* const s
,
620 const rgw::auth::StrategyRegistry
& auth_registry
,
621 const std::string
& frontend_prefix
626 virtual void put_handler(RGWHandler_REST
* const handler
) {
630 void set_logging(bool _should_log
) {
631 should_log
= _should_log
;
634 bool get_logging() const {
643 using x_header
= basic_sstring
<char, uint16_t, 32>;
644 boost::container::flat_set
<x_header
> x_headers
;
647 static int preprocess(struct req_state
*s
, rgw::io::BasicClient
* rio
);
650 RGWHandler_REST
*get_handler(rgw::sal::Store
* store
,
652 const rgw::auth::StrategyRegistry
& auth_registry
,
653 const std::string
& frontend_prefix
,
658 RGWHandler
*get_handler(RGWRados
*store
, struct req_state
*s
,
659 RGWLibIO
*io
, RGWRESTMgr
**pmgr
,
663 void put_handler(RGWHandler_REST
*handler
) {
664 mgr
.put_handler(handler
);
667 void register_resource(std::string resource
, RGWRESTMgr
*m
,
668 bool register_empty
= false) {
669 if (!register_empty
&& resource
.empty())
672 mgr
.register_resource(resource
, m
);
675 void register_default_mgr(RGWRESTMgr
*m
) {
676 mgr
.register_default_mgr(m
);
679 void register_x_headers(const std::string
& headers
);
681 bool log_x_headers(void) {
682 return (x_headers
.size() > 0);
685 bool log_x_header(const std::string
& header
) {
686 return (x_headers
.find(header
) != x_headers
.end());
690 static constexpr int64_t NO_CONTENT_LENGTH
= -1;
691 static constexpr int64_t CHUNKED_TRANSFER_ENCODING
= -2;
693 extern void dump_errno(int http_ret
, std::string
& out
);
694 extern void dump_errno(const struct rgw_err
&err
, std::string
& out
);
695 extern void dump_errno(struct req_state
*s
);
696 extern void dump_errno(struct req_state
*s
, int http_ret
);
697 extern void end_header(struct req_state
*s
,
699 const char *content_type
= nullptr,
700 const int64_t proposed_content_length
=
702 bool force_content_type
= false,
703 bool force_no_error
= false);
704 extern void dump_start(struct req_state
*s
);
705 extern void list_all_buckets_start(struct req_state
*s
);
706 extern void dump_owner(struct req_state
*s
, const rgw_user
& id
,
707 const std::string
& name
, const char *section
= NULL
);
708 extern void dump_header(struct req_state
* s
,
709 const std::string_view
& name
,
710 const std::string_view
& val
);
711 extern void dump_header(struct req_state
* s
,
712 const std::string_view
& name
,
713 ceph::buffer::list
& bl
);
714 extern void dump_header(struct req_state
* s
,
715 const std::string_view
& name
,
717 extern void dump_header(struct req_state
* s
,
718 const std::string_view
& name
,
721 template <class... Args
>
722 inline void dump_header_prefixed(struct req_state
* s
,
723 const std::string_view
& name_prefix
,
724 const std::string_view
& name
,
726 char full_name_buf
[name_prefix
.size() + name
.size() + 1];
727 const auto len
= snprintf(full_name_buf
, sizeof(full_name_buf
), "%.*s%.*s",
728 static_cast<int>(name_prefix
.length()),
730 static_cast<int>(name
.length()),
732 std::string_view
full_name(full_name_buf
, len
);
733 return dump_header(s
, std::move(full_name
), std::forward
<Args
>(args
)...);
736 template <class... Args
>
737 inline void dump_header_infixed(struct req_state
* s
,
738 const std::string_view
& prefix
,
739 const std::string_view
& infix
,
740 const std::string_view
& sufix
,
742 char full_name_buf
[prefix
.size() + infix
.size() + sufix
.size() + 1];
743 const auto len
= snprintf(full_name_buf
, sizeof(full_name_buf
), "%.*s%.*s%.*s",
744 static_cast<int>(prefix
.length()),
746 static_cast<int>(infix
.length()),
748 static_cast<int>(sufix
.length()),
750 std::string_view
full_name(full_name_buf
, len
);
751 return dump_header(s
, std::move(full_name
), std::forward
<Args
>(args
)...);
754 template <class... Args
>
755 inline void dump_header_quoted(struct req_state
* s
,
756 const std::string_view
& name
,
757 const std::string_view
& val
) {
758 /* We need two extra bytes for quotes. */
759 char qvalbuf
[val
.size() + 2 + 1];
760 const auto len
= snprintf(qvalbuf
, sizeof(qvalbuf
), "\"%.*s\"",
761 static_cast<int>(val
.length()), val
.data());
762 return dump_header(s
, name
, std::string_view(qvalbuf
, len
));
765 template <class ValueT
>
766 inline void dump_header_if_nonempty(struct req_state
* s
,
767 const std::string_view
& name
,
768 const ValueT
& value
) {
769 if (name
.length() > 0 && value
.length() > 0) {
770 return dump_header(s
, name
, value
);
774 inline std::string
compute_domain_uri(const struct req_state
*s
) {
775 std::string uri
= (!s
->info
.domain
.empty()) ? s
->info
.domain
:
776 [&s
]() -> std::string
{
777 RGWEnv
const &env(*(s
->info
.env
));
779 env
.get("SERVER_PORT_SECURE") ? "https://" : "http://";
780 if (env
.exists("SERVER_NAME")) {
781 uri
.append(env
.get("SERVER_NAME", "<SERVER_NAME>"));
783 uri
.append(env
.get("HTTP_HOST", "<HTTP_HOST>"));
790 extern void dump_content_length(struct req_state
*s
, uint64_t len
);
791 extern int64_t parse_content_length(const char *content_length
);
792 extern void dump_etag(struct req_state
*s
,
793 const std::string_view
& etag
,
794 bool quoted
= false);
795 extern void dump_epoch_header(struct req_state
*s
, const char *name
, real_time t
);
796 extern void dump_time_header(struct req_state
*s
, const char *name
, real_time t
);
797 extern void dump_last_modified(struct req_state
*s
, real_time t
);
798 extern void abort_early(struct req_state
* s
, RGWOp
* op
, int err
,
799 RGWHandler
* handler
, optional_yield y
);
800 extern void dump_range(struct req_state
* s
, uint64_t ofs
, uint64_t end
,
801 uint64_t total_size
);
802 extern void dump_continue(struct req_state
*s
);
803 extern void list_all_buckets_end(struct req_state
*s
);
804 extern void dump_time(struct req_state
*s
, const char *name
, real_time t
);
805 extern std::string
dump_time_to_str(const real_time
& t
);
806 extern void dump_bucket_from_state(struct req_state
*s
);
807 extern void dump_redirect(struct req_state
*s
, const std::string
& redirect
);
808 extern bool is_valid_url(const char *url
);
809 extern void dump_access_control(struct req_state
*s
, const char *origin
,
811 const char *hdr
, const char *exp_hdr
,
813 extern void dump_access_control(req_state
*s
, RGWOp
*op
);
815 extern int dump_body(struct req_state
* s
, const char* buf
, size_t len
);
816 extern int dump_body(struct req_state
* s
, /* const */ ceph::buffer::list
& bl
);
817 extern int dump_body(struct req_state
* s
, const std::string
& str
);
818 extern int recv_body(struct req_state
* s
, char* buf
, size_t max
);