X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fresponse.cpp;h=6005d35ae6e1e26bf62837262485302e5d3df117;hb=HEAD;hp=85e279f579a35cd08a6e4ad446ef1836771a282e;hpb=aea563e0c847ab07f60adc92b40a9f046738932c;p=libs%2Fnet.git diff --git a/source/http/response.cpp b/source/http/response.cpp index 85e279f..6005d35 100644 --- a/source/http/response.cpp +++ b/source/http/response.cpp @@ -1,6 +1,6 @@ +#include "response.h" #include #include -#include "response.h" using namespace std; @@ -23,8 +23,10 @@ Response Response::parse(const string &str) { Response result; - unsigned lf = str.find('\n'); - vector parts = split(str.substr(0, lf), ' ', 2); + string::size_type lf = str.find('\n'); + if(lf==0) + throw invalid_argument("Response::parse"); + vector parts = split(str.substr(0, lf-(str[lf-1]=='\r')), ' ', 2); if(parts.size()<2) throw invalid_argument("Response::parse");