diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-14 14:39:10 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-14 14:39:10 +0100 |
commit | 1231491515aca29877935f44d5a97ced86066dd2 (patch) | |
tree | 398c435dde7b5965dc8bb7605acb69299eb664d4 | |
parent | 1dc25c6396d8dbb6b1505751babaa499d4a68315 (diff) |
Fix Rootdir redirect for static files
-rw-r--r-- | nbproject/configurations.xml | 132 | ||||
-rw-r--r-- | 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 @@ </toolsSet> <flagsDictionary> <element flagsID="0" commonFlags="-fPIE"/> + <element flagsID="1" commonFlags="-mtune=generic -march=x86-64 -fPIE"/> </flagsDictionary> <codeAssistance> </codeAssistance> @@ -56,13 +57,6 @@ <buildCommand>${MAKE} -f Makefile</buildCommand> <cleanCommand>${MAKE} -f Makefile clean</cleanCommand> <executablePath>build/src/afb-daemon</executablePath> - <cTool> - <incDir> - <pElem>include</pElem> - <pElem>/usr/include/json-c</pElem> - <pElem>build/src</pElem> - </incDir> - </cTool> </makeTool> <preBuild> <preBuildCommandWorkingDir>build</preBuildCommandWorkingDir> @@ -71,35 +65,145 @@ </preBuild> </makefileType> <item path="src/afbs-api.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/alsa-api.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/config.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/dbus-api.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/http-svc.c" ex="false" tool="0" flavor2="2"> <cTool flags="0"> + <incDir> + <pElem>include</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>build/src</pElem> + </incDir> </cTool> </item> <item path="src/main.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/rest-api.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>include</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> <item path="src/session.c" ex="false" tool="0" flavor2="2"> - <cTool flags="0"> + <cTool flags="1"> + <incDir> + <pElem>src</pElem> + <pElem>/usr/include/json-c</pElem> + <pElem>/usr/include/uuid</pElem> + <pElem>include</pElem> + <pElem>build/src</pElem> + </incDir> + <preprocessorList> + <Elem>__PIC__=2</Elem> + <Elem>__PIE__=2</Elem> + <Elem>__REGISTER_PREFIX__=</Elem> + <Elem>__USER_LABEL_PREFIX__=</Elem> + <Elem>__pic__=2</Elem> + <Elem>__pie__=2</Elem> + </preprocessorList> </cTool> </item> </conf> 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); |