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) 2013 eNovance SAS <licensing@enovance.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.
15 #ifndef CEPH_RGW_CORS_SWIFT3_H
16 #define CEPH_RGW_CORS_SWIFT3_H
21 #include <include/types.h>
22 #include <include/str_list.h>
26 class RGWCORSConfiguration_SWIFT : public RGWCORSConfiguration
29 RGWCORSConfiguration_SWIFT() {}
30 ~RGWCORSConfiguration_SWIFT() {}
31 int create_update(const char *allow_origins, const char *allow_headers,
32 const char *expose_headers, const char *max_age) {
35 unsigned long a = CORS_MAX_AGE_INVALID;
36 uint8_t flags = RGW_CORS_ALL;
38 string ao = allow_origins;
42 for(set<string>::iterator it = oc.begin(); it != oc.end(); ++it) {
44 if (validate_name_string(host) != 0)
46 o.insert(o.end(), host);
49 string ah = allow_headers;
51 for(set<string>::iterator it = h.begin();
52 it != h.end(); ++it) {
54 if (validate_name_string(s) != 0)
60 string eh = expose_headers;
65 a = strtoul(max_age, &end, 10);
67 a = CORS_MAX_AGE_INVALID;
70 RGWCORSRule rule(o, h, e, flags, a);
75 #endif /*CEPH_RGW_CORS_SWIFT3_H*/