diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 25 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs | 2 |
2 files changed, 23 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 85b19c0..cf1c753 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1025,7 +1025,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1025 | return buffer; | 1025 | return buffer; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | // JsonRpc (v2.0 only) | 1028 | // JsonRpc (v2.0 only) |
1029 | // Batch requests not yet supported | ||
1029 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) | 1030 | private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) |
1030 | { | 1031 | { |
1031 | Stream requestStream = request.InputStream; | 1032 | Stream requestStream = request.InputStream; |
@@ -1065,8 +1066,26 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1065 | { | 1066 | { |
1066 | jsonRpcHandlers.TryGetValue(methodname, out method); | 1067 | jsonRpcHandlers.TryGetValue(methodname, out method); |
1067 | } | 1068 | } |
1068 | 1069 | bool res = false; | |
1069 | method(jsonRpcRequest, ref jsonRpcResponse); | 1070 | try |
1071 | { | ||
1072 | res = method(jsonRpcRequest, ref jsonRpcResponse); | ||
1073 | if(!res) | ||
1074 | { | ||
1075 | // The handler sent back an unspecified error | ||
1076 | if(jsonRpcResponse.Error.Code == 0) | ||
1077 | { | ||
1078 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; | ||
1079 | } | ||
1080 | } | ||
1081 | } | ||
1082 | catch (Exception e) | ||
1083 | { | ||
1084 | string ErrorMessage = string.Format("[BASE HTTP SERVER]: Json-Rpc Handler Error method {0} - {1}", methodname, e.Message); | ||
1085 | m_log.Error(ErrorMessage); | ||
1086 | jsonRpcResponse.Error.Code = ErrorCode.InternalError; | ||
1087 | jsonRpcResponse.Error.Message = ErrorMessage; | ||
1088 | } | ||
1070 | } | 1089 | } |
1071 | else // Error no hanlder defined for requested method | 1090 | else // Error no hanlder defined for requested method |
1072 | { | 1091 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs index 7334049..5bab508 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRPCMethod.cs | |||
@@ -30,5 +30,5 @@ using OpenMetaverse.StructuredData; | |||
30 | 30 | ||
31 | namespace OpenSim.Framework.Servers.HttpServer | 31 | namespace OpenSim.Framework.Servers.HttpServer |
32 | { | 32 | { |
33 | public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response); | 33 | public delegate bool JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response); |
34 | } | 34 | } |