| 183 | } |
| 184 | |
| 185 | void process_request(http::request<request_body_t, http::basic_fields<alloc_t>> const& req) |
| 186 | { |
| 187 | switch (req.method()) |
| 188 | { |
| 189 | case http::verb::get: |
| 190 | send_file(req.target()); |
| 191 | break; |
| 192 | |
| 193 | default: |
| 194 | // We return responses indicating an error if |
| 195 | // we do not recognize the request method. |
| 196 | send_bad_response( |
| 197 | http::status::bad_request, |
| 198 | "Invalid request-method '" + std::string(req.method_string()) + "'\r\n"); |
| 199 | break; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | void send_bad_response( |
| 204 | http::status status, |