1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2015 Robin H. Johnson <robin.johnson@dreamhost.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
14 #ifndef CEPH_RGW_REST_S3WEBSITE_H
15 #define CEPH_RGW_REST_S3WEBSITE_H
17 #include "rgw_rest_s3.h"
19 class RGWHandler_REST_S3Website
: public RGWHandler_REST_S3
{
20 std::string original_object_name
; // object name before retarget()
23 int retarget(RGWOp
*op
, RGWOp
**new_op
) override
;
24 // TODO: this should be virtual I think, and ensure that it's always
25 // overridden, but that conflates that op_get/op_head are defined in this
26 // class and call this; and don't need to be overridden later.
27 virtual RGWOp
*get_obj_op(bool get_data
) { return NULL
; }
28 RGWOp
*op_get() override
;
29 RGWOp
*op_head() override
;
30 // Only allowed to use GET+HEAD
31 RGWOp
*op_put() override
{ return NULL
; }
32 RGWOp
*op_delete() override
{ return NULL
; }
33 RGWOp
*op_post() override
{ return NULL
; }
34 RGWOp
*op_copy() override
{ return NULL
; }
35 RGWOp
*op_options() override
{ return NULL
; }
37 int serve_errordoc(int http_ret
, const string
&errordoc_key
);
39 using RGWHandler_REST_S3::RGWHandler_REST_S3
;
40 ~RGWHandler_REST_S3Website() override
= default;
42 int init(RGWRados
*store
, req_state
*s
, rgw::io::BasicClient
* cio
) override
;
43 int error_handler(int err_no
, string
*error_content
) override
;
46 class RGWHandler_REST_Service_S3Website
: public RGWHandler_REST_S3Website
{
48 RGWOp
*get_obj_op(bool get_data
) override
;
50 using RGWHandler_REST_S3Website::RGWHandler_REST_S3Website
;
51 ~RGWHandler_REST_Service_S3Website() override
= default;
54 class RGWHandler_REST_Obj_S3Website
: public RGWHandler_REST_S3Website
{
56 RGWOp
*get_obj_op(bool get_data
) override
;
58 using RGWHandler_REST_S3Website::RGWHandler_REST_S3Website
;
59 ~RGWHandler_REST_Obj_S3Website() override
= default;
62 /* The cross-inheritance from Obj to Bucket is deliberate!
63 * S3Websites do NOT support any bucket operations
65 class RGWHandler_REST_Bucket_S3Website
: public RGWHandler_REST_S3Website
{
67 RGWOp
*get_obj_op(bool get_data
) override
;
69 using RGWHandler_REST_S3Website::RGWHandler_REST_S3Website
;
70 ~RGWHandler_REST_Bucket_S3Website() override
= default;
73 // TODO: do we actually need this?
74 class RGWGetObj_ObjStore_S3Website
: public RGWGetObj_ObjStore_S3
76 friend class RGWHandler_REST_S3Website
;
78 bool is_errordoc_request
;
80 RGWGetObj_ObjStore_S3Website() : is_errordoc_request(false) {}
81 explicit RGWGetObj_ObjStore_S3Website(bool is_errordoc_request
) : is_errordoc_request(false) { this->is_errordoc_request
= is_errordoc_request
; }
82 ~RGWGetObj_ObjStore_S3Website() override
{}
83 int send_response_data_error() override
;
84 int send_response_data(bufferlist
& bl
, off_t ofs
, off_t len
) override
;
85 // We override RGWGetObj_ObjStore::get_params here, to allow ignoring all
86 // conditional params for error pages.
87 int get_params() override
{
88 if (is_errordoc_request
) {
96 return RGWGetObj_ObjStore_S3::get_params();