mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-05 05:39:22 +00:00
439d23ce62
Enforce the nesting bound in one parse, capping allocation by depth, not input size.
32 lines
601 B
C++
32 lines
601 B
C++
#ifndef RTORRENT_RPC_JSONRPC_H
|
|
#define RTORRENT_RPC_JSONRPC_H
|
|
|
|
#include <functional>
|
|
|
|
#include <cstdint>
|
|
|
|
#include "rpc/scgi_task.h"
|
|
|
|
namespace rpc {
|
|
|
|
class JsonRpc {
|
|
public:
|
|
using slot_write = std::function<bool(const char*, uint32_t)>;
|
|
|
|
void initialize() {};
|
|
void cleanup() {};
|
|
|
|
bool process(const char* in_buffer, uint32_t length, slot_write callback);
|
|
|
|
void insert_command(const char* name, const char* parm, const char* doc) {};
|
|
|
|
void set_size_limit(uint64_t size) { m_size_limit = size; }
|
|
|
|
private:
|
|
uint64_t m_size_limit{SCgiTask::max_content_size};
|
|
};
|
|
|
|
} // namespace rpc
|
|
|
|
#endif
|