|
@@ -1,8 +1,21 @@
|
1
|
1
|
import sys
|
2
|
2
|
import os
|
3
|
3
|
import time
|
|
4
|
+from pprint import pformat
|
4
|
5
|
|
5
|
6
|
def entrypoint(env, start_response):
|
6
|
7
|
write_body = start_response("200 OK", [('Content-type', 'text/plain')])
|
7
|
|
- write_body('Hello world !')
|
8
|
|
- return ['Hello world !']
|
|
8
|
+
|
|
9
|
+ if not "wsgi.input" in env:
|
|
10
|
+ raise ValueError("Given environ does not contain any 'wsgi.input' key !")
|
|
11
|
+ data_in = env["wsgi.input"]
|
|
12
|
+ #for l in data_in:
|
|
13
|
+ # write_body("POST data line : %s" % repr(l))
|
|
14
|
+ #data = data_in.readlines()
|
|
15
|
+ while True:
|
|
16
|
+ data = data_in.read(98)
|
|
17
|
+ write_body("POST data : %s\n====\n" % repr(data))
|
|
18
|
+ if not data:
|
|
19
|
+ break
|
|
20
|
+ write_body("Environ data :\n'%s'\n====\n" % pformat(env))
|
|
21
|
+ return ['Hello world !\n']
|