return w.GetSection (sectionName);
}
- [MonoTODO]
public override object GetService (Type serviceType)
{
- throw new NotImplementedException ();
+ return ((IServiceProvider)w).GetService (serviceType);
}
#if NET_4_0
public override void RemapHandler (IHttpHandler handler)
#if NET_4_5
public virtual ReadEntityBodyMode ReadEntityBodyMode { get { NotImplemented(); return ReadEntityBodyMode.Classic; } }
+
+ public virtual UnvalidatedRequestValuesBase Unvalidated { get { NotImplemented (); return null; } }
#endif
+
public virtual Uri Url { get { NotImplemented (); return null; } }
public virtual Uri UrlReferrer { get { NotImplemented (); return null; } }
get { return w.TotalBytes; }
}
+#if NET_4_5
+ public override UnvalidatedRequestValuesBase Unvalidated {
+ get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
+ }
+#endif
+
public override Uri Url {
get { return w.Url; }
}
string unescaped_path;
string original_path;
string path_info;
+ string path_info_unvalidated;
string raw_url;
+ string raw_url_unvalidated;
WebROCollection all_params;
- WebROCollection headers;
+ NameValueCollection headers;
+ WebROCollection headers_unvalidated;
Stream input_stream;
InputFilterStream input_filter;
Stream filter;
HttpCookieCollection cookies;
+ HttpCookieCollection cookies_unvalidated;
string http_method;
WebROCollection form;
}
}
- public HttpCookieCollection Cookies {
+ internal HttpCookieCollection CookiesNoValidation {
get {
- if (cookies == null) {
+ if (cookies_unvalidated == null) {
if (worker_request == null) {
- cookies = new HttpCookieCollection ();
+ cookies_unvalidated = new HttpCookieCollection ();
} else {
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
- cookies = new HttpCookieCollection (cookie_hv);
+ cookies_unvalidated = new HttpCookieCollection (cookie_hv);
}
}
+ return cookies_unvalidated;
+ }
+ }
+
+ public HttpCookieCollection Cookies {
+ get {
+ if (cookies == null) {
+ cookies = CookiesNoValidation;
+ }
+
#if TARGET_J2EE
// For J2EE portal support we emulate cookies using the session.
GetSessionCookiesForPortal (cookies);
}
}
+ internal NameValueCollection HeadersNoValidation {
+ get {
+ if (headers_unvalidated == null) {
+ headers_unvalidated = new HeadersCollection (this);
+ }
+
+ return headers_unvalidated;
+ }
+ }
+
public NameValueCollection Headers {
get {
if (headers == null) {
- headers = new HeadersCollection (this);
+ headers = HeadersNoValidation;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
}
}
+ internal string PathInfoNoValidation {
+ get {
+ if (path_info_unvalidated == null) {
+ if (worker_request == null)
+ return String.Empty;
+
+ path_info_unvalidated = worker_request.GetPathInfo () ?? String.Empty;
+ }
+
+ return path_info_unvalidated;
+ }
+ }
+
public string PathInfo {
get {
if (path_info == null) {
- if (worker_request == null)
- return String.Empty;
- path_info = worker_request.GetPathInfo () ?? String.Empty;
+ path_info = PathInfoNoValidation;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
}
}
- public string RawUrl {
+ internal string RawUrlUnvalidated {
get {
- if (raw_url == null) {
+ if (raw_url_unvalidated == null) {
if (worker_request != null)
- raw_url = worker_request.GetRawUrl ();
+ raw_url_unvalidated = worker_request.GetRawUrl ();
else
- raw_url = UrlComponents.Path + UrlComponents.Query;
+ raw_url_unvalidated = UrlComponents.Path + UrlComponents.Query;
- if (raw_url == null)
- raw_url = String.Empty;
+ if (raw_url_unvalidated == null)
+ raw_url_unvalidated = String.Empty;
+ }
+
+ return raw_url_unvalidated;
+ }
+ }
+
+ public string RawUrl {
+ get {
+ if (raw_url == null) {
+ raw_url = RawUrlUnvalidated;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
}
}
+#if NET_4_5
+ public UnvalidatedRequestValues Unvalidated {
+ get {
+ var vals = new UnvalidatedRequestValues ();
+
+ vals.Cookies = CookiesNoValidation;
+ vals.Files = Files;
+ vals.Form = FormUnvalidated;
+ vals.Headers = HeadersNoValidation;
+ vals.Path = PathNoValidation;
+ vals.PathInfo = PathInfoNoValidation;
+ vals.QueryString = QueryStringUnvalidated;
+ vals.RawUrl = RawUrlUnvalidated;
+ vals.Url = Url;
+
+ return vals;
+ }
+ }
+#endif
+
public Uri Url {
get {
if (cached_url == null) {
--- /dev/null
+//
+// System.Web.UnvalidatedRequestValues.cs
+//
+// Author:
+// Mike Morano <mmorano@mikeandwan.us>
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Specialized;
+
+
+namespace System.Web {
+ public sealed class UnvalidatedRequestValues {
+ public HttpCookieCollection Cookies { get; internal set; }
+ public HttpFileCollection Files { get; internal set; }
+ public NameValueCollection Form { get; internal set; }
+ public NameValueCollection Headers { get; internal set; }
+ public string Path { get; internal set; }
+ public string PathInfo { get; internal set; }
+ public NameValueCollection QueryString { get; internal set; }
+ public string RawUrl { get; internal set; }
+ public Uri Url { get; internal set; }
+
+ public string this[string field] {
+ get {
+ if (Form != null && Form [field] != null) {
+ return Form [field];
+ }
+
+ if (Cookies != null && Cookies [field] != null) {
+ return Cookies [field].Value;
+ }
+
+ if (QueryString != null && QueryString [field] != null) {
+ return QueryString [field];
+ }
+
+ // msdn docs also suggest the ServerVariables are inspected by this indexer,
+ // but that seems odd given what is available in this class
+
+ return null;
+ }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UnvalidatedRequestValuesBase.cs
+//
+// Author:
+// Mike Morano <mmorano@mikeandwan.us>
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Specialized;
+
+
+namespace System.Web {
+ public abstract class UnvalidatedRequestValuesBase {
+ void NotImplemented ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual HttpCookieCollection Cookies
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual HttpFileCollection Files
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual NameValueCollection Form
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual NameValueCollection Headers
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual string this[string field]
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual string Path
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual string PathInfo
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual NameValueCollection QueryString
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual string RawUrl
+ {
+ get { NotImplemented (); return null; }
+ }
+
+ public virtual Uri Url
+ {
+ get { NotImplemented (); return null; }
+ }
+ }
+}
--- /dev/null
+//
+// System.Web.UnvalidatedRequestValuesWrapper.cs
+//
+// Author:
+// Mike Morano <mmorano@mikeandwan.us>
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Specialized;
+
+
+namespace System.Web {
+ public class UnvalidatedRequestValuesWrapper : UnvalidatedRequestValuesBase {
+ UnvalidatedRequestValues rv;
+
+ public UnvalidatedRequestValuesWrapper (UnvalidatedRequestValues requestValues)
+ {
+ rv = requestValues;
+ }
+
+ public override HttpCookieCollection Cookies
+ {
+ get { return rv.Cookies; }
+ }
+
+ public override HttpFileCollection Files
+ {
+ get { return rv.Files; }
+ }
+
+ public override NameValueCollection Form
+ {
+ get { return rv.Form; }
+ }
+
+ public override NameValueCollection Headers
+ {
+ get { return rv.Headers; }
+ }
+
+ public override string this[string field]
+ {
+ get { return rv[field]; }
+ }
+
+ public override string Path
+ {
+ get { return rv.Path; }
+ }
+
+ public override string PathInfo
+ {
+ get { return rv.PathInfo; }
+ }
+
+ public override NameValueCollection QueryString
+ {
+ get { return rv.QueryString; }
+ }
+
+ public override string RawUrl
+ {
+ get { return rv.RawUrl; }
+ }
+
+ public override Uri Url
+ {
+ get { return rv.Url; }
+ }
+ }
+}
System.Web/MimeMapping.cs
System.Web/ReadEntityBodyMode.cs
-
+System.Web/UnvalidatedRequestValues.cs
+System.Web/UnvalidatedRequestValuesBase.cs
+System.Web/UnvalidatedRequestValuesWrapper.cs