Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1506 from Montellese/jsonrpc_http_get

webserver: add support for passing JSON-RPC requests through HTTP GET arguments
  • Loading branch information...
commit f6744049923e782ff4c37250de8ae7f6f1f849ff 2 parents c5848e9 + 331afa3
Sascha Montellese Montellese authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp
19 xbmc/network/httprequesthandler/HTTPJsonRpcHandler.cpp
View
@@ -39,6 +39,7 @@ bool CHTTPJsonRpcHandler::CheckHTTPRequest(const HTTPRequest &request)
int CHTTPJsonRpcHandler::HandleHTTPRequest(const HTTPRequest &request)
{
CHTTPClient client;
+ bool isRequest = false;
if (request.method == POST)
{
string contentType = CWebServer::GetRequestHeaderValue(request.connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE);
@@ -50,8 +51,24 @@ int CHTTPJsonRpcHandler::HandleHTTPRequest(const HTTPRequest &request)
return MHD_YES;
}
- m_response = CJSONRPC::MethodCall(m_request, request.webserver, &client);
+ isRequest = true;
}
+ else if (request.method == GET)
+ {
+ map<string, string> arguments;
+ if (CWebServer::GetRequestHeaderValues(request.connection, MHD_GET_ARGUMENT_KIND, arguments) > 0)
+ {
+ map<string, string>::const_iterator argument = arguments.find("request");
+ if (argument != arguments.end() && !argument->second.empty())
+ {
+ m_request = argument->second;
+ isRequest = true;
+ }
+ }
+ }
+
+ if (isRequest)
+ m_response = CJSONRPC::MethodCall(m_request, request.webserver, &client);
else
{
// get the whole output of JSONRPC.Introspect
Please sign in to comment.
Something went wrong with that request. Please try again.