From e92a889bcc625882fbe2e6f72f018d4dc70e869e Mon Sep 17 00:00:00 2001 From: "roberto@debian32" Date: Sat, 3 Sep 2011 07:15:51 +0200 Subject: [PATCH] refactored UWSGI_PY_READLINE_BUFSIZE --- plugins/python/uwsgi_python.h | 4 +++- plugins/python/wsgi_handlers.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/python/uwsgi_python.h b/plugins/python/uwsgi_python.h index 36b8ab50..ce5be320 100644 --- a/plugins/python/uwsgi_python.h +++ b/plugins/python/uwsgi_python.h @@ -94,9 +94,11 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); #define LOADER_MAX 8 +#define UWSGI_PY_READLINE_BUFSIZE 1024 + typedef struct uwsgi_Input { PyObject_HEAD - char readline[1024]; + char readline[UWSGI_PY_READLINE_BUFSIZE]; size_t readline_size; size_t readline_max_size; size_t readline_pos; diff --git a/plugins/python/wsgi_handlers.c b/plugins/python/wsgi_handlers.c index 7f155aef..ce4fe62d 100644 --- a/plugins/python/wsgi_handlers.c +++ b/plugins/python/wsgi_handlers.c @@ -46,11 +46,11 @@ PyObject *uwsgi_Input_getline(uwsgi_Input *self) { return PyErr_Format(PyExc_IOError, "error waiting for wsgi.input data"); } - if (self->readline_max_size > 0 && self->readline_max_size < 1024) { + if (self->readline_max_size > 0 && self->readline_max_size < UWSGI_PY_READLINE_BUFSIZE) { rlen = read(wsgi_req->poll.fd, self->readline, self->readline_max_size); } else { - rlen = read(wsgi_req->poll.fd, self->readline, 1024); + rlen = read(wsgi_req->poll.fd, self->readline, UWSGI_PY_READLINE_BUFSIZE); } if (rlen <= 0) { UWSGI_GET_GIL