阅读整个(而不是更多)请求体

时间:2015-07-27 16:38:17

标签: python http httprequest wsgi

#!/usr/bin/env python

from wsgiref.simple_server import make_server

def app(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    return repr(environ['wsgi.input'].readlines()),

make_server('127.63.31.15', 54321, app).serve_forever()

当我启动此脚本并尝试通过cURL连接时:

curl -LvA Mozilla/4.0 -d lol=cat $'http://127.63.31.15:54321/'
*   Trying 127.63.31.15...
* Connected to 127.63.31.15 (127.63.31.15) port 54321 (#0)
> POST / HTTP/1.1
> Host: 127.63.31.15:54321
> User-Agent: Mozilla/4.0
> Accept: */*
> Content-Length: 7
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 7 out of 7 bytes

......它只是挂起。我做错了什么?

0 个答案:

没有答案