mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 23:22:31 +00:00
Add JSON-RPC capability
Inline nlohmann/json for the JSON parsing itself, and handle requests with the same SCGI interface as XML-RPC. Based off the work in https://github.com/jesec/rtorrent
This commit is contained in:
@@ -53,6 +53,8 @@ public:
|
||||
static const int max_header_size = 2000;
|
||||
static const int max_content_size = (2 << 23);
|
||||
|
||||
enum ContentType { XML, JSON };
|
||||
|
||||
SCgiTask() { m_fileDesc = -1; }
|
||||
|
||||
bool is_open() const { return m_fileDesc != -1; }
|
||||
@@ -61,6 +63,8 @@ public:
|
||||
void open(SCgi* parent, int fd);
|
||||
void close();
|
||||
|
||||
ContentType content_type() const { return m_content_type; }
|
||||
|
||||
virtual void event_read();
|
||||
virtual void event_write();
|
||||
virtual void event_error();
|
||||
@@ -79,6 +83,8 @@ private:
|
||||
char* m_body;
|
||||
|
||||
unsigned int m_bufferSize;
|
||||
|
||||
ContentType m_content_type{ XML };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user