@@ -2322,7 +2322,7 @@ inline void Server::stop() {
23222322}
23232323
23242324inline bool Server::parse_request_line (const char *s, Request &req) {
2325- static std::regex re (" (GET|HEAD|POST|PUT|PATCH| DELETE|OPTIONS) "
2325+ static std::regex re (" (GET|HEAD|POST|PUT|DELETE|CONNECT| OPTIONS|TRACE|PATCH|PRI ) "
23262326 " (([^?]+)(?:\\ ?(.+?))?) (HTTP/1\\ .[01])\r\n " );
23272327
23282328 std::cmatch m;
@@ -2614,13 +2614,15 @@ inline bool Server::routing(Request &req, Response &res) {
26142614 return dispatch_request (req, res, post_handlers_);
26152615 } else if (req.method == " PUT" ) {
26162616 return dispatch_request (req, res, put_handlers_);
2617- } else if (req.method == " PATCH" ) {
2618- return dispatch_request (req, res, patch_handlers_);
26192617 } else if (req.method == " DELETE" ) {
26202618 return dispatch_request (req, res, delete_handlers_);
26212619 } else if (req.method == " OPTIONS" ) {
26222620 return dispatch_request (req, res, options_handlers_);
2621+ } else if (req.method == " PATCH" ) {
2622+ return dispatch_request (req, res, patch_handlers_);
26232623 }
2624+
2625+ res.status = 400 ;
26242626 return false ;
26252627}
26262628
@@ -2682,7 +2684,7 @@ Server::process_request(Stream &strm, bool last_connection,
26822684 req.set_header (" REMOTE_ADDR" , strm.get_remote_addr ());
26832685
26842686 // Body
2685- if (req.method == " POST" || req.method == " PUT" || req.method == " PATCH" ) {
2687+ if (req.method == " POST" || req.method == " PUT" || req.method == " PATCH" || req. method == " PRI " ) {
26862688 if (!detail::read_content (strm, req, payload_max_length_, res.status ,
26872689 Progress (), [&](const char *buf, size_t n) {
26882690 if (req.body .size () + n > req.body .max_size ()) {
@@ -2720,7 +2722,7 @@ Server::process_request(Stream &strm, bool last_connection,
27202722 if (routing (req, res)) {
27212723 if (res.status == -1 ) { res.status = req.ranges .empty () ? 200 : 206 ; }
27222724 } else {
2723- res.status = 404 ;
2725+ if ( res.status == - 1 ) { res. status = 404 ; }
27242726 }
27252727
27262728 return write_response (strm, last_connection, req, res);
0 commit comments