Merge remote-tracking branch 'mfoliveira/ppc64el-v2'
[mono.git] / mcs / class / System.Web.Abstractions / System.Web / HttpRequestWrapper.cs
1 //
2 // HttpRequestWrapper.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008 Novell Inc. http://novell.com
8 //
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30 using System;
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
35 using System.IO;
36 using System.Runtime.CompilerServices;
37 using System.Runtime.Serialization;
38 using System.Security.Permissions;
39 using System.Security.Principal;
40 using System.Text;
41 using System.Web.Caching;
42
43 #if NET_4_0
44 using System.Security.Authentication.ExtendedProtection;
45 using System.Web.Routing;
46 #endif
47
48 namespace System.Web
49 {
50 #if NET_4_0
51         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
52 #endif
53         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
54         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
55         public class HttpRequestWrapper : HttpRequestBase
56         {
57                 HttpRequest w;
58
59                 public HttpRequestWrapper (HttpRequest httpRequest)
60                 {
61                         if (httpRequest == null)
62                                 throw new ArgumentNullException ("httpRequest");
63                         w = httpRequest;
64                 }
65
66                 public override string [] AcceptTypes {
67                         get { return w.AcceptTypes; }
68                 }
69
70                 public override string AnonymousID {
71                         get { return w.AnonymousID; }
72                 }
73
74                 public override string ApplicationPath {
75                         get { return w.ApplicationPath; }
76                 }
77
78                 public override string AppRelativeCurrentExecutionFilePath {
79                         get { return w.AppRelativeCurrentExecutionFilePath; }
80                 }
81
82                 public override HttpBrowserCapabilitiesBase Browser {
83                         get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
84                 }
85
86                 public override HttpClientCertificate ClientCertificate {
87                         get { return w.ClientCertificate; }
88                 }
89
90                 public override Encoding ContentEncoding {
91                         get { return w.ContentEncoding; }
92                         set { w.ContentEncoding = value; }
93                 }
94
95                 public override int ContentLength {
96                         get { return w.ContentLength; }
97                 }
98
99                 public override string ContentType {
100                         get { return w.ContentType; }
101                         set { w.ContentType = value; }
102                 }
103
104                 public override HttpCookieCollection Cookies {
105                         get { return w.Cookies; }
106                 }
107
108                 public override string CurrentExecutionFilePath {
109                         get { return w.CurrentExecutionFilePath; }
110                 }
111
112                 public override string FilePath {
113                         get { return w.FilePath; }
114                 }
115
116                 public override HttpFileCollectionBase Files {
117                         get { return new HttpFileCollectionWrapper (w.Files); }
118                 }
119
120                 public override Stream Filter {
121                         get { return w.Filter; }
122                         set { w.Filter = value; }
123                 }
124
125                 public override NameValueCollection Form {
126                         get { return w.Form; }
127                 }
128
129                 public override NameValueCollection Headers {
130                         get { return w.Headers; }
131                 }
132
133                 public override string HttpMethod {
134                         get { return w.HttpMethod; }
135                 }
136 #if NET_4_0
137                 public override ChannelBinding HttpChannelBinding {
138                         get { return w.HttpChannelBinding; }
139                 }
140 #endif
141                 public override Stream InputStream {
142                         get { return w.InputStream; }
143                 }
144
145                 public override bool IsAuthenticated {
146                         get { return w.IsAuthenticated; }
147                 }
148
149                 public override bool IsLocal {
150                         get { return w.IsLocal; }
151                 }
152
153                 public override bool IsSecureConnection {
154                         get { return w.IsSecureConnection; }
155                 }
156
157                 public override string this [string key] {
158                         get { return w [key]; }
159                 }
160
161                 public override WindowsIdentity LogonUserIdentity {
162                         get { return w.LogonUserIdentity; }
163                 }
164
165                 public override NameValueCollection Params {
166                         get { return w.Params; }
167                 }
168
169                 public override string Path {
170                         get { return w.Path; }
171                 }
172
173                 public override string PathInfo {
174                         get { return w.PathInfo; }
175                 }
176
177                 public override string PhysicalApplicationPath {
178                         get { return w.PhysicalApplicationPath; }
179                 }
180
181                 public override string PhysicalPath {
182                         get { return w.PhysicalPath; }
183                 }
184
185                 public override NameValueCollection QueryString {
186                         get { return w.QueryString; }
187                 }
188
189                 public override string RawUrl {
190                         get { return w.RawUrl; }
191                 }
192
193                 public override string RequestType {
194                         get { return w.RequestType; }
195                         set { w.RequestType = value; }
196                 }
197 #if NET_4_0
198                 public override RequestContext RequestContext {
199                         get { return w.RequestContext; }
200                         internal set { w.RequestContext = value; }      
201                 }
202 #endif
203                 public override NameValueCollection ServerVariables {
204                         get { return w.ServerVariables; }
205                 }
206
207                 public override int TotalBytes {
208                         get { return w.TotalBytes; }
209                 }
210
211 #if NET_4_5
212                 public override UnvalidatedRequestValuesBase Unvalidated { 
213                         get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); } 
214                 }
215 #endif
216
217 #if NET_4_5
218                 public override ReadEntityBodyMode ReadEntityBodyMode {
219                         get { return ReadEntityBodyMode.Classic; }
220                 }
221 #endif
222
223                 public override Uri Url {
224                         get { return w.Url; }
225                 }
226
227                 public override Uri UrlReferrer {
228                         get { return w.UrlReferrer; }
229                 }
230
231                 public override string UserAgent {
232                         get { return w.UserAgent; }
233                 }
234
235                 public override string UserHostAddress {
236                         get { return w.UserHostAddress; }
237                 }
238
239                 public override string UserHostName {
240                         get { return w.UserHostName; }
241                 }
242
243                 public override string [] UserLanguages {
244                         get { return w.UserLanguages; }
245                 }
246
247 #if NET_4_5
248                 public void Abort ()
249                 {
250                         w.WorkerRequest.CloseConnection();
251                 }
252 #endif
253
254                 public override byte [] BinaryRead (int count)
255                 {
256                         return w.BinaryRead (count);
257                 }
258
259                 public override int [] MapImageCoordinates (string imageFieldName)
260                 {
261                         return w.MapImageCoordinates (imageFieldName);
262                 }
263
264                 public override string MapPath (string overridePath)
265                 {
266                         return w.MapPath (overridePath);
267                 }
268
269                 public override string MapPath (string overridePath, string baseVirtualDir, bool allowCrossAppMapping)
270                 {
271                         return w.MapPath (overridePath, baseVirtualDir, allowCrossAppMapping);
272                 }
273
274                 public override void SaveAs (string filename, bool includeHeaders)
275                 {
276                         w.SaveAs (filename, includeHeaders);
277                 }
278
279                 public override void ValidateInput ()
280                 {
281                         w.ValidateInput ();
282                 }
283         }
284 }