X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Frequest.cpp;h=f050e0440084d0a0b447875fec014d7ef4940dee;hb=8c4ac1a6f0e154ebcbc72e196d24df322da673bc;hp=c948755ae78281cb1c36378de491a1cd0c948cd7;hpb=debe1004676d5431e571d9c4361072661dcc88c4;p=libs%2Fnet.git diff --git a/source/http/request.cpp b/source/http/request.cpp index c948755..f050e04 100644 --- a/source/http/request.cpp +++ b/source/http/request.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "request.h" @@ -12,7 +12,10 @@ namespace Http { Request::Request(const string &m, const string &p): method(m), path(p) -{ } +{ + if(path.find(' ')!=string::npos) + throw invalid_argument("Request::Request"); +} string Request::str() const { @@ -45,7 +48,7 @@ Request Request::from_url(const string &str) if(url.scheme!="http") throw invalid_argument("Request::from_url"); - string path = url.path; + string path = urlencode(url.path); if(path.empty()) path = "/"; if(!url.query.empty())