X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fhttp%2Fmessage.cpp;h=92321e8a87bd4c953f039141724c621c2d977ac2;hb=b4e0f7ed23f24e78fd09c9b7f206279e16d38c1e;hp=45392048e3c188cfbab45f17e600748cfe229da7;hpb=aea563e0c847ab07f60adc92b40a9f046738932c;p=libs%2Fnet.git diff --git a/source/http/message.cpp b/source/http/message.cpp index 4539204..92321e8 100644 --- a/source/http/message.cpp +++ b/source/http/message.cpp @@ -35,7 +35,7 @@ void Message::add_content(const string &d) content += d; if(headers.count("Content-Type")==0) set_header("Content-Type", "text/plain"); - set_header("Content-Length", lexical_cast(content.size())); + set_header("Content-Length", lexical_cast(content.size())); } void Message::set_user_data(const Variant &d) @@ -51,8 +51,8 @@ unsigned Message::parse_content(const string &d) HeaderMap::const_iterator i = headers.find("Content-Length"); if(i!=headers.end()) { - unsigned needed = lexical_cast(i->second)-content.size(); - unsigned len = min(needed, d.size()); + string::size_type needed = lexical_cast(i->second)-content.size(); + string::size_type len = min(needed, d.size()); content.append(d, 0, len); @@ -65,12 +65,12 @@ unsigned Message::parse_content(const string &d) i = headers.find("Transfer-Encoding"); if(i!=headers.end() && strcasecmp(i->second, "chunked")==0) { - unsigned pos = 0; + string::size_type pos = 0; while(!complete && pos(strip(d.substr(pos, lf-pos)), "x"); @@ -80,7 +80,7 @@ unsigned Message::parse_content(const string &d) } else { - unsigned len = min(chunk_length, d.size()-pos); + string::size_type len = min(chunk_length, d.size()-pos); content.append(d, pos, len); chunk_length -= len; if((pos = d.find('\n', pos+len))!=string::npos) @@ -97,16 +97,16 @@ unsigned Message::parse_content(const string &d) unsigned Message::parse_headers(const string &d) { - unsigned start = 0; + string::size_type start = 0; while(1) { - unsigned lf = d.find('\n', start); + string::size_type lf = d.find('\n', start); if(lf==string::npos) throw invalid_argument("Message::parse_headers"); 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");