2 // HttpRequestWrapper.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2008 Novell Inc. http://novell.com
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
36 using System.Runtime.CompilerServices;
37 using System.Runtime.Serialization;
38 using System.Security.Permissions;
39 using System.Security.Principal;
41 using System.Threading;
42 using System.Web.Caching;
44 using System.Security.Authentication.ExtendedProtection;
45 using System.Web.Routing;
49 [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
50 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
51 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
52 public class HttpRequestWrapper : HttpRequestBase
56 public HttpRequestWrapper (HttpRequest httpRequest)
58 if (httpRequest == null)
59 throw new ArgumentNullException ("httpRequest");
63 public override string [] AcceptTypes {
64 get { return w.AcceptTypes; }
67 public override string AnonymousID {
68 get { return w.AnonymousID; }
71 public override string ApplicationPath {
72 get { return w.ApplicationPath; }
75 public override string AppRelativeCurrentExecutionFilePath {
76 get { return w.AppRelativeCurrentExecutionFilePath; }
79 public override HttpBrowserCapabilitiesBase Browser {
80 get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
83 public override HttpClientCertificate ClientCertificate {
84 get { return w.ClientCertificate; }
87 public override Encoding ContentEncoding {
88 get { return w.ContentEncoding; }
89 set { w.ContentEncoding = value; }
92 public override int ContentLength {
93 get { return w.ContentLength; }
96 public override string ContentType {
97 get { return w.ContentType; }
98 set { w.ContentType = value; }
101 public override HttpCookieCollection Cookies {
102 get { return w.Cookies; }
105 public override string CurrentExecutionFilePath {
106 get { return w.CurrentExecutionFilePath; }
109 public override string FilePath {
110 get { return w.FilePath; }
113 public override HttpFileCollectionBase Files {
114 get { return new HttpFileCollectionWrapper (w.Files); }
117 public override Stream Filter {
118 get { return w.Filter; }
119 set { w.Filter = value; }
122 public override NameValueCollection Form {
123 get { return w.Form; }
126 public override NameValueCollection Headers {
127 get { return w.Headers; }
130 public override Stream GetBufferedInputStream ()
132 return w.GetBufferedInputStream ();
135 public override Stream GetBufferlessInputStream ()
137 return w.GetBufferlessInputStream ();
140 public override Stream GetBufferlessInputStream (System.Boolean disableMaxRequestLength)
142 return w.GetBufferlessInputStream (disableMaxRequestLength);
145 public override string HttpMethod {
146 get { return w.HttpMethod; }
148 public override ChannelBinding HttpChannelBinding {
149 get { return w.HttpChannelBinding; }
151 public override Stream InputStream {
152 get { return w.InputStream; }
155 public override bool IsAuthenticated {
156 get { return w.IsAuthenticated; }
159 public override bool IsLocal {
160 get { return w.IsLocal; }
163 public override bool IsSecureConnection {
164 get { return w.IsSecureConnection; }
167 public override string this [string key] {
168 get { return w [key]; }
171 public override WindowsIdentity LogonUserIdentity {
172 get { return w.LogonUserIdentity; }
175 public override NameValueCollection Params {
176 get { return w.Params; }
179 public override string Path {
180 get { return w.Path; }
183 public override string PathInfo {
184 get { return w.PathInfo; }
187 public override string PhysicalApplicationPath {
188 get { return w.PhysicalApplicationPath; }
191 public override string PhysicalPath {
192 get { return w.PhysicalPath; }
195 public override NameValueCollection QueryString {
196 get { return w.QueryString; }
199 public override string RawUrl {
200 get { return w.RawUrl; }
203 public override string RequestType {
204 get { return w.RequestType; }
205 set { w.RequestType = value; }
207 public override RequestContext RequestContext {
208 get { return w.RequestContext; }
209 set { w.RequestContext = value; }
211 public override NameValueCollection ServerVariables {
212 get { return w.ServerVariables; }
215 public virtual CancellationToken TimedOutToken {
216 get { return w.TimedOutToken; }
219 public override int TotalBytes {
220 get { return w.TotalBytes; }
223 public override UnvalidatedRequestValuesBase Unvalidated {
224 get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
227 public override ReadEntityBodyMode ReadEntityBodyMode {
228 get { return ReadEntityBodyMode.Classic; }
231 public override Uri Url {
232 get { return w.Url; }
235 public override Uri UrlReferrer {
236 get { return w.UrlReferrer; }
239 public override string UserAgent {
240 get { return w.UserAgent; }
243 public override string UserHostAddress {
244 get { return w.UserHostAddress; }
247 public override string UserHostName {
248 get { return w.UserHostName; }
251 public override string [] UserLanguages {
252 get { return w.UserLanguages; }
257 w.WorkerRequest.CloseConnection();
260 public override byte [] BinaryRead (int count)
262 return w.BinaryRead (count);
265 public override int [] MapImageCoordinates (string imageFieldName)
267 return w.MapImageCoordinates (imageFieldName);
270 public override string MapPath (string virtualPath)
272 return w.MapPath (virtualPath);
275 public override string MapPath (string virtualPath, string baseVirtualDir, bool allowCrossAppMapping)
277 return w.MapPath (virtualPath, baseVirtualDir, allowCrossAppMapping);
280 public override double [] MapRawImageCoordinates (System.String imageFieldName)
282 return w.MapRawImageCoordinates (imageFieldName);
285 public override void SaveAs (string filename, bool includeHeaders)
287 w.SaveAs (filename, includeHeaders);
290 public override void ValidateInput ()