mirror of https://git.kore.io/kore.git
export http_body_path via python
This commit is contained in:
parent
2f670ce777
commit
c6ca68f3f2
|
@ -127,6 +127,7 @@ static PyObject *pyhttp_get_path(struct pyhttp_request *, void *);
|
|||
static PyObject *pyhttp_get_body(struct pyhttp_request *, void *);
|
||||
static PyObject *pyhttp_get_agent(struct pyhttp_request *, void *);
|
||||
static PyObject *pyhttp_get_method(struct pyhttp_request *, void *);
|
||||
static PyObject *pyhttp_get_body_path(struct pyhttp_request *, void *);
|
||||
static PyObject *pyhttp_get_connection(struct pyhttp_request *, void *);
|
||||
|
||||
static PyGetSetDef pyhttp_request_getset[] = {
|
||||
|
@ -135,6 +136,7 @@ static PyGetSetDef pyhttp_request_getset[] = {
|
|||
GETTER("body", pyhttp_get_body),
|
||||
GETTER("agent", pyhttp_get_agent),
|
||||
GETTER("method", pyhttp_get_method),
|
||||
GETTER("body_path", pyhttp_get_body_path),
|
||||
GETTER("connection", pyhttp_get_connection),
|
||||
GETTER(NULL, NULL)
|
||||
};
|
||||
|
|
15
src/python.c
15
src/python.c
|
@ -1071,6 +1071,21 @@ pyhttp_get_method(struct pyhttp_request *pyreq, void *closure)
|
|||
return (method);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pyhttp_get_body_path(struct pyhttp_request *pyreq, void *closure)
|
||||
{
|
||||
PyObject *path;
|
||||
|
||||
if (pyreq->req->http_body_path == NULL) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if ((path = PyUnicode_FromString(pyreq->req->http_body_path)) == NULL)
|
||||
return (PyErr_NoMemory());
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pyhttp_get_connection(struct pyhttp_request *pyreq, void *closure)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue