From 7637164ae7d7169c095af73a3e3b8a83e09da2a0 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 23 Mar 2015 04:13:50 +0000 Subject: [PATCH] Parse filename for POST requests so we can return it in the "Location:" header subsequently --- examples/cc26xx/cc26xx-web-demo/httpd-simple.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/cc26xx/cc26xx-web-demo/httpd-simple.c b/examples/cc26xx/cc26xx-web-demo/httpd-simple.c index 4f63340b1..dd6bf618d 100644 --- a/examples/cc26xx/cc26xx-web-demo/httpd-simple.c +++ b/examples/cc26xx/cc26xx-web-demo/httpd-simple.c @@ -1124,6 +1124,15 @@ PT_THREAD(handle_input(struct httpd_state *s)) } } else if(strncasecmp(s->inputbuf, http_post, 5) == 0) { s->request_type = REQUEST_TYPE_POST; + PSOCK_READTO(&s->sin, ISO_space); + + if(s->inputbuf[0] != ISO_slash) { + PSOCK_CLOSE_EXIT(&s->sin); + } + + s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; + strncpy(s->filename, s->inputbuf, sizeof(s->filename)); + /* POST: Read out the rest of the line and ignore it */ PSOCK_READTO(&s->sin, ISO_nl);