'Base handler for OPTIONS requests
:param req: swob.Request object
:returns: swob.Response object'

@public
def OPTIONS(self, req):

    headers = {'Allow': ',    '.join(self.allowed_methods)}
    resp = Response(status=200, request=req, headers=headers)
    req_origin_value = req.headers.get('Origin', None)
    if (not req_origin_value):
        return resp
    try:
        container_info = self.container_info(self.account_name, self.container_name, req)
    except AttributeError:
        return resp
    cors = container_info.get('cors', {})
    if ((not self.is_origin_allowed(cors, req_origin_value)) or (req.headers.get('Access-Control-Request-Method') not in self.allowed_methods)):
        resp.status = HTTP_UNAUTHORIZED
        return resp
    if (cors.get('allow_origin') and (cors.get('allow_origin').strip() == '*')):
        headers['access-control-allow-origin'] = '*'
    else:
        headers['access-control-allow-origin'] = req_origin_value
        if ('vary' in headers):
            headers['vary'] += ',    Origin'
        else:
            headers['vary'] = 'Origin'
    if (cors.get('max_age') is not None):
        headers['access-control-max-age'] = cors.get('max_age')
    headers['access-control-allow-methods'] = ',    '.join(self.allowed_methods)
    allow_headers = set(list_from_csv(req.headers.get('Access-Control-Request-Headers')))
    if allow_headers:
        headers['access-control-allow-headers'] = ',    '.join(allow_headers)
        if ('vary' in headers):
            headers['vary'] += ',    Access-Control-Request-Headers'
        else:
            headers['vary'] = 'Access-Control-Request-Headers'
    resp.headers = headers
    return resp
