Commit ab668b37 authored by Rob Swindell's avatar Rob Swindell 💬
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
Pipeline #2344 failed with stage
in 7 minutes and 24 seconds
......@@ -58,6 +58,7 @@
#include "websrvr.h"
#include "base64.h"
#include "md5.h"
#include "hex.h"
#include "js_rtpool.h"
#include "js_request.h"
#include "js_socket.h"
......@@ -2977,7 +2978,7 @@ static char *get_request(http_session_t * session, char *req_line)
/* Must initialize physical_path before calling is_dynamic_req() */
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) {
scheme = http_scheme;
......
......@@ -164,6 +164,7 @@
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\encode\hex.c" />
<ClCompile Include="ars.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment