]> git.tdb.fi Git - libs/net.git/blobdiff - source/http/response.cpp
Reject HTTP messages starting with a linefeed
[libs/net.git] / source / http / response.cpp
index 739a20f3da2fa2ba6503e13b216ba842b9403ec3..6fa4cc333a58d6c4bee716987428310bdc6daf85 100644 (file)
@@ -24,7 +24,9 @@ Response Response::parse(const string &str)
        Response result;
 
        string::size_type lf = str.find('\n');
-       vector<string> parts = split(str.substr(0, lf), ' ', 2);
+       if(lf==0)
+               throw invalid_argument("Response::parse");
+       vector<string> parts = split(str.substr(0, lf-(str[lf-1]=='\r')), ' ', 2);
        if(parts.size()<2)
                throw invalid_argument("Response::parse");