X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresponse.cpp;fp=source%2Fresponse.cpp;h=0000000000000000000000000000000000000000;hb=cf8d2e48581eeb8f1b83e8c48321a0bc2ffa6d83;hp=ede249b7e11afa467e5423f4c4a54faa091fc59c;hpb=d683ca0964182e9579838fec8d7d100eeabddee0;p=libs%2Fnet.git diff --git a/source/response.cpp b/source/response.cpp deleted file mode 100644 index ede249b..0000000 --- a/source/response.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include "response.h" - -using namespace std; - -namespace Msp { -namespace Http { - -Response::Response(Status s): - status(s) -{ } - -string Response::str() const -{ - string result = format("%s %d %s\r\n", version_str(http_version), static_cast(status), status); - result += str_common(); - - return result; -} - -Response Response::parse(const string &str) -{ - Response result; - - unsigned lf = str.find('\n'); - vector parts = split(str.substr(0, lf), ' ', 2); - if(parts.size()<2) - throw invalid_argument("Response::parse"); - - result.http_version = parse_version(parts[0]); - result.status = static_cast(lexical_cast(parts[1])); - - lf += result.parse_headers(str.substr(lf+1)); - - result.parse_content(str.substr(lf+1)); - - return result; -} - -} // namespace Http -} // namespace Msp