aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2008-06-26 16:10:04 +0000
committerDr Scofield2008-06-26 16:10:04 +0000
commit744b44dc8b6aef3647e6009a3de219bf39a9a781 (patch)
treec1f0e78ca88e05872bae67b0625c4436fc906f3d
parentMantis#1600. Thank you, Melanie for a patch that: (diff)
downloadopensim-SC-744b44dc8b6aef3647e6009a3de219bf39a9a781.zip
opensim-SC-744b44dc8b6aef3647e6009a3de219bf39a9a781.tar.gz
opensim-SC-744b44dc8b6aef3647e6009a3de219bf39a9a781.tar.bz2
opensim-SC-744b44dc8b6aef3647e6009a3de219bf39a9a781.tar.xz
WORK-IN-PRGRESS: beware of falling pieces and shifting
tectonic plates: starting AddHandler() code.
-rw-r--r--OpenSim/Framework/Servers/OSHttpServer.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpServer.cs b/OpenSim/Framework/Servers/OSHttpServer.cs
index 296f853..c022062 100644
--- a/OpenSim/Framework/Servers/OSHttpServer.cs
+++ b/OpenSim/Framework/Servers/OSHttpServer.cs
@@ -26,9 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Net.Sockets; 31using System.Net.Sockets;
31using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions;
32using System.Threading; 34using System.Threading;
33using System.Security.Cryptography.X509Certificates; 35using System.Security.Cryptography.X509Certificates;
34using log4net; 36using log4net;
@@ -38,6 +40,39 @@ using HttpListener = HttpServer.HttpListener;
38 40
39namespace OpenSim.Framework.Servers 41namespace OpenSim.Framework.Servers
40{ 42{
43 /// <sumary>
44 /// Any OSHttpHandler must return one of the following results:
45 /// <list type = "table">
46 /// <listheader>
47 /// <term>result code</term>
48 /// <description>meaning</description>
49 /// </listheader>
50 /// <item>
51 /// <term>Pass</term>
52 /// <description>handler did not process the request</request>
53 /// </item>
54 /// <item>
55 /// <term>Handled</term>
56 /// <description>handler did process the request, OSHttpServer
57 /// can clean up and close the request</request>
58 /// </item>
59 /// <item>
60 /// <term>Detached</term>
61 /// <description>handler handles the request, OSHttpServer
62 /// can forget about the request and should not touch it as
63 /// the handler has taken control</request>
64 /// </item>
65 /// </list>
66 /// </summary>
67 public enum OSHttpHandlerResult
68 {
69 Pass,
70 Handled,
71 Detached,
72 }
73
74 public delegate OSHttpHandlerResult OSHttpHandler(OSHttpRequest request);
75
41 /// <summary> 76 /// <summary>
42 /// OSHttpServer provides an HTTP server bound to a specific 77 /// OSHttpServer provides an HTTP server bound to a specific
43 /// port. When instantiated with just address and port it uses 78 /// port. When instantiated with just address and port it uses
@@ -136,6 +171,7 @@ namespace OpenSim.Framework.Servers
136 } 171 }
137 172
138 /// <summary> 173 /// <summary>
174 /// Engine keeps the HTTP server running.
139 /// </summary> 175 /// </summary>
140 private void Engine() 176 private void Engine()
141 { 177 {
@@ -146,7 +182,24 @@ namespace OpenSim.Framework.Servers
146 } 182 }
147 } 183 }
148 184
185 protected Dictionary<OSHttpHandler, Regex> Handler2Path = new Dictionary<OSHttpHandler, Regex>();
186 protected Dictionary<OSHttpHandler, Dictionary<string, Regex>> Handler2Headers =
187 new Dictionary<OSHttpHandler, Dictionary<string, Regex>>();
149 188
189 /// <summary>
190 /// Add an HTTP request handler.
191 /// </summary>
192 /// <param name="handler">OSHttpHandler delegate</param>
193 /// <param name="path">regex object for path matching</parm>
194 /// <param name="headers">dictionary containing header names
195 /// and regular expressions to match against header values</param>
196 public void AddHandler(OSHttpHandler handler, Regex path, Dictionary<string, Regex> headers)
197 {
198 lock (Handler2Headers)
199 {
200
201 }
202 }
150 203
151 } 204 }
152} 205}