Пример #1
0
# path for test certificate
SERVER_CERT_PEM_FILE = 'server.test.pem'

# whether to use a proxy server with HTTP/2 support
USE_HTTP2_SERVER = config.USE_HTTP2_SERVER

# CORS constants
CORS_ALLOWED_HEADERS = [
    'authorization', 'content-type', 'content-md5', 'cache-control',
    'x-amz-content-sha256', 'x-amz-date', 'x-amz-security-token',
    'x-amz-user-agent', 'x-amz-target', 'x-amz-acl', 'x-amz-version-id',
    'x-localstack-target', 'x-amz-tagging'
]
if EXTRA_CORS_ALLOWED_HEADERS:
    CORS_ALLOWED_HEADERS += EXTRA_CORS_ALLOWED_HEADERS.split(',')

CORS_ALLOWED_METHODS = ('HEAD', 'GET', 'PUT', 'POST', 'DELETE', 'OPTIONS',
                        'PATCH')

CORS_EXPOSE_HEADERS = ('x-amz-version-id', )
if EXTRA_CORS_EXPOSE_HEADERS:
    CORS_EXPOSE_HEADERS += tuple(EXTRA_CORS_EXPOSE_HEADERS.split(','))


class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
    """Handle each request in a separate thread."""
    daemon_threads = True


class ProxyListener(object):
Пример #2
0
from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from localstack.config import TMP_FOLDER, USE_SSL, EXTRA_CORS_ALLOWED_HEADERS, EXTRA_CORS_EXPOSE_HEADERS
from localstack.constants import ENV_INTERNAL_TEST_RUN
from localstack.utils.common import FuncThread, generate_ssl_cert, to_bytes

QUIET = False

# path for test certificate
SERVER_CERT_PEM_FILE = '%s/server.test.pem' % (TMP_FOLDER)

CORS_ALLOWED_HEADERS = ('authorization', 'content-type', 'content-md5',
                        'cache-control', 'x-amz-content-sha256', 'x-amz-date',
                        'x-amz-security-token', 'x-amz-user-agent',
                        'x-amz-acl', 'x-amz-version-id')
if EXTRA_CORS_ALLOWED_HEADERS:
    CORS_ALLOWED_HEADERS += tuple(EXTRA_CORS_ALLOWED_HEADERS.split(','))

CORS_ALLOWED_METHODS = ('HEAD', 'GET', 'PUT', 'POST', 'DELETE', 'OPTIONS',
                        'PATCH')

CORS_EXPOSE_HEADERS = ('x-amz-version-id', )
if EXTRA_CORS_EXPOSE_HEADERS:
    CORS_EXPOSE_HEADERS += tuple(EXTRA_CORS_EXPOSE_HEADERS.split(','))

# set up logger
LOG = logging.getLogger(__name__)


class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
    """Handle each request in a separate thread."""
    daemon_threads = True