Add/update missing bits in order to support MVC5.2.
authorMike Morano <mmorano@mikeandwan.us>
Sun, 26 Oct 2014 15:14:08 +0000 (11:14 -0400)
committerMike Morano <mmorano@mikeandwan.us>
Sun, 26 Oct 2014 15:14:08 +0000 (11:14 -0400)
mcs/class/System.Web.Abstractions/System.Web/HttpContextWrapper.cs
mcs/class/System.Web.Abstractions/System.Web/HttpRequestBase.cs
mcs/class/System.Web.Abstractions/System.Web/HttpRequestWrapper.cs
mcs/class/System.Web/System.Web/HttpRequest.cs
mcs/class/System.Web/System.Web/UnvalidatedRequestValues.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/UnvalidatedRequestValuesBase.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web/UnvalidatedRequestValuesWrapper.cs [new file with mode: 0644]
mcs/class/System.Web/net_4_5_System.Web.dll.sources

index 22feb8530d7193050ee835f034ae9af5dd08beab..6581c0c1f77134541d3bf0dc5d542ce2b281e762 100644 (file)
@@ -183,10 +183,9 @@ namespace System.Web
                        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)
index 3a31754b9499cd72e224c49210e2c2bba832b5ee..bf1d6f576aae614cb0cbdcb7175a7d5acd841fef 100644 (file)
@@ -138,7 +138,10 @@ namespace System.Web
 
 #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; } }
index dc5098a3becfa0c727fd9633984a414b75b5fef0..35f631e37e72ff9f2f80b197391091eddde85255 100644 (file)
@@ -208,6 +208,12 @@ namespace System.Web
                        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; }
                }
index a2dd750eff48c2cb49596be5b3919ce55551579e..6f845dbe10855aeeca7e54119f35d3b2abb604ed 100755 (executable)
@@ -80,13 +80,17 @@ namespace System.Web
                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;
@@ -440,17 +444,27 @@ namespace System.Web
                        }
                }
 
-               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);
@@ -737,10 +751,20 @@ namespace System.Web
                        }
                }
 
+               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;
@@ -1226,12 +1250,23 @@ namespace System.Web
                        }
                }
 
+               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;
@@ -1335,16 +1370,26 @@ namespace System.Web
                        }
                }
 
-               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;
@@ -1398,6 +1443,26 @@ namespace System.Web
                        }
                }
 
+#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) {
diff --git a/mcs/class/System.Web/System.Web/UnvalidatedRequestValues.cs b/mcs/class/System.Web/System.Web/UnvalidatedRequestValues.cs
new file mode 100644 (file)
index 0000000..707b67e
--- /dev/null
@@ -0,0 +1,66 @@
+//
+// 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;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web/UnvalidatedRequestValuesBase.cs b/mcs/class/System.Web/System.Web/UnvalidatedRequestValuesBase.cs
new file mode 100644 (file)
index 0000000..9b54b07
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// 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; }
+               }
+       }
+}
diff --git a/mcs/class/System.Web/System.Web/UnvalidatedRequestValuesWrapper.cs b/mcs/class/System.Web/System.Web/UnvalidatedRequestValuesWrapper.cs
new file mode 100644 (file)
index 0000000..e6b6084
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// 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; }
+               }
+       }
+}
index 04c7cacd659e57694c2e908224d5291356a80a2e..f53e5bb9b76abd11a8e725259269aa522e13e137 100644 (file)
@@ -2,4 +2,6 @@
 
 System.Web/MimeMapping.cs
 System.Web/ReadEntityBodyMode.cs
-
+System.Web/UnvalidatedRequestValues.cs
+System.Web/UnvalidatedRequestValuesBase.cs
+System.Web/UnvalidatedRequestValuesWrapper.cs