string::substr comparisons replaced by string::compare
This commit is contained in:
parent
4a97949953
commit
14d848be3e
2 changed files with 2 additions and 2 deletions
|
|
@ -95,7 +95,7 @@ namespace SimpleWeb {
|
|||
io_service.run();
|
||||
|
||||
auto response=request_read();
|
||||
if (response->status_code.empty() || response->status_code.substr(0,3) != "200") {
|
||||
if (response->status_code.empty() || response->status_code.compare(0, 3, "200") != 0) {
|
||||
std::lock_guard<std::mutex> lock(socket_mutex);
|
||||
socket=nullptr;
|
||||
throw boost::system::system_error(boost::system::error_code(boost::system::errc::permission_denied, boost::system::generic_category()));
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ namespace SimpleWeb {
|
|||
|
||||
size_t protocol_end;
|
||||
if((protocol_end=line.find('/', path_end+1))!=std::string::npos) {
|
||||
if(line.substr(path_end+1, protocol_end-path_end-1)!="HTTP")
|
||||
if(line.compare(path_end+1, protocol_end-path_end-1, "HTTP")!=0)
|
||||
return false;
|
||||
request->http_version=line.substr(protocol_end+1, line.size()-protocol_end-2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue