forked from boostorg/beast
Refactor method and verb (API Change):
The verb interfaces now use verb::unknown instead of boost::optional<verb> == boost::none to indicate that the request-method is an unrecognized string. The http::header interface is modified to focus more on the verb enum rather than the string. For recognized verbs, the implementation stores an integer instead of the string. Unknown verbs are still stored as strings. * header::method now returns a verb * header::method_string returns the method text
This commit is contained in:
@@ -19,7 +19,7 @@ is_upgrade(http::header<true, Fields> const& req)
|
||||
{
|
||||
if(req.version < 11)
|
||||
return false;
|
||||
if(req.method() != "GET")
|
||||
if(req.method() != http::verb::get)
|
||||
return false;
|
||||
if(! http::is_upgrade(req))
|
||||
return false;
|
||||
|
||||
@@ -225,7 +225,7 @@ build_response(http::header<true, Fields> const& req,
|
||||
};
|
||||
if(req.version < 11)
|
||||
return err("HTTP version 1.1 required");
|
||||
if(req.method() != "GET")
|
||||
if(req.method() != http::verb::get)
|
||||
return err("Wrong method");
|
||||
if(! is_upgrade(req))
|
||||
return err("Expected Upgrade request");
|
||||
|
||||
Reference in New Issue
Block a user