Skip to content

Commit

Permalink
Merge pull request yedf2#28 from kingchin1218/master
Browse files Browse the repository at this point in the history
change naming
  • Loading branch information
yedf2 authored Oct 2, 2017
2 parents 5eaaba7 + fe9ca9d commit 89e6167
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion handy/http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void HttpMsg::clear() {
}


string HttpMsg::map_get(map<string, string>& m, const string& n) {
string HttpMsg::getValueFromMap_(map<string, string>& m, const string& n) {
auto p = m.find(n);
return p == m.end() ? "" : p->second;
}
Expand Down
6 changes: 3 additions & 3 deletions handy/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct HttpMsg {
//body可能较大,为了避免数据复制,加入body2
Slice body2;

std::string getHeader(const std::string& n) { return map_get(headers, n); }
std::string getHeader(const std::string& n) { return getValueFromMap_(headers, n); }
Slice getBody() { return body2.size() ? body2 : (Slice)body; }

//如果tryDecode返回Complete,则返回已解析的字节数
Expand All @@ -33,14 +33,14 @@ struct HttpMsg {
size_t contentLen_;
size_t scanned_;
Result tryDecode_(Slice buf, bool copyBody, Slice* line1);
std::string map_get(std::map<std::string, std::string>& m, const std::string& n);
std::string getValueFromMap_(std::map<std::string, std::string>& m, const std::string& n);
};

struct HttpRequest: public HttpMsg {
HttpRequest() { clear(); }
std::map<std::string, std::string> args;
std::string method, uri, query_uri;
std::string getArg(const std::string& n) { return map_get(args, n); }
std::string getArg(const std::string& n) { return getValueFromMap_(args, n); }

//override
virtual int encode(Buffer& buf);
Expand Down

0 comments on commit 89e6167

Please sign in to comment.