From a4e8ff7429db8620a4d91e901295413560be6c91 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 May 2008 03:54:47 +0200 Subject: Add more parts of the WSGI implementation. --- source4/web_server/wsgi.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'source4/web_server') diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c index 50f8599869..3253873de2 100644 --- a/source4/web_server/wsgi.c +++ b/source4/web_server/wsgi.c @@ -41,9 +41,32 @@ static PyObject *start_response(PyObject *args, PyObject *kwargs) return NULL; } +/* + * read(size) input 1 + * readline() input 1,2 + * readlines(hint) input 1,3 + * __iter__() input + * flush() errors 4 + * write(str) errors + * writelines(seq) errors + */ + +static PyObject *Py_InputHttpStream(void *foo) +{ + /* FIXME */ + return NULL; +} + +static PyObject *Py_ErrorHttpStream(void) +{ + /* FIXME */ + return NULL; +} + static PyObject *create_environ(void) { PyObject *env, *osmodule, *osenviron; + PyObject *inputstream, *errorstream; osmodule = PyImport_ImportModule("os"); if (osmodule == NULL) @@ -53,8 +76,23 @@ static PyObject *create_environ(void) env = PyDict_Copy(osenviron); - PyDict_SetItemString(env, "wsgi.input", NULL); /* FIXME */ - PyDict_SetItemString(env, "wsgi.errors", NULL); /* FIXME */ + Py_DECREF(env); + + inputstream = Py_InputHttpStream(NULL); /* FIXME */ + if (inputstream == NULL) { + Py_DECREF(env); + return NULL; + } + + errorstream = Py_ErrorHttpStream(); + if (errorstream == NULL) { + Py_DECREF(env); + Py_DECREF(inputstream); + return NULL; + } + + PyDict_SetItemString(env, "wsgi.input", inputstream); + PyDict_SetItemString(env, "wsgi.errors", errorstream); PyDict_SetItemString(env, "wsgi.version", Py_BuildValue("(i,i)", 1, 0)); PyDict_SetItemString(env, "wsgi.multithread", Py_False); PyDict_SetItemString(env, "wsgi.multiprocess", Py_True); -- cgit