Skip to content
Snippets Groups Projects
Commit ab668b37 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Filenames with '+' characters in them could not be served unless encoded

The requested path was being URL-decoded with unescape(), but that function does a '+' to ' ' (space) conversion.
The '+' to space decoding is supposed to occur for the "query" portion of the URL only, not the "path" portion.
Use the new hex_decode() function instead of unescape() for "path" decoding.
parent 130bdba4
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2344 failed
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "websrvr.h" #include "websrvr.h"
#include "base64.h" #include "base64.h"
#include "md5.h" #include "md5.h"
#include "hex.h"
#include "js_rtpool.h" #include "js_rtpool.h"
#include "js_request.h" #include "js_request.h"
#include "js_socket.h" #include "js_socket.h"
...@@ -2977,7 +2978,7 @@ static char *get_request(http_session_t * session, char *req_line) ...@@ -2977,7 +2978,7 @@ static char *get_request(http_session_t * session, char *req_line)
/* Must initialize physical_path before calling is_dynamic_req() */ /* Must initialize physical_path before calling is_dynamic_req() */
SAFECOPY(session->req.physical_path,session->req.virtual_path); SAFECOPY(session->req.physical_path,session->req.virtual_path);
unescape(session->req.physical_path); hex_decode('%', session->req.physical_path);
if (strnicmp(session->req.physical_path,http_scheme,http_scheme_len) == 0) { if (strnicmp(session->req.physical_path,http_scheme,http_scheme_len) == 0) {
scheme = http_scheme; scheme = http_scheme;
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
</Bscmake> </Bscmake>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\encode\hex.c" />
<ClCompile Include="ars.c"> <ClCompile Include="ars.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment