Commit e0b47315 authored by Davis King's avatar Davis King

Minor code cleanup and error message improvement.

parent e5752c34
...@@ -126,7 +126,7 @@ namespace dlib ...@@ -126,7 +126,7 @@ namespace dlib
) )
{ {
using namespace std; using namespace std;
const size_t max = 16*1024; const size_t max = 64*1024;
buffer.clear(); buffer.clear();
buffer.reserve(300); buffer.reserve(300);
...@@ -136,7 +136,9 @@ namespace dlib ...@@ -136,7 +136,9 @@ namespace dlib
} }
// if we quit the loop because the data is longer than expected or we hit EOF // if we quit the loop because the data is longer than expected or we hit EOF
if (in.peek() == EOF || buffer.size() == max) if (in.peek() == EOF)
throw http_parse_error("HTTP field from client terminated incorrectly", 414);
if (buffer.size() == max)
throw http_parse_error("HTTP field from client is too long", 414); throw http_parse_error("HTTP field from client is too long", 414);
// Make sure the last char is the delim. // Make sure the last char is the delim.
...@@ -186,7 +188,7 @@ namespace dlib ...@@ -186,7 +188,7 @@ namespace dlib
string first_part_of_header; string first_part_of_header;
string::size_type position_of_double_point; string::size_type position_of_double_point;
// now loop over all the incoming_headers // now loop over all the incoming_headers
while (line.size() > 2) while (line != "\r")
{ {
position_of_double_point = line.find_first_of(':'); position_of_double_point = line.find_first_of(':');
if ( position_of_double_point != string::npos ) if ( position_of_double_point != string::npos )
...@@ -272,7 +274,7 @@ namespace dlib ...@@ -272,7 +274,7 @@ namespace dlib
} }
} // no ':' in it! } // no ':' in it!
read_with_limit(in, line); read_with_limit(in, line);
} // while (line.size() > 2 ) } // while (line != "\r")
// If there is data being posted back to us as a query string then // If there is data being posted back to us as a query string then
......
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