Pregunta

I'm getting some really strange behaviour when running gevent's WSGIServer. It seems like every request that comes through is having its method interpreted incorrectly..

If I send the following requests:

requests.get('http://localhost:5000')
requests.head('http://localhost:5000')
requests.delete('http://localhost:5000')
requests.put('http://localhost:5000')
requests.post('http://localhost:5000')

This is what appears in the console:

127.0.0.1 - - [2012-01-22 14:55:36] "POST / HTTP/1.1" 405 183 "-" "python-requests/0.9.1"
127.0.0.1 - - [2012-01-22 14:55:41] "DELETE / HTTP/1.1" 405 185 "-" "python-requests/0.9.1"
127.0.0.1 - - [2012-01-22 14:55:46] "16 / HTTP/1.1" 405 181 "-" "python-requests/0.9.1"
127.0.0.1 - - [2012-01-22 14:55:50] "8 / HTTP/1.1" 405 180 "-" "python-requests/0.9.1"
127.0.0.1 - - [2012-01-22 14:56:13] "HEAD / HTTP/1.1" 200 0 "-" "python-requests/0.9.1"

For completeness, this is the script I'm running:

from gevent.wsgi import WSGIServer
from flask import Flask

app = Flask(__name__)
app.debug = True

@app.route("/")
def hello():
    return 'hello'

port = 5000

http_server = WSGIServer(('', port), app)
http_server.serve_forever()

What could be going on?

Edit:

I'm using gevent version: 0.13.0

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top