return -EINVAL;
}
+ if (website_conf.is_redirect_all && website_conf.redirect_all.hostname.empty()) {
+ s->err.message = "A host name must be provided to redirect all requests (e.g. \"example.com\").";
+ ldout(s->cct, 5) << s->err.message << dendl;
+ return -EINVAL;
+ } else if (!website_conf.is_redirect_all && !website_conf.is_set_index_doc) {
+ s->err.message = "A value for IndexDocument Suffix must be provided if RedirectAllRequestsTo is empty";
+ ldout(s->cct, 5) << s->err.message << dendl;
+ return -EINVAL;
+ } else if (!website_conf.is_redirect_all && website_conf.is_set_index_doc &&
+ website_conf.index_doc_suffix.empty()) {
+ s->err.message = "The IndexDocument Suffix is not well formed";
+ ldout(s->cct, 5) << s->err.message << dendl;
+ return -EINVAL;
+ }
+
return 0;
}
std::string subdir_marker;
std::string listing_css_doc;
bool listing_enabled;
+ bool is_redirect_all;
+ bool is_set_index_doc;
RGWBWRoutingRules routing_rules;
RGWBucketWebsiteConf()
: listing_enabled(false) {
+ is_redirect_all = false;
+ is_set_index_doc = false;
}
void encode(bufferlist& bl) const {
void RGWBucketWebsiteConf::decode_xml(XMLObj *obj) {
XMLObj *o = obj->find_first("RedirectAllRequestsTo");
if (o) {
+ is_redirect_all = true;
RGWXMLDecoder::decode_xml("HostName", redirect_all.hostname, o, true);
RGWXMLDecoder::decode_xml("Protocol", redirect_all.protocol, o);
} else {
o = obj->find_first("IndexDocument");
if (o) {
+ is_set_index_doc = true;
RGWXMLDecoder::decode_xml("Suffix", index_doc_suffix, o);
}
o = obj->find_first("ErrorDocument");