30#include <unordered_map>
97 wxSocketBase *socket =
nullptr;
99 long contentLength = -1;
100 std::size_t bodyStart = 0;
101 bool badRequest =
false;
104 void Start(
int port);
106 void OnServerEvent(wxSocketEvent &event);
107 void OnClientEvent(wxSocketEvent &event);
110 void PumpConnection(wxSocketBase *socket, Connection &conn);
113 bool TryParseHeaders(Connection &conn, std::string &method,
115 std::unordered_map<std::string, std::string> &headers);
116 void HandleRequest(Connection &conn,
const std::string &method,
117 const std::string &path,
118 const std::unordered_map<std::string, std::string> &headers,
119 const std::string &body);
122 std::string HandleJsonRpc(
const std::string &requestBody);
123 void SendResponse(Connection &conn,
int status,
const char *statusText,
124 const std::string &contentType,
const std::string &body);
125 void CloseConnection(wxSocketBase *socket);
129 static bool OriginAllowed(
const std::string &origin);
132 std::unique_ptr<wxSocketServer> m_server;
133 std::unordered_map<wxSocketBase *, std::unique_ptr<Connection>> m_connections;
134 int m_listeningPort = -1;
The configuration storage for the current worksheet.
Definition: Configuration.h:98
A minimal, opt-in MCP (Model Context Protocol) server exposing the current worksheet as read-only con...
Definition: McpServer.h:80
void ReconcileWithConfig(const Configuration &config)
Starts/stops listening to match the current configuration. Call this once after construction and agai...
Definition: McpServer.cpp:61
A "variables" sidepane.
Definition: VariablesPane.h:45
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:116