diff options
Diffstat (limited to 'OpenSim/Framework')
3 files changed, 24 insertions, 1 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 27af009..df1950d 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1960,6 +1960,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1960 | m_rpcHandlers.Remove(method); | 1960 | m_rpcHandlers.Remove(method); |
1961 | } | 1961 | } |
1962 | 1962 | ||
1963 | public void RemoveJsonRPCHandler(string method) | ||
1964 | { | ||
1965 | lock(jsonRpcHandlers) | ||
1966 | jsonRpcHandlers.Remove(method); | ||
1967 | } | ||
1968 | |||
1963 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) | 1969 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) |
1964 | { | 1970 | { |
1965 | lock (m_llsdHandlers) | 1971 | lock (m_llsdHandlers) |
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index 71ca3ff..d162bc1 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | |||
@@ -140,6 +140,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
140 | void RemoveStreamHandler(string httpMethod, string path); | 140 | void RemoveStreamHandler(string httpMethod, string path); |
141 | 141 | ||
142 | void RemoveXmlRPCHandler(string method); | 142 | void RemoveXmlRPCHandler(string method); |
143 | |||
144 | void RemoveJsonRPCHandler(string method); | ||
143 | 145 | ||
144 | string GetHTTP404(string host); | 146 | string GetHTTP404(string host); |
145 | 147 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs index bb8825b..ee96b47 100644 --- a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs | |||
@@ -108,6 +108,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
108 | private int _bufferLength; | 108 | private int _bufferLength; |
109 | private bool _closing; | 109 | private bool _closing; |
110 | private bool _upgraded; | 110 | private bool _upgraded; |
111 | private int _maxPayloadBytes = 41943040; | ||
111 | 112 | ||
112 | private const string HandshakeAcceptText = | 113 | private const string HandshakeAcceptText = |
113 | "HTTP/1.1 101 Switching Protocols\r\n" + | 114 | "HTTP/1.1 101 Switching Protocols\r\n" + |
@@ -196,6 +197,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
196 | } | 197 | } |
197 | 198 | ||
198 | /// <summary> | 199 | /// <summary> |
200 | /// Max Payload Size in bytes. Defaults to 40MB, but could be set upon connection before calling handshake and upgrade. | ||
201 | /// </summary> | ||
202 | public int MaxPayloadSize | ||
203 | { | ||
204 | get { return _maxPayloadBytes; } | ||
205 | set { _maxPayloadBytes = value; } | ||
206 | } | ||
207 | |||
208 | /// <summary> | ||
199 | /// This triggers the websocket start the upgrade process | 209 | /// This triggers the websocket start the upgrade process |
200 | /// </summary> | 210 | /// </summary> |
201 | public void HandshakeAndUpgrade() | 211 | public void HandshakeAndUpgrade() |
@@ -367,7 +377,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
367 | if (headerread) | 377 | if (headerread) |
368 | { | 378 | { |
369 | _socketState.FrameComplete = false; | 379 | _socketState.FrameComplete = false; |
370 | 380 | if (pheader.PayloadLen > (ulong) _maxPayloadBytes) | |
381 | { | ||
382 | Close("Invalid Payload size"); | ||
383 | |||
384 | return; | ||
385 | } | ||
371 | if (pheader.PayloadLen > 0) | 386 | if (pheader.PayloadLen > 0) |
372 | { | 387 | { |
373 | if ((int) pheader.PayloadLen > _bufferPosition - offset) | 388 | if ((int) pheader.PayloadLen > _bufferPosition - offset) |