aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/OSHttpHandler.cs
diff options
context:
space:
mode:
authorDr Scofield2008-06-27 09:29:41 +0000
committerDr Scofield2008-06-27 09:29:41 +0000
commit63a1a2739a28b32dde60f01fce2fbd5149ede0ad (patch)
tree60f8badb7b93a80f2102f6cac6494e075ab79c07 /OpenSim/Framework/Servers/OSHttpHandler.cs
parentMantis#1612. Thank you, kindly, Matth for a patch that: (diff)
downloadopensim-SC_OLD-63a1a2739a28b32dde60f01fce2fbd5149ede0ad.zip
opensim-SC_OLD-63a1a2739a28b32dde60f01fce2fbd5149ede0ad.tar.gz
opensim-SC_OLD-63a1a2739a28b32dde60f01fce2fbd5149ede0ad.tar.bz2
opensim-SC_OLD-63a1a2739a28b32dde60f01fce2fbd5149ede0ad.tar.xz
status: work in progress, non-functional
having OSHttpHandler as a delegate was not too hot, i'm refactoring it into an interface.
Diffstat (limited to 'OpenSim/Framework/Servers/OSHttpHandler.cs')
-rw-r--r--OpenSim/Framework/Servers/OSHttpHandler.cs102
1 files changed, 102 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHandler.cs
new file mode 100644
index 0000000..c4ab81c
--- /dev/null
+++ b/OpenSim/Framework/Servers/OSHttpHandler.cs
@@ -0,0 +1,102 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text.RegularExpressions;
31
32namespace OpenSim.Framework.Servers
33{
34 /// <sumary>
35 /// Any OSHttpHandler must return one of the following results:
36 /// <list type = "table">
37 /// <listheader>
38 /// <term>result code</term>
39 /// <description>meaning</description>
40 /// </listheader>
41 /// <item>
42 /// <term>Pass</term>
43 /// <description>handler did not process the request</request>
44 /// </item>
45 /// <item>
46 /// <term>Handled</term>
47 /// <description>handler did process the request, OSHttpServer
48 /// can clean up and close the request</request>
49 /// </item>
50 /// <item>
51 /// <term>Detached</term>
52 /// <description>handler handles the request, OSHttpServer
53 /// can forget about the request and should not touch it as
54 /// the handler has taken control</request>
55 /// </item>
56 /// </list>
57 /// </summary>
58 public enum OSHttpHandlerResult
59 {
60 Pass,
61 Handled,
62 Detached,
63 }
64
65 public interface OSHttpHandler
66 {
67 /// <summary>
68 /// Regular expression used to match against path of incoming
69 /// HTTP request. If you want to match any string either use
70 /// '.*' or null. To match for the emtpy string use '^$'
71 /// </summary>
72 Regex Path
73 {
74 get;
75 }
76
77 /// <summary>
78 /// Dictionary of (header name, regular expression) tuples,
79 /// allowing us to match on HTTP header fields.
80 /// </summary>
81 Dictionary<string, Regex> Headers
82 {
83 get;
84 }
85
86 /// <summary>
87 /// Dictionary of (header name, regular expression) tuples,
88 /// allowing us to match on HTTP header fields.
89 /// </summary>
90 /// <remarks>
91 /// This feature is currently not implemented as it requires
92 /// (trivial) changes to HttpServer.HttpListener that have not
93 /// been implemented.
94 /// </remarks>
95 Regex IPEndPointWhitelist
96 {
97 get;
98 }
99
100 OSHttpHandlerResult Process(OSHttpRequest request);
101 }
102} \ No newline at end of file