1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
Unix SMB/CIFS implementation.
Samba utility functions
Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
Implementation of the WSGI interface described in PEP0333
(http://www.python.org/dev/peps/pep-0333)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include <Python.h>
static PyObject *start_response(PyObject *args, PyObject *kwargs)
{
PyObject *response_header, *exc_info;
char *status;
const char *kwnames[] = {
"status", "response_header", "exc_info", NULL
};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *)"sOO:start_response", (char **)kwnames, &status, &response_header, &exc_info)) {
return NULL;
}
/* FIXME: response_header, exc_info */
/* FIXME: Wrap stdout */
return NULL;
}
static PyObject *create_environ(void)
{
PyObject *env, *osmodule, *osenviron;
osmodule = PyImport_ImportModule("os");
if (osmodule == NULL)
return NULL;
osenviron = PyObject_CallMethod(osmodule, "environ", NULL);
env = PyDict_Copy(osenviron);
PyDict_SetItemString(env, "wsgi.input", NULL); /* FIXME */
PyDict_SetItemString(env, "wsgi.errors", NULL); /* FIXME */
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);
PyDict_SetItemString(env, "wsgi.run_once", Py_False);
/* FIXME:
PyDict_SetItemString(env, "wsgi.url_scheme", "http");
PyDict_SetItemString(env, "wsgi.url_scheme", "https");
*/
return env;
}
|