Support Connection: close header
This commit is contained in:
parent
076788d417
commit
c558a03148
1 changed files with 16 additions and 16 deletions
|
|
@ -59,8 +59,8 @@ namespace SimpleWeb {
|
|||
class Request {
|
||||
friend class ServerBase<socket_type>;
|
||||
public:
|
||||
std::string method, path, protocol, http_version;
|
||||
bool con_close;
|
||||
std::string method, path, protocol, http_version;
|
||||
bool con_close;
|
||||
|
||||
Content content;
|
||||
|
||||
|
|
@ -284,17 +284,17 @@ namespace SimpleWeb {
|
|||
request->method=line.substr(0, method_end);
|
||||
request->path=line.substr(method_end+1, path_end-method_end-1);
|
||||
|
||||
request->con_close = false;
|
||||
request->protocol.clear();
|
||||
request->http_version.clear();
|
||||
request->con_close = false;
|
||||
request->protocol.clear();
|
||||
request->http_version.clear();
|
||||
|
||||
size_t proto_end;
|
||||
if((proto_end=line.find('/', path_end+1))!=std::string::npos) {
|
||||
request->protocol=line.substr(path_end+1, proto_end-path_end-1);
|
||||
request->http_version=line.substr(proto_end+1, line.size()-(proto_end)-1);
|
||||
}
|
||||
size_t proto_end;
|
||||
if((proto_end=line.find('/', path_end+1))!=std::string::npos) {
|
||||
request->protocol=line.substr(path_end+1, proto_end-path_end-1);
|
||||
request->http_version=line.substr(proto_end+1, line.size()-(proto_end)-1);
|
||||
}
|
||||
else
|
||||
request->http_version="1.0";
|
||||
request->http_version="1.0";
|
||||
|
||||
|
||||
getline(stream, line);
|
||||
|
|
@ -305,13 +305,13 @@ namespace SimpleWeb {
|
|||
if(line[value_start]==' ')
|
||||
value_start++;
|
||||
if(value_start<line.size()) {
|
||||
std::string key = line.substr(0, param_end);
|
||||
std::string value = line.substr(value_start, line.size()-value_start-1);
|
||||
std::string key = line.substr(0, param_end);
|
||||
std::string value = line.substr(value_start, line.size()-value_start-1);
|
||||
|
||||
request->header.insert(std::make_pair(key, value));
|
||||
request->header.insert(std::make_pair(key, value));
|
||||
|
||||
if(boost::iequals(key, "Connection") && boost::iequals(value, "close"))
|
||||
request->con_close = true;
|
||||
if(boost::iequals(key, "Connection") && boost::iequals(value, "close"))
|
||||
request->con_close = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue