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