@@ -2322,7 +2322,7 @@ inline void Server::stop() {
2322
2322
}
2323
2323
2324
2324
inline 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 ) "
2326
2326
" (([^?]+)(?:\\ ?(.+?))?) (HTTP/1\\ .[01])\r\n " );
2327
2327
2328
2328
std::cmatch m;
@@ -2614,13 +2614,15 @@ inline bool Server::routing(Request &req, Response &res) {
2614
2614
return dispatch_request (req, res, post_handlers_);
2615
2615
} else if (req.method == " PUT" ) {
2616
2616
return dispatch_request (req, res, put_handlers_);
2617
- } else if (req.method == " PATCH" ) {
2618
- return dispatch_request (req, res, patch_handlers_);
2619
2617
} else if (req.method == " DELETE" ) {
2620
2618
return dispatch_request (req, res, delete_handlers_);
2621
2619
} else if (req.method == " OPTIONS" ) {
2622
2620
return dispatch_request (req, res, options_handlers_);
2621
+ } else if (req.method == " PATCH" ) {
2622
+ return dispatch_request (req, res, patch_handlers_);
2623
2623
}
2624
+
2625
+ res.status = 400 ;
2624
2626
return false ;
2625
2627
}
2626
2628
@@ -2682,7 +2684,7 @@ Server::process_request(Stream &strm, bool last_connection,
2682
2684
req.set_header (" REMOTE_ADDR" , strm.get_remote_addr ());
2683
2685
2684
2686
// 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 " ) {
2686
2688
if (!detail::read_content (strm, req, payload_max_length_, res.status ,
2687
2689
Progress (), [&](const char *buf, size_t n) {
2688
2690
if (req.body .size () + n > req.body .max_size ()) {
@@ -2720,7 +2722,7 @@ Server::process_request(Stream &strm, bool last_connection,
2720
2722
if (routing (req, res)) {
2721
2723
if (res.status == -1 ) { res.status = req.ranges .empty () ? 200 : 206 ; }
2722
2724
} else {
2723
- res.status = 404 ;
2725
+ if ( res.status == - 1 ) { res. status = 404 ; }
2724
2726
}
2725
2727
2726
2728
return write_response (strm, last_connection, req, res);
0 commit comments