summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-08-21 00:52:59 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-08-21 00:52:59 +0200
commitde2b1358926d293c85277e1d9a58ac94915470ec (patch)
tree76596fe46b403d9024df4164c4aea7c0666e5435 /methods/http.cc
parent75954ae2420ae7755d8482f2f1eecc03595a5153 (diff)
downloadapt-de2b1358926d293c85277e1d9a58ac94915470ec.tar.gz
* methods/http.cc:
- some http servers violate HTTP1.1 by not issuing a Reason-Phrase (or at least a space after the code) especially for 200, but lets be nice and ignore it as we don't need the reason in general
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/methods/http.cc b/methods/http.cc
index 9fa74bffa..25e31de9a 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -553,8 +553,14 @@ bool ServerState::HeaderLine(string Line)
// Evil servers return no version
if (Line[4] == '/')
{
- if (sscanf(Line.c_str(),"HTTP/%u.%u %u%[^\n]",&Major,&Minor,
- &Result,Code) != 4)
+ int const elements = sscanf(Line.c_str(),"HTTP/%u.%u %u%[^\n]",&Major,&Minor,&Result,Code);
+ if (elements == 3)
+ {
+ Code[0] = '\0';
+ if (Debug == true)
+ clog << "HTTP server doesn't give Reason-Phrase for " << Result << std::endl;
+ }
+ else if (elements != 4)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
else