diff options
Diffstat (limited to '')
-rw-r--r-- | test/python/204_no_content/wsgi.py | 4 | ||||
-rw-r--r-- | test/python/atexit/wsgi.py | 12 | ||||
-rw-r--r-- | test/python/empty/wsgi.py | 3 | ||||
-rw-r--r-- | test/python/mirror/wsgi.py | 10 | ||||
-rw-r--r-- | test/python/query_string/wsgi.py | 7 | ||||
-rw-r--r-- | test/python/server_port/wsgi.py | 7 | ||||
-rw-r--r-- | test/python/variables/wsgi.py | 15 |
7 files changed, 58 insertions, 0 deletions
diff --git a/test/python/204_no_content/wsgi.py b/test/python/204_no_content/wsgi.py new file mode 100644 index 00000000..2184ffeb --- /dev/null +++ b/test/python/204_no_content/wsgi.py @@ -0,0 +1,4 @@ +def application(environ, start_response): + + start_response('204 No Content', []) + return [] diff --git a/test/python/atexit/wsgi.py b/test/python/atexit/wsgi.py new file mode 100644 index 00000000..9ad300b9 --- /dev/null +++ b/test/python/atexit/wsgi.py @@ -0,0 +1,12 @@ +import atexit + +def application(environ, start_response): + test_dir = environ.get('HTTP_TEST_DIR') + + def create_file(): + open(test_dir + '/atexit', 'w') + + atexit.register(create_file) + + start_response('200', [('Content-Length', '0')]) + return [] diff --git a/test/python/empty/wsgi.py b/test/python/empty/wsgi.py new file mode 100644 index 00000000..ce03850a --- /dev/null +++ b/test/python/empty/wsgi.py @@ -0,0 +1,3 @@ +def application(env, start_response): + start_response('200', [('Content-Length', '0')]) + return [] diff --git a/test/python/mirror/wsgi.py b/test/python/mirror/wsgi.py new file mode 100644 index 00000000..e4df67ec --- /dev/null +++ b/test/python/mirror/wsgi.py @@ -0,0 +1,10 @@ +def application(environ, start_response): + + content_length = int(environ.get('CONTENT_LENGTH', 0)) + body = bytes(environ['wsgi.input'].read(content_length)) + + start_response('200', [ + ('Content-Type', environ.get('CONTENT_TYPE')), + ('Content-Length', str(len(body))) + ]) + return [body] diff --git a/test/python/query_string/wsgi.py b/test/python/query_string/wsgi.py new file mode 100644 index 00000000..90f1c7ec --- /dev/null +++ b/test/python/query_string/wsgi.py @@ -0,0 +1,7 @@ +def application(environ, start_response): + + start_response('200', [ + ('Content-Length', '0'), + ('Query-String', environ.get('QUERY_STRING')) + ]) + return [] diff --git a/test/python/server_port/wsgi.py b/test/python/server_port/wsgi.py new file mode 100644 index 00000000..89cd82b3 --- /dev/null +++ b/test/python/server_port/wsgi.py @@ -0,0 +1,7 @@ +def application(environ, start_response): + + start_response('200', [ + ('Content-Length', '0'), + ('Server-Port', environ.get('SERVER_PORT')) + ]) + return [] diff --git a/test/python/variables/wsgi.py b/test/python/variables/wsgi.py new file mode 100644 index 00000000..1d4d397d --- /dev/null +++ b/test/python/variables/wsgi.py @@ -0,0 +1,15 @@ +def application(environ, start_response): + + content_length = int(environ.get('CONTENT_LENGTH', 0)) + body = bytes(environ['wsgi.input'].read(content_length)) + + start_response('200', [ + ('Content-Type', environ.get('CONTENT_TYPE')), + ('Content-Length', str(len(body))), + ('Request-Method', environ.get('REQUEST_METHOD')), + ('Request-Uri', environ.get('REQUEST_URI')), + ('Http-Host', environ.get('HTTP_HOST')), + ('Server-Protocol', environ.get('SERVER_PROTOCOL')), + ('Custom-Header', environ.get('HTTP_CUSTOM_HEADER')) + ]) + return [body] |