1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
5 * Ceph - scalable distributed file system
7 * Copyright (C) 2013 eNovance SAS <licensing@enovance.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_CORS_SWIFT3_H
17 #define CEPH_RGW_CORS_SWIFT3_H
22 #include <include/types.h>
23 #include <include/str_list.h>
27 class RGWCORSConfiguration_SWIFT
: public RGWCORSConfiguration
30 RGWCORSConfiguration_SWIFT() {}
31 ~RGWCORSConfiguration_SWIFT() {}
32 int create_update(const char *allow_origins
, const char *allow_headers
,
33 const char *expose_headers
, const char *max_age
) {
36 unsigned long a
= CORS_MAX_AGE_INVALID
;
37 uint8_t flags
= RGW_CORS_ALL
;
39 string ao
= allow_origins
;
43 for(set
<string
>::iterator it
= oc
.begin(); it
!= oc
.end(); ++it
) {
45 if (validate_name_string(host
) != 0)
47 o
.insert(o
.end(), host
);
50 string ah
= allow_headers
;
52 for(set
<string
>::iterator it
= h
.begin();
53 it
!= h
.end(); ++it
) {
55 if (validate_name_string(s
) != 0)
61 string eh
= expose_headers
;
66 a
= strtoul(max_age
, &end
, 10);
68 a
= CORS_MAX_AGE_INVALID
;
71 RGWCORSRule
rule(o
, h
, e
, flags
, a
);
76 #endif /*CEPH_RGW_CORS_SWIFT3_H*/