diff options
author | Jeff Ames | 2008-08-18 00:39:10 +0000 |
---|---|---|
committer | Jeff Ames | 2008-08-18 00:39:10 +0000 |
commit | 6ef9d4da901a346c232458317cca6268da888e2e (patch) | |
tree | dd1d935b10f34f261839da9f9879c02322e8ede7 /OpenSim/Framework/Servers | |
parent | Update svn properties, minor formatting cleanup. (diff) | |
download | opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.zip opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.gz opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.bz2 opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 46 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpHandler.cs | 16 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpHttpHandler.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpRequest.cs | 22 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpRequestPump.cs | 39 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpRequestQueue.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpResponse.cs | 74 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs | 28 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestSessionService.cs | 4 |
11 files changed, 117 insertions, 140 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 952fb31..c3bd085 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -172,7 +172,7 @@ namespace OpenSim.Framework.Servers | |||
172 | OSHttpResponse response = new OSHttpResponse(context.Response); | 172 | OSHttpResponse response = new OSHttpResponse(context.Response); |
173 | 173 | ||
174 | // This is the REST agent interface. We require an agent to properly identify | 174 | // This is the REST agent interface. We require an agent to properly identify |
175 | // itself. If the REST handler recognizes the prefix it will attempt to | 175 | // itself. If the REST handler recognizes the prefix it will attempt to |
176 | // satisfy the request. If it is not recognizable, and no damage has occurred | 176 | // satisfy the request. If it is not recognizable, and no damage has occurred |
177 | // the request can be passed through to the other handlers. This is a low | 177 | // the request can be passed through to the other handlers. This is a low |
178 | // probability event; if a request is matched it is normally expected to be | 178 | // probability event; if a request is matched it is normally expected to be |
@@ -650,7 +650,7 @@ namespace OpenSim.Framework.Servers | |||
650 | } | 650 | } |
651 | 651 | ||
652 | response.AddHeader("Content-type", contentType); | 652 | response.AddHeader("Content-type", contentType); |
653 | 653 | ||
654 | byte[] buffer; | 654 | byte[] buffer; |
655 | 655 | ||
656 | if (!contentType.Contains("image")) | 656 | if (!contentType.Contains("image")) |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index e901b68..33081b9 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Servers | |||
89 | 89 | ||
90 | m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); | 90 | m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); |
91 | m_periodicDiagnosticsTimer.Enabled = true; | 91 | m_periodicDiagnosticsTimer.Enabled = true; |
92 | 92 | ||
93 | // Add ourselves to thread monitoring. This thread will go on to become the console listening thread | 93 | // Add ourselves to thread monitoring. This thread will go on to become the console listening thread |
94 | Thread.CurrentThread.Name = "ConsoleThread"; | 94 | Thread.CurrentThread.Name = "ConsoleThread"; |
95 | ThreadTracker.Add(Thread.CurrentThread); | 95 | ThreadTracker.Add(Thread.CurrentThread); |
@@ -102,15 +102,15 @@ namespace OpenSim.Framework.Servers | |||
102 | { | 102 | { |
103 | StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); | 103 | StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); |
104 | sb.Append(GetUptimeReport()); | 104 | sb.Append(GetUptimeReport()); |
105 | 105 | ||
106 | if (m_stats != null) | 106 | if (m_stats != null) |
107 | { | 107 | { |
108 | sb.Append(m_stats.Report()); | 108 | sb.Append(m_stats.Report()); |
109 | } | 109 | } |
110 | 110 | ||
111 | m_log.Debug(sb); | 111 | m_log.Debug(sb); |
112 | } | 112 | } |
113 | 113 | ||
114 | /// <summary> | 114 | /// <summary> |
115 | /// Return a report about the uptime of this server | 115 | /// Return a report about the uptime of this server |
116 | /// </summary> | 116 | /// </summary> |
@@ -120,10 +120,10 @@ namespace OpenSim.Framework.Servers | |||
120 | StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); | 120 | StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); |
121 | sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); | 121 | sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); |
122 | sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); | 122 | sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); |
123 | 123 | ||
124 | return sb.ToString(); | 124 | return sb.ToString(); |
125 | } | 125 | } |
126 | 126 | ||
127 | /// <summary> | 127 | /// <summary> |
128 | /// Set the level of log notices being echoed to the console | 128 | /// Set the level of log notices being echoed to the console |
129 | /// </summary> | 129 | /// </summary> |
@@ -133,7 +133,7 @@ namespace OpenSim.Framework.Servers | |||
133 | ILoggerRepository repository = LogManager.GetRepository(); | 133 | ILoggerRepository repository = LogManager.GetRepository(); |
134 | IAppender[] appenders = repository.GetAppenders(); | 134 | IAppender[] appenders = repository.GetAppenders(); |
135 | OpenSimAppender consoleAppender = null; | 135 | OpenSimAppender consoleAppender = null; |
136 | 136 | ||
137 | foreach (IAppender appender in appenders) | 137 | foreach (IAppender appender in appenders) |
138 | { | 138 | { |
139 | if (appender.Name == "Console") | 139 | if (appender.Name == "Console") |
@@ -142,13 +142,13 @@ namespace OpenSim.Framework.Servers | |||
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | if (null == consoleAppender) | 146 | if (null == consoleAppender) |
147 | { | 147 | { |
148 | Notice("No appender named Console found (see the log4net config file for this executable)!"); | 148 | Notice("No appender named Console found (see the log4net config file for this executable)!"); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | 151 | ||
152 | if (setParams.Length > 0) | 152 | if (setParams.Length > 0) |
153 | { | 153 | { |
154 | Level consoleLevel = repository.LevelMap[setParams[0]]; | 154 | Level consoleLevel = repository.LevelMap[setParams[0]]; |
@@ -160,12 +160,12 @@ namespace OpenSim.Framework.Servers | |||
160 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | 160 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", |
161 | setParams[0])); | 161 | setParams[0])); |
162 | } | 162 | } |
163 | 163 | ||
164 | // If there is no threshold set then the threshold is effectively everything. | 164 | // If there is no threshold set then the threshold is effectively everything. |
165 | Level thresholdLevel | 165 | Level thresholdLevel |
166 | = (null != consoleAppender.Threshold ? consoleAppender.Threshold : log4net.Core.Level.All); | 166 | = (null != consoleAppender.Threshold ? consoleAppender.Threshold : log4net.Core.Level.All); |
167 | 167 | ||
168 | Notice(String.Format("Console log level is {0}", thresholdLevel)); | 168 | Notice(String.Format("Console log level is {0}", thresholdLevel)); |
169 | } | 169 | } |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
@@ -203,7 +203,7 @@ namespace OpenSim.Framework.Servers | |||
203 | Notice(""); | 203 | Notice(""); |
204 | Notice("quit - equivalent to shutdown."); | 204 | Notice("quit - equivalent to shutdown."); |
205 | 205 | ||
206 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); | 206 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); |
207 | Notice("show info - show server information (e.g. startup path)."); | 207 | Notice("show info - show server information (e.g. startup path)."); |
208 | 208 | ||
209 | if (m_stats != null) | 209 | if (m_stats != null) |
@@ -219,7 +219,7 @@ namespace OpenSim.Framework.Servers | |||
219 | case "set": | 219 | case "set": |
220 | Set(cmdparams); | 220 | Set(cmdparams); |
221 | break; | 221 | break; |
222 | 222 | ||
223 | case "show": | 223 | case "show": |
224 | if (cmdparams.Length > 0) | 224 | if (cmdparams.Length > 0) |
225 | { | 225 | { |
@@ -232,8 +232,8 @@ namespace OpenSim.Framework.Servers | |||
232 | Shutdown(); | 232 | Shutdown(); |
233 | break; | 233 | break; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | /// <summary> | 237 | /// <summary> |
238 | /// Set an OpenSim parameter | 238 | /// Set an OpenSim parameter |
239 | /// </summary> | 239 | /// </summary> |
@@ -245,15 +245,15 @@ namespace OpenSim.Framework.Servers | |||
245 | // Temporary while we only have one command which takes at least two parameters | 245 | // Temporary while we only have one command which takes at least two parameters |
246 | if (setArgs.Length < 2) | 246 | if (setArgs.Length < 2) |
247 | return; | 247 | return; |
248 | 248 | ||
249 | if (setArgs[0] == "log" && setArgs[1] == "level") | 249 | if (setArgs[0] == "log" && setArgs[1] == "level") |
250 | { | 250 | { |
251 | string[] setParams = new string[setArgs.Length - 2]; | 251 | string[] setParams = new string[setArgs.Length - 2]; |
252 | Array.Copy(setArgs, 2, setParams, 0, setArgs.Length - 2); | 252 | Array.Copy(setArgs, 2, setParams, 0, setArgs.Length - 2); |
253 | 253 | ||
254 | SetConsoleLogLevel(setParams); | 254 | SetConsoleLogLevel(setParams); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | /// <summary> | 258 | /// <summary> |
259 | /// Outputs to the console information about the region | 259 | /// Outputs to the console information about the region |
@@ -276,7 +276,7 @@ namespace OpenSim.Framework.Servers | |||
276 | Notice(m_stats.Report()); | 276 | Notice(m_stats.Report()); |
277 | } | 277 | } |
278 | break; | 278 | break; |
279 | 279 | ||
280 | case "threads": | 280 | case "threads": |
281 | List<Thread> threads = ThreadTracker.GetThreads(); | 281 | List<Thread> threads = ThreadTracker.GetThreads(); |
282 | if (threads == null) | 282 | if (threads == null) |
@@ -291,7 +291,7 @@ namespace OpenSim.Framework.Servers | |||
291 | Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); | 291 | Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | break; | 294 | break; |
295 | 295 | ||
296 | case "uptime": | 296 | case "uptime": |
297 | Notice(GetUptimeReport()); | 297 | Notice(GetUptimeReport()); |
@@ -301,7 +301,7 @@ namespace OpenSim.Framework.Servers | |||
301 | Notice("Version: " + m_version); | 301 | Notice("Version: " + m_version); |
302 | break; | 302 | break; |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | /// <summary> | 306 | /// <summary> |
307 | /// Console output is only possible if a console has been established. | 307 | /// Console output is only possible if a console has been established. |
diff --git a/OpenSim/Framework/Servers/OSHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHandler.cs index 66fff3e..838f29a 100644 --- a/OpenSim/Framework/Servers/OSHttpHandler.cs +++ b/OpenSim/Framework/Servers/OSHttpHandler.cs | |||
@@ -72,21 +72,21 @@ namespace OpenSim.Framework.Servers | |||
72 | /// Regular expression used to match against method of | 72 | /// Regular expression used to match against method of |
73 | /// the incoming HTTP request. If you want to match any string | 73 | /// the incoming HTTP request. If you want to match any string |
74 | /// either use '.*' or null. To match on the empty string use | 74 | /// either use '.*' or null. To match on the empty string use |
75 | /// '^$'. | 75 | /// '^$'. |
76 | /// </summary> | 76 | /// </summary> |
77 | public virtual Regex Method | 77 | public virtual Regex Method |
78 | { | 78 | { |
79 | get { return _method; } | 79 | get { return _method; } |
80 | } | 80 | } |
81 | protected Regex _method; | 81 | protected Regex _method; |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Regular expression used to match against path of the | 84 | /// Regular expression used to match against path of the |
85 | /// incoming HTTP request. If you want to match any string | 85 | /// incoming HTTP request. If you want to match any string |
86 | /// either use '.*' or null. To match on the emtpy string use | 86 | /// either use '.*' or null. To match on the emtpy string use |
87 | /// '^$'. | 87 | /// '^$'. |
88 | /// </summary> | 88 | /// </summary> |
89 | public virtual Regex Path | 89 | public virtual Regex Path |
90 | { | 90 | { |
91 | get { return _path; } | 91 | get { return _path; } |
92 | } | 92 | } |
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Servers | |||
97 | /// allowing us to match on URI query fields. | 97 | /// allowing us to match on URI query fields. |
98 | /// </summary> | 98 | /// </summary> |
99 | public virtual Dictionary<string, Regex> Query | 99 | public virtual Dictionary<string, Regex> Query |
100 | { | 100 | { |
101 | get { return _query; } | 101 | get { return _query; } |
102 | } | 102 | } |
103 | protected Dictionary<string, Regex> _query; | 103 | protected Dictionary<string, Regex> _query; |
@@ -107,7 +107,7 @@ namespace OpenSim.Framework.Servers | |||
107 | /// allowing us to match on HTTP header fields. | 107 | /// allowing us to match on HTTP header fields. |
108 | /// </summary> | 108 | /// </summary> |
109 | public virtual Dictionary<string, Regex> Headers | 109 | public virtual Dictionary<string, Regex> Headers |
110 | { | 110 | { |
111 | get { return _headers; } | 111 | get { return _headers; } |
112 | } | 112 | } |
113 | protected Dictionary<string, Regex> _headers; | 113 | protected Dictionary<string, Regex> _headers; |
@@ -137,7 +137,7 @@ namespace OpenSim.Framework.Servers | |||
137 | /// <param name="contentType">null or content type | 137 | /// <param name="contentType">null or content type |
138 | /// regex</param> | 138 | /// regex</param> |
139 | /// <param name="whitelist">null or IP address regex</param> | 139 | /// <param name="whitelist">null or IP address regex</param> |
140 | public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query, | 140 | public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query, |
141 | Dictionary<string, Regex> headers, Regex contentType, Regex whitelist) | 141 | Dictionary<string, Regex> headers, Regex contentType, Regex whitelist) |
142 | { | 142 | { |
143 | _method = method; | 143 | _method = method; |
@@ -155,7 +155,7 @@ namespace OpenSim.Framework.Servers | |||
155 | 155 | ||
156 | /// <summary> | 156 | /// <summary> |
157 | /// Process an incoming OSHttpRequest that matched our | 157 | /// Process an incoming OSHttpRequest that matched our |
158 | /// requirements. | 158 | /// requirements. |
159 | /// </summary> | 159 | /// </summary> |
160 | /// <returns> | 160 | /// <returns> |
161 | /// OSHttpHandlerResult.Pass if we are after all not | 161 | /// OSHttpHandlerResult.Pass if we are after all not |
@@ -180,4 +180,4 @@ namespace OpenSim.Framework.Servers | |||
180 | return sw.ToString(); | 180 | return sw.ToString(); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } \ No newline at end of file | 183 | } |
diff --git a/OpenSim/Framework/Servers/OSHttpHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHttpHandler.cs index 66120c3..e08df85 100644 --- a/OpenSim/Framework/Servers/OSHttpHttpHandler.cs +++ b/OpenSim/Framework/Servers/OSHttpHttpHandler.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.Servers | |||
58 | /// <param name="headers">null or dictionary with header | 58 | /// <param name="headers">null or dictionary with header |
59 | /// regexs</param> | 59 | /// regexs</param> |
60 | /// <param name="whitelist">null or IP address whitelist</param> | 60 | /// <param name="whitelist">null or IP address whitelist</param> |
61 | public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path, | 61 | public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path, |
62 | Dictionary<string, Regex> query, | 62 | Dictionary<string, Regex> query, |
63 | Dictionary<string, Regex> headers, Regex whitelist) | 63 | Dictionary<string, Regex> headers, Regex whitelist) |
64 | : base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled), | 64 | : base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled), |
@@ -71,7 +71,7 @@ namespace OpenSim.Framework.Servers | |||
71 | /// Instantiate an HTTP handler. | 71 | /// Instantiate an HTTP handler. |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="handler">a GenericHTTPMethod</param> | 73 | /// <param name="handler">a GenericHTTPMethod</param> |
74 | public OSHttpHttpHandler(GenericHTTPMethod handler) | 74 | public OSHttpHttpHandler(GenericHTTPMethod handler) |
75 | : this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null) | 75 | : this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null) |
76 | { | 76 | { |
77 | } | 77 | } |
@@ -79,7 +79,7 @@ namespace OpenSim.Framework.Servers | |||
79 | /// <summary> | 79 | /// <summary> |
80 | /// Invoked by OSHttpRequestPump. | 80 | /// Invoked by OSHttpRequestPump. |
81 | /// </summary> | 81 | /// </summary> |
82 | public override OSHttpHandlerResult Process(OSHttpRequest request) | 82 | public override OSHttpHandlerResult Process(OSHttpRequest request) |
83 | { | 83 | { |
84 | // call handler method | 84 | // call handler method |
85 | Hashtable responseData = _handler(request.Query); | 85 | Hashtable responseData = _handler(request.Query); |
@@ -110,7 +110,7 @@ namespace OpenSim.Framework.Servers | |||
110 | } | 110 | } |
111 | 111 | ||
112 | response.AddHeader("Content-type", contentType); | 112 | response.AddHeader("Content-type", contentType); |
113 | 113 | ||
114 | byte[] buffer; | 114 | byte[] buffer; |
115 | 115 | ||
116 | if (!contentType.Contains("image")) | 116 | if (!contentType.Contains("image")) |
@@ -142,4 +142,4 @@ namespace OpenSim.Framework.Servers | |||
142 | return OSHttpHandlerResult.Done; | 142 | return OSHttpHandlerResult.Done; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } \ No newline at end of file | 145 | } |
diff --git a/OpenSim/Framework/Servers/OSHttpRequest.cs b/OpenSim/Framework/Servers/OSHttpRequest.cs index 0a82a04..01e71c8 100644 --- a/OpenSim/Framework/Servers/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/OSHttpRequest.cs | |||
@@ -38,42 +38,35 @@ namespace OpenSim.Framework.Servers | |||
38 | { | 38 | { |
39 | public class OSHttpRequest | 39 | public class OSHttpRequest |
40 | { | 40 | { |
41 | |||
42 | |||
43 | public string[] AcceptTypes | 41 | public string[] AcceptTypes |
44 | { | 42 | { |
45 | get { return _acceptTypes; } | 43 | get { return _acceptTypes; } |
46 | } | 44 | } |
47 | private string[] _acceptTypes; | 45 | private string[] _acceptTypes; |
48 | 46 | ||
49 | |||
50 | public Encoding ContentEncoding | 47 | public Encoding ContentEncoding |
51 | { | 48 | { |
52 | get { return _contentEncoding; } | 49 | get { return _contentEncoding; } |
53 | } | 50 | } |
54 | private Encoding _contentEncoding; | 51 | private Encoding _contentEncoding; |
55 | 52 | ||
56 | |||
57 | public long ContentLength | 53 | public long ContentLength |
58 | { | 54 | { |
59 | get { return _contentLength64; } | 55 | get { return _contentLength64; } |
60 | } | 56 | } |
61 | private long _contentLength64; | 57 | private long _contentLength64; |
62 | 58 | ||
63 | |||
64 | public long ContentLength64 | 59 | public long ContentLength64 |
65 | { | 60 | { |
66 | get { return ContentLength; } | 61 | get { return ContentLength; } |
67 | } | 62 | } |
68 | 63 | ||
69 | |||
70 | public string ContentType | 64 | public string ContentType |
71 | { | 65 | { |
72 | get { return _contentType; } | 66 | get { return _contentType; } |
73 | } | 67 | } |
74 | private string _contentType; | 68 | private string _contentType; |
75 | 69 | ||
76 | |||
77 | // public CookieCollection Cookies | 70 | // public CookieCollection Cookies |
78 | // { | 71 | // { |
79 | // get { return _cookies; } | 72 | // get { return _cookies; } |
@@ -92,63 +85,54 @@ namespace OpenSim.Framework.Servers | |||
92 | } | 85 | } |
93 | private string _httpMethod; | 86 | private string _httpMethod; |
94 | 87 | ||
95 | |||
96 | public Stream InputStream | 88 | public Stream InputStream |
97 | { | 89 | { |
98 | get { return _inputStream; } | 90 | get { return _inputStream; } |
99 | } | 91 | } |
100 | private Stream _inputStream; | 92 | private Stream _inputStream; |
101 | 93 | ||
102 | |||
103 | // public bool IsSecureConnection | 94 | // public bool IsSecureConnection |
104 | // { | 95 | // { |
105 | // get { return _isSecureConnection; } | 96 | // get { return _isSecureConnection; } |
106 | // } | 97 | // } |
107 | // private bool _isSecureConnection; | 98 | // private bool _isSecureConnection; |
108 | 99 | ||
109 | |||
110 | // public bool IsAuthenticated | 100 | // public bool IsAuthenticated |
111 | // { | 101 | // { |
112 | // get { return _isAuthenticated; } | 102 | // get { return _isAuthenticated; } |
113 | // } | 103 | // } |
114 | // private bool _isAuthenticated; | 104 | // private bool _isAuthenticated; |
115 | 105 | ||
116 | |||
117 | public bool HasEntityBody | 106 | public bool HasEntityBody |
118 | { | 107 | { |
119 | get { return _hasbody; } | 108 | get { return _hasbody; } |
120 | } | 109 | } |
121 | private bool _hasbody; | 110 | private bool _hasbody; |
122 | 111 | ||
123 | |||
124 | public bool KeepAlive | 112 | public bool KeepAlive |
125 | { | 113 | { |
126 | get { return _keepAlive; } | 114 | get { return _keepAlive; } |
127 | } | 115 | } |
128 | private bool _keepAlive; | 116 | private bool _keepAlive; |
129 | 117 | ||
130 | |||
131 | public string RawUrl | 118 | public string RawUrl |
132 | { | 119 | { |
133 | get { return _rawUrl; } | 120 | get { return _rawUrl; } |
134 | } | 121 | } |
135 | private string _rawUrl; | 122 | private string _rawUrl; |
136 | 123 | ||
137 | |||
138 | public Uri Url | 124 | public Uri Url |
139 | { | 125 | { |
140 | get { return _url; } | 126 | get { return _url; } |
141 | } | 127 | } |
142 | private Uri _url; | 128 | private Uri _url; |
143 | 129 | ||
144 | |||
145 | public string UserAgent | 130 | public string UserAgent |
146 | { | 131 | { |
147 | get { return _userAgent; } | 132 | get { return _userAgent; } |
148 | } | 133 | } |
149 | private string _userAgent; | 134 | private string _userAgent; |
150 | 135 | ||
151 | |||
152 | public NameValueCollection QueryString | 136 | public NameValueCollection QueryString |
153 | { | 137 | { |
154 | get { return _queryString; } | 138 | get { return _queryString; } |
@@ -161,28 +145,24 @@ namespace OpenSim.Framework.Servers | |||
161 | } | 145 | } |
162 | private Hashtable _query; | 146 | private Hashtable _query; |
163 | 147 | ||
164 | |||
165 | public IPEndPoint RemoteIPEndPoint | 148 | public IPEndPoint RemoteIPEndPoint |
166 | { | 149 | { |
167 | get { return _ipEndPoint; } | 150 | get { return _ipEndPoint; } |
168 | } | 151 | } |
169 | private IPEndPoint _ipEndPoint; | 152 | private IPEndPoint _ipEndPoint; |
170 | 153 | ||
171 | |||
172 | internal HttpRequest HttpRequest | 154 | internal HttpRequest HttpRequest |
173 | { | 155 | { |
174 | get { return _request; } | 156 | get { return _request; } |
175 | } | 157 | } |
176 | private HttpRequest _request; | 158 | private HttpRequest _request; |
177 | 159 | ||
178 | |||
179 | internal HttpClientContext HttpClientContext | 160 | internal HttpClientContext HttpClientContext |
180 | { | 161 | { |
181 | get { return _context; } | 162 | get { return _context; } |
182 | } | 163 | } |
183 | private HttpClientContext _context; | 164 | private HttpClientContext _context; |
184 | 165 | ||
185 | |||
186 | /// <summary> | 166 | /// <summary> |
187 | /// Internal whiteboard for handlers to store temporary stuff | 167 | /// Internal whiteboard for handlers to store temporary stuff |
188 | /// into. | 168 | /// into. |
@@ -193,12 +173,10 @@ namespace OpenSim.Framework.Servers | |||
193 | } | 173 | } |
194 | private Dictionary<string, object> _whiteboard = new Dictionary<string, object>(); | 174 | private Dictionary<string, object> _whiteboard = new Dictionary<string, object>(); |
195 | 175 | ||
196 | |||
197 | public OSHttpRequest() | 176 | public OSHttpRequest() |
198 | { | 177 | { |
199 | } | 178 | } |
200 | 179 | ||
201 | |||
202 | public OSHttpRequest(HttpListenerRequest req) | 180 | public OSHttpRequest(HttpListenerRequest req) |
203 | { | 181 | { |
204 | _acceptTypes = req.AcceptTypes; | 182 | _acceptTypes = req.AcceptTypes; |
diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs index 8d4dc0d..b4270b3 100644 --- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs +++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs | |||
@@ -39,7 +39,6 @@ using System.Threading; | |||
39 | using log4net; | 39 | using log4net; |
40 | using HttpServer; | 40 | using HttpServer; |
41 | 41 | ||
42 | |||
43 | namespace OpenSim.Framework.Servers | 42 | namespace OpenSim.Framework.Servers |
44 | { | 43 | { |
45 | /// <summary> | 44 | /// <summary> |
@@ -58,13 +57,12 @@ namespace OpenSim.Framework.Servers | |||
58 | protected Thread _engine; | 57 | protected Thread _engine; |
59 | 58 | ||
60 | private int _id; | 59 | private int _id; |
61 | 60 | ||
62 | public string EngineID | 61 | public string EngineID |
63 | { | 62 | { |
64 | get { return String.Format("{0} pump {1}", _server.EngineID, _id); } | 63 | get { return String.Format("{0} pump {1}", _server.EngineID, _id); } |
65 | } | 64 | } |
66 | 65 | ||
67 | |||
68 | public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id) | 66 | public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id) |
69 | { | 67 | { |
70 | _server = server; | 68 | _server = server; |
@@ -77,7 +75,6 @@ namespace OpenSim.Framework.Servers | |||
77 | _engine.Start(); | 75 | _engine.Start(); |
78 | 76 | ||
79 | ThreadTracker.Add(_engine); | 77 | ThreadTracker.Add(_engine); |
80 | |||
81 | } | 78 | } |
82 | 79 | ||
83 | public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize) | 80 | public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize) |
@@ -104,21 +101,22 @@ namespace OpenSim.Framework.Servers | |||
104 | public void Engine() | 101 | public void Engine() |
105 | { | 102 | { |
106 | OSHttpRequest req = null; | 103 | OSHttpRequest req = null; |
107 | 104 | ||
108 | while (true) | 105 | while (true) |
109 | { | 106 | { |
110 | try { | 107 | try |
108 | { | ||
111 | // dequeue an OSHttpRequest from OSHttpServer's | 109 | // dequeue an OSHttpRequest from OSHttpServer's |
112 | // request queue | 110 | // request queue |
113 | req = _queue.Dequeue(); | 111 | req = _queue.Dequeue(); |
114 | 112 | ||
115 | // get a copy of the list of registered handlers | 113 | // get a copy of the list of registered handlers |
116 | List<OSHttpHandler> handlers = _server.OSHttpHandlers; | 114 | List<OSHttpHandler> handlers = _server.OSHttpHandlers; |
117 | 115 | ||
118 | // prune list and have it sorted from most | 116 | // prune list and have it sorted from most |
119 | // specific to least specific | 117 | // specific to least specific |
120 | handlers = MatchHandlers(req, handlers); | 118 | handlers = MatchHandlers(req, handlers); |
121 | 119 | ||
122 | // process req: we try each handler in turn until | 120 | // process req: we try each handler in turn until |
123 | // we are either out of handlers or get back a | 121 | // we are either out of handlers or get back a |
124 | // Pass or Done | 122 | // Pass or Done |
@@ -126,18 +124,18 @@ namespace OpenSim.Framework.Servers | |||
126 | foreach (OSHttpHandler h in handlers) | 124 | foreach (OSHttpHandler h in handlers) |
127 | { | 125 | { |
128 | rc = h.Process(req); | 126 | rc = h.Process(req); |
129 | 127 | ||
130 | // Pass: handler did not process the request, | 128 | // Pass: handler did not process the request, |
131 | // try next handler | 129 | // try next handler |
132 | if (OSHttpHandlerResult.Pass == rc) continue; | 130 | if (OSHttpHandlerResult.Pass == rc) continue; |
133 | 131 | ||
134 | // Handled: handler has processed the request | 132 | // Handled: handler has processed the request |
135 | if (OSHttpHandlerResult.Done == rc) break; | 133 | if (OSHttpHandlerResult.Done == rc) break; |
136 | 134 | ||
137 | // hmm, something went wrong | 135 | // hmm, something went wrong |
138 | throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); | 136 | throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); |
139 | } | 137 | } |
140 | 138 | ||
141 | if (OSHttpHandlerResult.Unprocessed == rc) | 139 | if (OSHttpHandlerResult.Unprocessed == rc) |
142 | { | 140 | { |
143 | _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req); | 141 | _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req); |
@@ -190,7 +188,7 @@ namespace OpenSim.Framework.Servers | |||
190 | if (null != remote) | 188 | if (null != remote) |
191 | { | 189 | { |
192 | Match epm = h.IPEndPointWhitelist.Match(remote.ToString()); | 190 | Match epm = h.IPEndPointWhitelist.Match(remote.ToString()); |
193 | if (!epm.Success) | 191 | if (!epm.Success) |
194 | { | 192 | { |
195 | scoredHandlers.Remove(h); | 193 | scoredHandlers.Remove(h); |
196 | continue; | 194 | continue; |
@@ -201,7 +199,7 @@ namespace OpenSim.Framework.Servers | |||
201 | if (null != h.Method) | 199 | if (null != h.Method) |
202 | { | 200 | { |
203 | Match m = h.Method.Match(req.HttpMethod); | 201 | Match m = h.Method.Match(req.HttpMethod); |
204 | if (!m.Success) | 202 | if (!m.Success) |
205 | { | 203 | { |
206 | scoredHandlers.Remove(h); | 204 | scoredHandlers.Remove(h); |
207 | continue; | 205 | continue; |
@@ -213,7 +211,7 @@ namespace OpenSim.Framework.Servers | |||
213 | if (null != h.Path) | 211 | if (null != h.Path) |
214 | { | 212 | { |
215 | Match m = h.Path.Match(req.RawUrl); | 213 | Match m = h.Path.Match(req.RawUrl); |
216 | if (!m.Success) | 214 | if (!m.Success) |
217 | { | 215 | { |
218 | scoredHandlers.Remove(h); | 216 | scoredHandlers.Remove(h); |
219 | continue; | 217 | continue; |
@@ -272,14 +270,15 @@ namespace OpenSim.Framework.Servers | |||
272 | { | 270 | { |
273 | return 0; | 271 | return 0; |
274 | } | 272 | } |
275 | 273 | ||
276 | // does the content of collection[tag] match | 274 | // does the content of collection[tag] match |
277 | // the supplied regex? | 275 | // the supplied regex? |
278 | Match cm = regexs[tag].Match(collection[tag]); | 276 | Match cm = regexs[tag].Match(collection[tag]); |
279 | if (!cm.Success) { | 277 | if (!cm.Success) |
278 | { | ||
280 | return 0; | 279 | return 0; |
281 | } | 280 | } |
282 | 281 | ||
283 | // ok: matches | 282 | // ok: matches |
284 | matched++; | 283 | matched++; |
285 | continue; | 284 | continue; |
@@ -288,7 +287,7 @@ namespace OpenSim.Framework.Servers | |||
288 | return matched; | 287 | return matched; |
289 | } | 288 | } |
290 | 289 | ||
291 | [ConditionalAttribute("DEBUGGING")] | 290 | [ConditionalAttribute("DEBUGGING")] |
292 | private void LogDumpHandlerList(List<OSHttpHandler> l) | 291 | private void LogDumpHandlerList(List<OSHttpHandler> l) |
293 | { | 292 | { |
294 | _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID); | 293 | _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID); |
diff --git a/OpenSim/Framework/Servers/OSHttpRequestQueue.cs b/OpenSim/Framework/Servers/OSHttpRequestQueue.cs index f6f1829..94f7b32 100644 --- a/OpenSim/Framework/Servers/OSHttpRequestQueue.cs +++ b/OpenSim/Framework/Servers/OSHttpRequestQueue.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Framework.Servers | |||
40 | { | 40 | { |
41 | private object _syncObject = new object(); | 41 | private object _syncObject = new object(); |
42 | 42 | ||
43 | new public void Enqueue(OSHttpRequest req) | 43 | new public void Enqueue(OSHttpRequest req) |
44 | { | 44 | { |
45 | lock (_syncObject) | 45 | lock (_syncObject) |
46 | { | 46 | { |
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers | |||
48 | Monitor.Pulse(_syncObject); | 48 | Monitor.Pulse(_syncObject); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | new public OSHttpRequest Dequeue() | 52 | new public OSHttpRequest Dequeue() |
53 | { | 53 | { |
54 | OSHttpRequest req = null; | 54 | OSHttpRequest req = null; |
@@ -65,4 +65,4 @@ namespace OpenSim.Framework.Servers | |||
65 | return req; | 65 | return req; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | } \ No newline at end of file | 68 | } |
diff --git a/OpenSim/Framework/Servers/OSHttpResponse.cs b/OpenSim/Framework/Servers/OSHttpResponse.cs index eb7e400..21d1e2b 100644 --- a/OpenSim/Framework/Servers/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/OSHttpResponse.cs | |||
@@ -56,15 +56,15 @@ namespace OpenSim.Framework.Servers | |||
56 | /// </summary> | 56 | /// </summary> |
57 | /// <remarks> | 57 | /// <remarks> |
58 | /// Setting this property will also set IsContentTypeSet to | 58 | /// Setting this property will also set IsContentTypeSet to |
59 | /// true. | 59 | /// true. |
60 | /// </remarks> | 60 | /// </remarks> |
61 | public string ContentType | 61 | public string ContentType |
62 | { | 62 | { |
63 | get | 63 | get |
64 | { | 64 | { |
65 | if (HttpServer) | 65 | if (HttpServer) |
66 | return _httpResponse.ContentType; | 66 | return _httpResponse.ContentType; |
67 | else | 67 | else |
68 | return _httpListenerResponse.ContentType; | 68 | return _httpListenerResponse.ContentType; |
69 | } | 69 | } |
70 | set | 70 | set |
@@ -100,11 +100,11 @@ namespace OpenSim.Framework.Servers | |||
100 | /// </summary> | 100 | /// </summary> |
101 | public long ContentLength | 101 | public long ContentLength |
102 | { | 102 | { |
103 | get | 103 | get |
104 | { | 104 | { |
105 | if (HttpServer) | 105 | if (HttpServer) |
106 | return _httpResponse.ContentLength; | 106 | return _httpResponse.ContentLength; |
107 | else | 107 | else |
108 | return _httpListenerResponse.ContentLength64; | 108 | return _httpListenerResponse.ContentLength64; |
109 | } | 109 | } |
110 | set | 110 | set |
@@ -130,11 +130,11 @@ namespace OpenSim.Framework.Servers | |||
130 | /// </summary> | 130 | /// </summary> |
131 | public Encoding ContentEncoding | 131 | public Encoding ContentEncoding |
132 | { | 132 | { |
133 | get | 133 | get |
134 | { | 134 | { |
135 | if (HttpServer) | 135 | if (HttpServer) |
136 | return _httpResponse.Encoding; | 136 | return _httpResponse.Encoding; |
137 | else | 137 | else |
138 | return _httpListenerResponse.ContentEncoding; | 138 | return _httpListenerResponse.ContentEncoding; |
139 | } | 139 | } |
140 | 140 | ||
@@ -142,7 +142,7 @@ namespace OpenSim.Framework.Servers | |||
142 | { | 142 | { |
143 | if (HttpServer) | 143 | if (HttpServer) |
144 | _httpResponse.Encoding = value; | 144 | _httpResponse.Encoding = value; |
145 | else | 145 | else |
146 | _httpListenerResponse.ContentEncoding = value; | 146 | _httpListenerResponse.ContentEncoding = value; |
147 | } | 147 | } |
148 | } | 148 | } |
@@ -152,8 +152,8 @@ namespace OpenSim.Framework.Servers | |||
152 | /// </summary> | 152 | /// </summary> |
153 | public WebHeaderCollection Headers | 153 | public WebHeaderCollection Headers |
154 | { | 154 | { |
155 | get | 155 | get |
156 | { | 156 | { |
157 | if (HttpServer) | 157 | if (HttpServer) |
158 | return null; | 158 | return null; |
159 | else | 159 | else |
@@ -166,10 +166,10 @@ namespace OpenSim.Framework.Servers | |||
166 | /// </summary> | 166 | /// </summary> |
167 | public bool KeepAlive | 167 | public bool KeepAlive |
168 | { | 168 | { |
169 | get | 169 | get |
170 | { | 170 | { |
171 | if (HttpServer) | 171 | if (HttpServer) |
172 | return _httpResponse.Connection == ConnectionType.KeepAlive; | 172 | return _httpResponse.Connection == ConnectionType.KeepAlive; |
173 | else | 173 | else |
174 | return _httpListenerResponse.KeepAlive; | 174 | return _httpListenerResponse.KeepAlive; |
175 | } | 175 | } |
@@ -178,7 +178,7 @@ namespace OpenSim.Framework.Servers | |||
178 | { | 178 | { |
179 | if (HttpServer) | 179 | if (HttpServer) |
180 | _httpResponse.Connection = ConnectionType.KeepAlive; | 180 | _httpResponse.Connection = ConnectionType.KeepAlive; |
181 | else | 181 | else |
182 | _httpListenerResponse.KeepAlive = value; | 182 | _httpListenerResponse.KeepAlive = value; |
183 | } | 183 | } |
184 | } | 184 | } |
@@ -191,8 +191,8 @@ namespace OpenSim.Framework.Servers | |||
191 | /// </remarks> | 191 | /// </remarks> |
192 | public Stream OutputStream | 192 | public Stream OutputStream |
193 | { | 193 | { |
194 | get | 194 | get |
195 | { | 195 | { |
196 | if (HttpServer) | 196 | if (HttpServer) |
197 | return _httpResponse.Body; | 197 | return _httpResponse.Body; |
198 | else | 198 | else |
@@ -205,10 +205,10 @@ namespace OpenSim.Framework.Servers | |||
205 | /// </summary> | 205 | /// </summary> |
206 | public Stream Body | 206 | public Stream Body |
207 | { | 207 | { |
208 | get | 208 | get |
209 | { | 209 | { |
210 | if (HttpServer) | 210 | if (HttpServer) |
211 | return _httpResponse.Body; | 211 | return _httpResponse.Body; |
212 | throw new Exception("[OSHttpResponse] mixed .NET and HttpServer access"); | 212 | throw new Exception("[OSHttpResponse] mixed .NET and HttpServer access"); |
213 | } | 213 | } |
214 | } | 214 | } |
@@ -228,18 +228,18 @@ namespace OpenSim.Framework.Servers | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | /// <summary> | 232 | /// <summary> |
233 | /// Chunk transfers. | 233 | /// Chunk transfers. |
234 | /// </summary> | 234 | /// </summary> |
235 | public bool SendChunked | 235 | public bool SendChunked |
236 | { | 236 | { |
237 | get | 237 | get |
238 | { | 238 | { |
239 | if (HttpServer) | 239 | if (HttpServer) |
240 | return _httpResponse.Chunked; | 240 | return _httpResponse.Chunked; |
241 | else | 241 | else |
242 | return _httpListenerResponse.SendChunked; | 242 | return _httpListenerResponse.SendChunked; |
243 | } | 243 | } |
244 | 244 | ||
245 | set | 245 | set |
@@ -256,12 +256,12 @@ namespace OpenSim.Framework.Servers | |||
256 | /// </summary> | 256 | /// </summary> |
257 | public int StatusCode | 257 | public int StatusCode |
258 | { | 258 | { |
259 | get | 259 | get |
260 | { | 260 | { |
261 | if (HttpServer) | 261 | if (HttpServer) |
262 | return (int)_httpResponse.Status; | 262 | return (int)_httpResponse.Status; |
263 | else | 263 | else |
264 | return _httpListenerResponse.StatusCode; | 264 | return _httpListenerResponse.StatusCode; |
265 | } | 265 | } |
266 | 266 | ||
267 | set | 267 | set |
@@ -279,12 +279,12 @@ namespace OpenSim.Framework.Servers | |||
279 | /// </summary> | 279 | /// </summary> |
280 | public string StatusDescription | 280 | public string StatusDescription |
281 | { | 281 | { |
282 | get | 282 | get |
283 | { | 283 | { |
284 | if (HttpServer) | 284 | if (HttpServer) |
285 | return _httpResponse.Reason; | 285 | return _httpResponse.Reason; |
286 | else | 286 | else |
287 | return _httpListenerResponse.StatusDescription; | 287 | return _httpListenerResponse.StatusDescription; |
288 | } | 288 | } |
289 | 289 | ||
290 | set | 290 | set |
@@ -331,7 +331,7 @@ namespace OpenSim.Framework.Servers | |||
331 | /// object. | 331 | /// object. |
332 | /// </summary | 332 | /// </summary |
333 | /// <param name="req">Incoming OSHttpRequest to which we are | 333 | /// <param name="req">Incoming OSHttpRequest to which we are |
334 | /// replying</param> | 334 | /// replying</param> |
335 | public OSHttpResponse(OSHttpRequest req) | 335 | public OSHttpResponse(OSHttpRequest req) |
336 | { | 336 | { |
337 | _httpResponse = new HttpResponse(req.HttpClientContext, req.HttpRequest); | 337 | _httpResponse = new HttpResponse(req.HttpClientContext, req.HttpRequest); |
@@ -343,7 +343,7 @@ namespace OpenSim.Framework.Servers | |||
343 | /// <param name="key">string containing the header field | 343 | /// <param name="key">string containing the header field |
344 | /// name</param> | 344 | /// name</param> |
345 | /// <param name="value">string containing the header field | 345 | /// <param name="value">string containing the header field |
346 | /// value</param> | 346 | /// value</param> |
347 | public void AddHeader(string key, string value) | 347 | public void AddHeader(string key, string value) |
348 | { | 348 | { |
349 | if (HttpServer) | 349 | if (HttpServer) |
@@ -361,8 +361,8 @@ namespace OpenSim.Framework.Servers | |||
361 | { | 361 | { |
362 | _httpResponse.Body.Flush(); | 362 | _httpResponse.Body.Flush(); |
363 | _httpResponse.Send(); | 363 | _httpResponse.Send(); |
364 | } | 364 | } |
365 | else | 365 | else |
366 | { | 366 | { |
367 | OutputStream.Close(); | 367 | OutputStream.Close(); |
368 | } | 368 | } |
diff --git a/OpenSim/Framework/Servers/OSHttpServer.cs b/OpenSim/Framework/Servers/OSHttpServer.cs index e0d26ff..40f4229 100644 --- a/OpenSim/Framework/Servers/OSHttpServer.cs +++ b/OpenSim/Framework/Servers/OSHttpServer.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Framework.Servers | |||
80 | get { return _isSecure; } | 80 | get { return _isSecure; } |
81 | } | 81 | } |
82 | 82 | ||
83 | public int QueueSize | 83 | public int QueueSize |
84 | { | 84 | { |
85 | get { return _pumps.Length; } | 85 | get { return _pumps.Length; } |
86 | } | 86 | } |
@@ -91,7 +91,7 @@ namespace OpenSim.Framework.Servers | |||
91 | protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>(); | 91 | protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>(); |
92 | public List<OSHttpHandler> OSHttpHandlers | 92 | public List<OSHttpHandler> OSHttpHandlers |
93 | { | 93 | { |
94 | get | 94 | get |
95 | { | 95 | { |
96 | lock (_httpHandlers) | 96 | lock (_httpHandlers) |
97 | { | 97 | { |
@@ -175,7 +175,7 @@ namespace OpenSim.Framework.Servers | |||
175 | _listener.RequestHandler += OnHttpRequest; | 175 | _listener.RequestHandler += OnHttpRequest; |
176 | _listener.Start(QueueSize); | 176 | _listener.Start(QueueSize); |
177 | _log.InfoFormat("[{0}] HTTP server started", EngineID); | 177 | _log.InfoFormat("[{0}] HTTP server started", EngineID); |
178 | 178 | ||
179 | lock (_syncObject) Monitor.Wait(_syncObject); | 179 | lock (_syncObject) Monitor.Wait(_syncObject); |
180 | } | 180 | } |
181 | catch (Exception ex) | 181 | catch (Exception ex) |
@@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers | |||
196 | /// and regular expressions to match against header values</param> | 196 | /// and regular expressions to match against header values</param> |
197 | public void AddHandler(OSHttpHandler handler) | 197 | public void AddHandler(OSHttpHandler handler) |
198 | { | 198 | { |
199 | lock (_httpHandlers) | 199 | lock (_httpHandlers) |
200 | { | 200 | { |
201 | if (_httpHandlers.Contains(handler)) | 201 | if (_httpHandlers.Contains(handler)) |
202 | { | 202 | { |
diff --git a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs index f3f056a..996e5dc 100644 --- a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs +++ b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs | |||
@@ -54,16 +54,16 @@ namespace OpenSim.Framework.Servers | |||
54 | protected bool XmlRpcMethodMatch(OSHttpRequest req) | 54 | protected bool XmlRpcMethodMatch(OSHttpRequest req) |
55 | { | 55 | { |
56 | XmlRpcRequest xmlRpcRequest = null; | 56 | XmlRpcRequest xmlRpcRequest = null; |
57 | 57 | ||
58 | // check whether req is already reified | 58 | // check whether req is already reified |
59 | // if not: reify (and post to whiteboard) | 59 | // if not: reify (and post to whiteboard) |
60 | try | 60 | try |
61 | { | 61 | { |
62 | if (req.Whiteboard.ContainsKey("xmlrequest")) | 62 | if (req.Whiteboard.ContainsKey("xmlrequest")) |
63 | { | 63 | { |
64 | xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest; | 64 | xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest; |
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | StreamReader body = new StreamReader(req.InputStream); | 68 | StreamReader body = new StreamReader(req.InputStream); |
69 | string requestBody = body.ReadToEnd(); | 69 | string requestBody = body.ReadToEnd(); |
@@ -76,22 +76,22 @@ namespace OpenSim.Framework.Servers | |||
76 | _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString()); | 76 | _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString()); |
77 | return false; | 77 | return false; |
78 | } | 78 | } |
79 | 79 | ||
80 | // check against methodName | 80 | // check against methodName |
81 | if ((null != xmlRpcRequest) | 81 | if ((null != xmlRpcRequest) |
82 | && !String.IsNullOrEmpty(xmlRpcRequest.MethodName) | 82 | && !String.IsNullOrEmpty(xmlRpcRequest.MethodName) |
83 | && xmlRpcRequest.MethodName == _methodName) | 83 | && xmlRpcRequest.MethodName == _methodName) |
84 | { | 84 | { |
85 | _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString()); | 85 | _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString()); |
86 | return true; | 86 | return true; |
87 | } | 87 | } |
88 | 88 | ||
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | 91 | ||
92 | // contains handler for processing XmlRpc Request | 92 | // contains handler for processing XmlRpc Request |
93 | private XmlRpcMethod _handler; | 93 | private XmlRpcMethod _handler; |
94 | 94 | ||
95 | // contains XmlRpc method name | 95 | // contains XmlRpc method name |
96 | private string _methodName; | 96 | private string _methodName; |
97 | 97 | ||
@@ -112,9 +112,9 @@ namespace OpenSim.Framework.Servers | |||
112 | /// can be null, in which case they are not taken into account | 112 | /// can be null, in which case they are not taken into account |
113 | /// when the handler is being looked up. | 113 | /// when the handler is being looked up. |
114 | /// </remarks> | 114 | /// </remarks> |
115 | public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path, | 115 | public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path, |
116 | Dictionary<string, Regex> headers, Regex whitelist) | 116 | Dictionary<string, Regex> headers, Regex whitelist) |
117 | : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers, | 117 | : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers, |
118 | new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled), | 118 | new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled), |
119 | whitelist) | 119 | whitelist) |
120 | { | 120 | { |
@@ -138,7 +138,7 @@ namespace OpenSim.Framework.Servers | |||
138 | /// <summary> | 138 | /// <summary> |
139 | /// Invoked by OSHttpRequestPump. | 139 | /// Invoked by OSHttpRequestPump. |
140 | /// </summary> | 140 | /// </summary> |
141 | public override OSHttpHandlerResult Process(OSHttpRequest request) | 141 | public override OSHttpHandlerResult Process(OSHttpRequest request) |
142 | { | 142 | { |
143 | XmlRpcResponse xmlRpcResponse; | 143 | XmlRpcResponse xmlRpcResponse; |
144 | string responseString; | 144 | string responseString; |
@@ -148,13 +148,13 @@ namespace OpenSim.Framework.Servers | |||
148 | 148 | ||
149 | 149 | ||
150 | OSHttpResponse resp = new OSHttpResponse(request); | 150 | OSHttpResponse resp = new OSHttpResponse(request); |
151 | try | 151 | try |
152 | { | 152 | { |
153 | // reified XmlRpcRequest must still be on the whiteboard | 153 | // reified XmlRpcRequest must still be on the whiteboard |
154 | XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest; | 154 | XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest; |
155 | xmlRpcResponse = _handler(xmlRpcRequest); | 155 | xmlRpcResponse = _handler(xmlRpcRequest); |
156 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); | 156 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); |
157 | 157 | ||
158 | resp.ContentType = "text/xml"; | 158 | resp.ContentType = "text/xml"; |
159 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); | 159 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); |
160 | 160 | ||
@@ -176,4 +176,4 @@ namespace OpenSim.Framework.Servers | |||
176 | return OSHttpHandlerResult.Done; | 176 | return OSHttpHandlerResult.Done; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | } \ No newline at end of file | 179 | } |
diff --git a/OpenSim/Framework/Servers/RestSessionService.cs b/OpenSim/Framework/Servers/RestSessionService.cs index 1ed349f..1cfb425 100644 --- a/OpenSim/Framework/Servers/RestSessionService.cs +++ b/OpenSim/Framework/Servers/RestSessionService.cs | |||
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Servers | |||
151 | private CheckIdentityMethod m_smethod; | 151 | private CheckIdentityMethod m_smethod; |
152 | 152 | ||
153 | public RestDeserialiseSecureHandler( | 153 | public RestDeserialiseSecureHandler( |
154 | string httpMethod, string path, | 154 | string httpMethod, string path, |
155 | RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod) | 155 | RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod) |
156 | : base(httpMethod, path) | 156 | : base(httpMethod, path) |
157 | { | 157 | { |
@@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers | |||
196 | /// <param name="method"></param> | 196 | /// <param name="method"></param> |
197 | /// <param name="tmethod"></param> | 197 | /// <param name="tmethod"></param> |
198 | private RestDeserialiseMethod<TRequest, TResponse> m_method; | 198 | private RestDeserialiseMethod<TRequest, TResponse> m_method; |
199 | 199 | ||
200 | /// <summary> | 200 | /// <summary> |
201 | /// The method used to check whether a request is trusted. | 201 | /// The method used to check whether a request is trusted. |
202 | /// </summary> | 202 | /// </summary> |