ceph/ceph — pull request #98 by anbu-enovance (2013-03-11 10:32:42+00:00)
Title: CORS feature implementation for SWIFT and S3 backends of radosgw

S3 REST API support:
--------------------
Referred from - http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html

1. S3 has a well defined REST API sturcture for submitting, fetching and
deleting a CORS configuration for a bucket.
2. The CORS configuration is an XML document which defines multiple rules,
with each rule defining the list of http methods allowed on the host(s), the list
of allowed headers and exposable headers.
3. It validates CORS through a pre-flight request on either the object or the
bucket.

CORS on SWIFT:
--------------
Referred from - http://docs.openstack.org/developer/swift/cors.html

1. SWIFT set the CORS configuration through Post metadata on a container.
2. The list of origins in X-Container-Meta-Access-Control-Allow-Origin will
have all the HTTP methods supported.
3. Like S3, SWIFT validates CORS thorugh a pre-flight request.

Following are common for both S3 and SWIFT:
1. CORS configuration is encoded and saved on the xattrs of the bucket with
the name RGW_ATTR_CORS
2. CORS configuration is encoded in the same way for both.
3. The pre-flight request validation method is same for both.

CORS support is enabled by the following:
rgw_cors - Contains the base classes
rgw_cors_s3 - Inherited from rgw_cors and contains S3 specific implementation
rgw_cors_swift - Inherited from rgw_cors and contains SWIFT specific
implementation

Following are the list of CORS op:
RGWGetCORS - applicable only for S3. This class sends an existing CORS
configuration for a bucket
RGWPutCORS - applicable only for S3. This one receives a CORS
configuration for a bucket and Replaces the new xml configuration
with the old one
RGWDeleteCORS - applicable only for S3. This class deletes an existing CORS
configuration for a bucket
RGWOptionsCORS - This is a base class which will be inherited by both SWIFT
and S3. This handles the validation of pre-flight requests.
*modified* RGWPutMetaData to handle SWIFT metadatas that are CORS specific