aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs60
1 files changed, 10 insertions, 50 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
index 4205547..f9ce5b1 100644
--- a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
+++ b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
@@ -45,49 +45,13 @@ namespace OpenSim.Framework.Servers
45 private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 /// <summary> 47 /// <summary>
48 /// Regular expression used to match against path of incoming
49 /// HTTP request. If you want to match any string either use
50 /// '.*' or null. To match for the emtpy string use '^$'
51 /// </summary>
52 public Regex Path
53 {
54 get { return _pathsRegex; }
55 }
56 private Regex _pathsRegex;
57
58 /// <summary>
59 /// Dictionary of (header name, regular expression) tuples,
60 /// allowing us to match on HTTP header fields.
61 /// </summary>
62 public Dictionary<string, Regex> Headers
63 {
64 get { return _headers; }
65 }
66 private Dictionary<string, Regex> _headers;
67
68 /// <summary>
69 /// Regex to whitelist IP end points. A null value disables
70 /// checking of IP end points.
71 /// </summary>
72 /// <remarks>
73 /// This feature is currently not implemented as it requires
74 /// (trivial) changes to HttpServer.HttpListener that have not
75 /// been implemented.
76 /// </remarks>
77 public Regex IPEndPointWhitelist
78 {
79 get { return _ipEndPointRegex; }
80 }
81 private Regex _ipEndPointRegex;
82
83 /// <summary>
84 /// An OSHttpHandler that matches on the "content-type" header can 48 /// An OSHttpHandler that matches on the "content-type" header can
85 /// supply an OSHttpContentTypeChecker delegate which will be 49 /// supply an OSHttpContentTypeChecker delegate which will be
86 /// invoked by the request matcher in OSHttpRequestPump. 50 /// invoked by the request matcher in OSHttpRequestPump.
87 /// </summary> 51 /// </summary>
88 /// <returns>true if the handler is interested in the content; 52 /// <returns>true if the handler is interested in the content;
89 /// false otherwise</returns> 53 /// false otherwise</returns>
90 public OSHttpContentTypeChecker ContentTypeChecker 54 internal override OSHttpContentTypeChecker ContentTypeChecker
91 { 55 {
92 get 56 get
93 { 57 {
@@ -132,7 +96,7 @@ namespace OpenSim.Framework.Servers
132 } 96 }
133 97
134 // contains handler for processing XmlRpc Request 98 // contains handler for processing XmlRpc Request
135 private OSHttpXmlRpcProcessor _handler; 99 private XmlRpcMethod _handler;
136 100
137 // contains XmlRpc method name 101 // contains XmlRpc method name
138 private string _methodName; 102 private string _methodName;
@@ -141,7 +105,7 @@ namespace OpenSim.Framework.Servers
141 /// <summary> 105 /// <summary>
142 /// Instantiate an XmlRpc handler. 106 /// Instantiate an XmlRpc handler.
143 /// </summary> 107 /// </summary>
144 /// <param name="handler">OSHttpXmlRpcProcessor 108 /// <param name="handler">XmlRpcMethod
145 /// delegate</param> 109 /// delegate</param>
146 /// <param name="methodName">XmlRpc method name</param> 110 /// <param name="methodName">XmlRpc method name</param>
147 /// <param name="path">XmlRpc path prefix (regular expression)</param> 111 /// <param name="path">XmlRpc path prefix (regular expression)</param>
@@ -154,28 +118,24 @@ namespace OpenSim.Framework.Servers
154 /// can be null, in which case they are not taken into account 118 /// can be null, in which case they are not taken into account
155 /// when the handler is being looked up. 119 /// when the handler is being looked up.
156 /// </remarks> 120 /// </remarks>
157 public OSHttpXmlRpcHandler(OSHttpXmlRpcProcessor handler, string methodName, Regex path, 121 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path,
158 Dictionary<string, Regex> headers, Regex whitelist) 122 Dictionary<string, Regex> headers, Regex whitelist)
123 : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, headers,
124 new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled),
125 whitelist)
159 { 126 {
160 _handler = handler; 127 _handler = handler;
161 _pathsRegex = path;
162 _methodName = methodName; 128 _methodName = methodName;
163
164 if (null == _headers) _headers = new Dictionary<string, Regex>();
165 _headers.Add("content-type", new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase |
166 RegexOptions.Compiled));
167
168 _ipEndPointRegex = whitelist;
169 } 129 }
170 130
171 131
172 /// <summary> 132 /// <summary>
173 /// Instantiate an XmlRpc handler. 133 /// Instantiate an XmlRpc handler.
174 /// </summary> 134 /// </summary>
175 /// <param name="handler">OSHttpXmlRpcProcessor 135 /// <param name="handler">XmlRpcMethod
176 /// delegate</param> 136 /// delegate</param>
177 /// <param name="methodName">XmlRpc method name</param> 137 /// <param name="methodName">XmlRpc method name</param>
178 public OSHttpXmlRpcHandler(OSHttpXmlRpcProcessor handler, string methodName) 138 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName)
179 : this(handler, methodName, null, null, null) 139 : this(handler, methodName, null, null, null)
180 { 140 {
181 } 141 }
@@ -184,7 +144,7 @@ namespace OpenSim.Framework.Servers
184 /// <summary> 144 /// <summary>
185 /// Invoked by OSHttpRequestPump. 145 /// Invoked by OSHttpRequestPump.
186 /// </summary> 146 /// </summary>
187 public OSHttpHandlerResult Process(OSHttpRequest request) 147 public override OSHttpHandlerResult Process(OSHttpRequest request)
188 { 148 {
189 XmlRpcResponse xmlRpcResponse; 149 XmlRpcResponse xmlRpcResponse;
190 string responseString; 150 string responseString;