summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--methods/basehttp.cc3
-rw-r--r--methods/basehttp.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index b75b450cc..3786e2e6c 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -110,6 +110,9 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
if (sscanf(Line.c_str(),"HTTP %3u%359[^\n]",&Result,Code) != 2)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
+ auto const CodeLen = strlen(Code);
+ auto const CodeEnd = std::remove_if(Code, Code + CodeLen, [](char c) { return isprint(c) == 0; });
+ *CodeEnd = '\0';
/* Check the HTTP response header to get the default persistence
state. */
diff --git a/methods/basehttp.h b/methods/basehttp.h
index 62c9963ea..c0d14d854 100644
--- a/methods/basehttp.h
+++ b/methods/basehttp.h
@@ -60,7 +60,7 @@ struct RequestState
bool AddPartialFileToHashes(FileFd &File);
RequestState(BaseHttpMethod * const Owner, ServerState * const Server) :
- Owner(Owner), Server(Server) { time(&Date); }
+ Owner(Owner), Server(Server) { time(&Date); Code[0] = '\0'; }
};
struct ServerState
{