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:
kannibalox
2025-01-04 20:50:55 -05:00
committed by Jari Sundell
parent 78915746ee
commit 9f48226663
30 changed files with 26375 additions and 307 deletions
+6
View File
@@ -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 };
};
}