unsigned Message::parse_headers(const string &d)
{
- unsigned start = 0;
+ string::size_type start = 0;
while(1)
{
string::size_type lf = d.find('\n', start);
if(lf==start || (d[start]=='\r' && lf==start+1))
return lf+1;
- unsigned colon = d.find(':', start);
+ string::size_type colon = d.find(':', start);
if(colon>lf)
throw invalid_argument("Message::parse_headers");
Request Request::parse(const string &str)
{
- unsigned lf = str.find('\n');
+ string::size_type lf = str.find('\n');
vector<string> parts = split(str.substr(0, lf-(str[lf-1]=='\r')), ' ', 2);
if(parts.size()<3)
throw invalid_argument("Request::parse");
{
Response result;
- unsigned lf = str.find('\n');
+ string::size_type lf = str.find('\n');
vector<string> parts = split(str.substr(0, lf), ' ', 2);
if(parts.size()<2)
throw invalid_argument("Response::parse");
cl.request = new Request(Request::parse(cl.in_buf));
string addr_str = cl.sock->get_peer_address().str();
- unsigned colon = addr_str.find(':');
+ string::size_type colon = addr_str.find(':');
cl.request->set_header("-Client-Host", addr_str.substr(0, colon));
if(cl.request->get_method()!="GET" && cl.request->get_method()!="POST")
string host, serv;
if(str[0]=='[')
{
- unsigned bracket = str.find(']');
+ string::size_type bracket = str.find(']');
host = str.substr(1, bracket-1);
string::size_type colon = str.find(':', bracket);
if(colon!=string::npos)