C and C++ web framework.
http://rapida.vilor.one/docs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
2 years ago
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||
|
/* Copyright 2022 Ivan Polyakov */
|
||
|
|
||
|
#include "Route.hxx"
|
||
|
#include <stdio.h>
|
||
|
|
||
|
using namespace rpd;
|
||
|
|
||
|
void Route::handle_request(rpd_req *req, rpd_res *res, void *userdata)
|
||
|
{
|
||
|
Route *route = static_cast<Route *>(userdata);
|
||
|
const Request reqxx = req;
|
||
|
Response resxx = res;
|
||
|
|
||
|
switch (req->method) {
|
||
|
case GET:
|
||
|
route->handle_get(reqxx, resxx);
|
||
|
break;
|
||
|
case HEAD:
|
||
|
route->handle_head(reqxx, resxx);
|
||
|
break;
|
||
|
case POST:
|
||
|
route->handle_post(req, resxx);
|
||
|
break;
|
||
|
case PUT:
|
||
|
route->handle_put(req, resxx);
|
||
|
break;
|
||
|
case PATCH:
|
||
|
route->handle_patch(req, resxx);
|
||
|
break;
|
||
|
case DELETE:
|
||
|
route->handle_delete(req, resxx);
|
||
|
break;
|
||
|
case CONNECT:
|
||
|
route->handle_connect(req, resxx);
|
||
|
break;
|
||
|
case OPTIONS:
|
||
|
route->handle_options(req, resxx);
|
||
|
break;
|
||
|
case TRACE:
|
||
|
route->handle_trace(req, resxx);
|
||
|
break;
|
||
|
case UNKNOWN:
|
||
|
break;
|
||
|
}
|
||
|
}
|