Commit 2f8a06d5 authored by Davis King's avatar Davis King

Made HTTP server parsing work when a query like "GET /" comes in that

is missing the HTTP/1.1 version field.
parent f67cc883
......@@ -130,7 +130,7 @@ namespace dlib
buffer.clear();
buffer.reserve(300);
while (in.peek() != delim && in.peek() != EOF && buffer.size() < max)
while (in.peek() != delim && in.peek() != '\n' && in.peek() != EOF && buffer.size() < max)
{
buffer += (char)in.get();
}
......@@ -141,15 +141,8 @@ namespace dlib
if (buffer.size() == max)
throw http_parse_error("HTTP field from client is too long", 414);
// Make sure the last char is the delim.
if (in.get() != delim)
{
in.setstate(ios::badbit);
buffer.clear();
}
else
{
// Read the remaining delimiters
in.get();
// eat any remaining whitespace
if (delim == ' ')
{
while (in.peek() == ' ')
......@@ -157,7 +150,6 @@ namespace dlib
}
}
}
}
// ----------------------------------------------------------------------------------------
......
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