X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fresponse.cpp;h=6005d35ae6e1e26bf62837262485302e5d3df117;hb=3f46fef7032d97b0dd82971ffece1062fd6b05b8;hp=739a20f3da2fa2ba6503e13b216ba842b9403ec3;hpb=b4e0f7ed23f24e78fd09c9b7f206279e16d38c1e;p=libs%2Fnet.git diff --git a/source/http/response.cpp b/source/http/response.cpp index 739a20f..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; @@ -24,7 +24,9 @@ Response Response::parse(const string &str) Response result; string::size_type lf = str.find('\n'); - vector parts = split(str.substr(0, lf), ' ', 2); + 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");