diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Servers/BaseHttpServer.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Servers/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 179a651..52d2a2c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -31,11 +31,10 @@ using System.Collections.Generic; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Net; | 32 | using System.Net; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Text.RegularExpressions; | ||
35 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Xml; | ||
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using System.Xml; | ||
39 | 38 | ||
40 | namespace OpenSim.Framework.Servers | 39 | namespace OpenSim.Framework.Servers |
41 | { | 40 | { |
@@ -50,7 +49,7 @@ namespace OpenSim.Framework.Servers | |||
50 | 49 | ||
51 | public int Port | 50 | public int Port |
52 | { | 51 | { |
53 | get { return m_port; } | 52 | get { return m_port; } |
54 | } | 53 | } |
55 | 54 | ||
56 | public BaseHttpServer(int port) | 55 | public BaseHttpServer(int port) |
@@ -58,11 +57,11 @@ namespace OpenSim.Framework.Servers | |||
58 | m_port = port; | 57 | m_port = port; |
59 | } | 58 | } |
60 | 59 | ||
61 | public void AddStreamHandler( IStreamHandler handler) | 60 | public void AddStreamHandler(IStreamHandler handler) |
62 | { | 61 | { |
63 | string httpMethod = handler.HttpMethod; | 62 | string httpMethod = handler.HttpMethod; |
64 | string path = handler.Path; | 63 | string path = handler.Path; |
65 | 64 | ||
66 | string handlerKey = GetHandlerKey(httpMethod, path); | 65 | string handlerKey = GetHandlerKey(httpMethod, path); |
67 | m_streamHandlers.Add(handlerKey, handler); | 66 | m_streamHandlers.Add(handlerKey, handler); |
68 | } | 67 | } |
@@ -74,9 +73,9 @@ namespace OpenSim.Framework.Servers | |||
74 | 73 | ||
75 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) | 74 | public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) |
76 | { | 75 | { |
77 | if (!this.m_rpcHandlers.ContainsKey(method)) | 76 | if (!m_rpcHandlers.ContainsKey(method)) |
78 | { | 77 | { |
79 | this.m_rpcHandlers.Add(method, handler); | 78 | m_rpcHandlers.Add(method, handler); |
80 | return true; | 79 | return true; |
81 | } | 80 | } |
82 | 81 | ||
@@ -87,7 +86,7 @@ namespace OpenSim.Framework.Servers | |||
87 | 86 | ||
88 | public virtual void HandleRequest(Object stateinfo) | 87 | public virtual void HandleRequest(Object stateinfo) |
89 | { | 88 | { |
90 | HttpListenerContext context = (HttpListenerContext)stateinfo; | 89 | HttpListenerContext context = (HttpListenerContext) stateinfo; |
91 | 90 | ||
92 | HttpListenerRequest request = context.Request; | 91 | HttpListenerRequest request = context.Request; |
93 | HttpListenerResponse response = context.Response; | 92 | HttpListenerResponse response = context.Response; |
@@ -96,11 +95,11 @@ namespace OpenSim.Framework.Servers | |||
96 | response.SendChunked = false; | 95 | response.SendChunked = false; |
97 | 96 | ||
98 | string path = request.RawUrl; | 97 | string path = request.RawUrl; |
99 | string handlerKey = GetHandlerKey( request.HttpMethod, path ); | 98 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
100 | 99 | ||
101 | IStreamHandler streamHandler; | 100 | IStreamHandler streamHandler; |
102 | 101 | ||
103 | if (TryGetStreamHandler( handlerKey, out streamHandler)) | 102 | if (TryGetStreamHandler(handlerKey, out streamHandler)) |
104 | { | 103 | { |
105 | byte[] buffer = streamHandler.Handle(path, request.InputStream); | 104 | byte[] buffer = streamHandler.Handle(path, request.InputStream); |
106 | request.InputStream.Close(); | 105 | request.InputStream.Close(); |
@@ -159,11 +158,11 @@ namespace OpenSim.Framework.Servers | |||
159 | 158 | ||
160 | try | 159 | try |
161 | { | 160 | { |
162 | xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | 161 | xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); |
163 | } | 162 | } |
164 | catch ( XmlException e ) | 163 | catch (XmlException e) |
165 | { | 164 | { |
166 | responseString = String.Format( "XmlException:\n{0}",e.Message ); | 165 | responseString = String.Format("XmlException:\n{0}", e.Message); |
167 | } | 166 | } |
168 | 167 | ||
169 | if (xmlRprcRequest != null) | 168 | if (xmlRprcRequest != null) |
@@ -173,7 +172,7 @@ namespace OpenSim.Framework.Servers | |||
173 | XmlRpcResponse xmlRpcResponse; | 172 | XmlRpcResponse xmlRpcResponse; |
174 | 173 | ||
175 | XmlRpcMethod method; | 174 | XmlRpcMethod method; |
176 | if (this.m_rpcHandlers.TryGetValue(methodName, out method)) | 175 | if (m_rpcHandlers.TryGetValue(methodName, out method)) |
177 | { | 176 | { |
178 | xmlRpcResponse = method(xmlRprcRequest); | 177 | xmlRpcResponse = method(xmlRprcRequest); |
179 | } | 178 | } |
@@ -181,7 +180,8 @@ namespace OpenSim.Framework.Servers | |||
181 | { | 180 | { |
182 | xmlRpcResponse = new XmlRpcResponse(); | 181 | xmlRpcResponse = new XmlRpcResponse(); |
183 | Hashtable unknownMethodError = new Hashtable(); | 182 | Hashtable unknownMethodError = new Hashtable(); |
184 | unknownMethodError["reason"] = "XmlRequest"; ; | 183 | unknownMethodError["reason"] = "XmlRequest"; |
184 | ; | ||
185 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; | 185 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; |
186 | unknownMethodError["login"] = "false"; | 186 | unknownMethodError["login"] = "false"; |
187 | xmlRpcResponse.Value = unknownMethodError; | 187 | xmlRpcResponse.Value = unknownMethodError; |
@@ -249,4 +249,4 @@ namespace OpenSim.Framework.Servers | |||
249 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); | 249 | m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | } | 252 | } \ No newline at end of file |