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.
33 lines
856 B
33 lines
856 B
|
9 years ago
|
#ifndef _TR_TORRENT_HPP_
|
||
|
|
#define _TR_TORRENT_HPP_
|
||
|
|
|
||
|
|
#include <http.hpp>
|
||
|
|
|
||
|
|
namespace tr {
|
||
|
|
namespace session {
|
||
|
|
namespace torrents {
|
||
|
|
namespace id {
|
||
|
|
template <class torrent_session, class request, class response>
|
||
|
|
void get(torrent_session &session, response resp, request req) {
|
||
|
|
auto http_response = http::response();
|
||
|
|
const auto respond = [&](http::status status) {
|
||
|
|
const auto response_code = http::code(status);
|
||
|
|
http_response.set_body({{"code", response_code.first}, {"status", response_code.second}});
|
||
|
|
http_response.set_status(response_code.first);
|
||
|
|
*resp << http_response;
|
||
|
|
};
|
||
|
|
|
||
|
|
if (!session.is_valid()) {
|
||
|
|
return respond(http::service_unavailable);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
template <class settings, class torrent_session, class request, class response>
|
||
|
|
void patch(settings opts, torrent_session &session, response resp, request req) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endif
|