From 1231491515aca29877935f44d5a97ced86066dd2 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Mon, 14 Dec 2015 14:39:10 +0100 Subject: [PATCH] Fix Rootdir redirect for static files --- nbproject/configurations.xml | 132 ++++++++++++++++++++++++++++++++++++++----- src/http-svc.c | 1 + 2 files changed, 119 insertions(+), 14 deletions(-) diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 3d743b11..d9919548 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -47,6 +47,7 @@ + @@ -56,13 +57,6 @@ ${MAKE} -f Makefile ${MAKE} -f Makefile clean build/src/afb-daemon - - - include - /usr/include/json-c - build/src - - build @@ -71,35 +65,145 @@ - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + + + include + /usr/include/json-c + build/src + - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + - + + + src + /usr/include/json-c + include + /usr/include/uuid + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + - + + + src + /usr/include/json-c + /usr/include/uuid + include + build/src + + + __PIC__=2 + __PIE__=2 + __REGISTER_PREFIX__= + __USER_LABEL_PREFIX__= + __pic__=2 + __pie__=2 + diff --git a/src/http-svc.c b/src/http-svc.c index ac5cd789..0f7f80ca 100644 --- a/src/http-svc.c +++ b/src/http-svc.c @@ -107,6 +107,7 @@ STATIC int servFile (struct MHD_Connection *connection, AFB_session *session, co // No trailing '/'. Let's add one and redirect for relative paths to work if (url [strlen (url) -1] != '/') { response = MHD_create_response_from_buffer(0,"", MHD_RESPMEM_PERSISTENT); + strncpy(staticfile->path, url, sizeof (staticfile->path)); strncat(staticfile->path, "/", sizeof (staticfile->path)); MHD_add_response_header (response, "Location", staticfile->path); MHD_queue_response (connection, MHD_HTTP_MOVED_PERMANENTLY, response); -- 2.16.6