diff options
author | 2016-03-23 19:02:39 +0100 | |
---|---|---|
committer | 2016-03-23 19:02:39 +0100 | |
commit | e18643b7ac16dd5663753fb6ddbc49c7deb06e78 (patch) | |
tree | 770a963150ad026114975228d06c6530fd4f8235 /src/afb-hreq.c | |
parent | 1ddea9dd3848c640c0c63ba87056f6a850a7323d (diff) |
afb-req-itf: small step for abstracting
Change-Id: Iaad2c4077b1b28c30c3f1b0369fb82ca0a5909ab
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hreq.c')
-rw-r--r-- | src/afb-hreq.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c index 19efd4b2..613d4199 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -23,11 +23,12 @@ #include "../include/local-def.h" #include "afb-method.h" +#include "afb-req-itf.h" #include "afb-hreq.h" - static char empty_string[1] = ""; + /* a valid subpath is a relative path not looking deeper than root using .. */ static int validsubpath(const char *subpath) { @@ -229,3 +230,18 @@ int afb_hreq_redirect_to(struct afb_hreq *hreq, const char *url) return 1; } +const char *afb_hreq_get_cookie(struct afb_hreq *hreq, const char *name) +{ + return MHD_lookup_connection_value(hreq->connection, MHD_COOKIE_KIND, name); +} + +const char *afb_hreq_get_argument(struct afb_hreq *hreq, const char *name) +{ + return MHD_lookup_connection_value(hreq->connection, MHD_GET_ARGUMENT_KIND, name); +} + +struct afb_req_itf afb_hreq_itf = { + .get_cookie = (void*)afb_hreq_get_cookie, + .get_argument = (void*)afb_hreq_get_argument +}; + |