[System] UriKind.RelativeOrAbsolute workaround.
[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 using System.Security.Authentication.ExtendedProtection;
44 using System.Web.Routing;
45
46 namespace System.Web
47 {
48         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
49         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
50         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
51         public class HttpRequestWrapper : HttpRequestBase
52         {
53                 HttpRequest w;
54
55                 public HttpRequestWrapper (HttpRequest httpRequest)
56                 {
57                         if (httpRequest == null)
58                                 throw new ArgumentNullException ("httpRequest");
59                         w = httpRequest;
60                 }
61
62                 public override string [] AcceptTypes {
63                         get { return w.AcceptTypes; }
64                 }
65
66                 public override string AnonymousID {
67                         get { return w.AnonymousID; }
68                 }
69
70                 public override string ApplicationPath {
71                         get { return w.ApplicationPath; }
72                 }
73
74                 public override string AppRelativeCurrentExecutionFilePath {
75                         get { return w.AppRelativeCurrentExecutionFilePath; }
76                 }
77
78                 public override HttpBrowserCapabilitiesBase Browser {
79                         get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
80                 }
81
82                 public override HttpClientCertificate ClientCertificate {
83                         get { return w.ClientCertificate; }
84                 }
85
86                 public override Encoding ContentEncoding {
87                         get { return w.ContentEncoding; }
88                         set { w.ContentEncoding = value; }
89                 }
90
91                 public override int ContentLength {
92                         get { return w.ContentLength; }
93                 }
94
95                 public override string ContentType {
96                         get { return w.ContentType; }
97                         set { w.ContentType = value; }
98                 }
99
100                 public override HttpCookieCollection Cookies {
101                         get { return w.Cookies; }
102                 }
103
104                 public override string CurrentExecutionFilePath {
105                         get { return w.CurrentExecutionFilePath; }
106                 }
107
108                 public override string FilePath {
109                         get { return w.FilePath; }
110                 }
111
112                 public override HttpFileCollectionBase Files {
113                         get { return new HttpFileCollectionWrapper (w.Files); }
114                 }
115
116                 public override Stream Filter {
117                         get { return w.Filter; }
118                         set { w.Filter = value; }
119                 }
120
121                 public override NameValueCollection Form {
122                         get { return w.Form; }
123                 }
124
125                 public override NameValueCollection Headers {
126                         get { return w.Headers; }
127                 }
128
129                 public override string HttpMethod {
130                         get { return w.HttpMethod; }
131                 }
132                 public override ChannelBinding HttpChannelBinding {
133                         get { return w.HttpChannelBinding; }
134                 }
135                 public override Stream InputStream {
136                         get { return w.InputStream; }
137                 }
138
139                 public override bool IsAuthenticated {
140                         get { return w.IsAuthenticated; }
141                 }
142
143                 public override bool IsLocal {
144                         get { return w.IsLocal; }
145                 }
146
147                 public override bool IsSecureConnection {
148                         get { return w.IsSecureConnection; }
149                 }
150
151                 public override string this [string key] {
152                         get { return w [key]; }
153                 }
154
155                 public override WindowsIdentity LogonUserIdentity {
156                         get { return w.LogonUserIdentity; }
157                 }
158
159                 public override NameValueCollection Params {
160                         get { return w.Params; }
161                 }
162
163                 public override string Path {
164                         get { return w.Path; }
165                 }
166
167                 public override string PathInfo {
168                         get { return w.PathInfo; }
169                 }
170
171                 public override string PhysicalApplicationPath {
172                         get { return w.PhysicalApplicationPath; }
173                 }
174
175                 public override string PhysicalPath {
176                         get { return w.PhysicalPath; }
177                 }
178
179                 public override NameValueCollection QueryString {
180                         get { return w.QueryString; }
181                 }
182
183                 public override string RawUrl {
184                         get { return w.RawUrl; }
185                 }
186
187                 public override string RequestType {
188                         get { return w.RequestType; }
189                         set { w.RequestType = value; }
190                 }
191                 public override RequestContext RequestContext {
192                         get { return w.RequestContext; }
193                         internal set { w.RequestContext = value; }      
194                 }
195                 public override NameValueCollection ServerVariables {
196                         get { return w.ServerVariables; }
197                 }
198
199                 public override int TotalBytes {
200                         get { return w.TotalBytes; }
201                 }
202
203                 public override UnvalidatedRequestValuesBase Unvalidated { 
204                         get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); } 
205                 }
206
207                 public override ReadEntityBodyMode ReadEntityBodyMode {
208                         get { return ReadEntityBodyMode.Classic; }
209                 }
210
211                 public override Uri Url {
212                         get { return w.Url; }
213                 }
214
215                 public override Uri UrlReferrer {
216                         get { return w.UrlReferrer; }
217                 }
218
219                 public override string UserAgent {
220                         get { return w.UserAgent; }
221                 }
222
223                 public override string UserHostAddress {
224                         get { return w.UserHostAddress; }
225                 }
226
227                 public override string UserHostName {
228                         get { return w.UserHostName; }
229                 }
230
231                 public override string [] UserLanguages {
232                         get { return w.UserLanguages; }
233                 }
234
235                 public void Abort ()
236                 {
237                         w.WorkerRequest.CloseConnection();
238                 }
239
240                 public override byte [] BinaryRead (int count)
241                 {
242                         return w.BinaryRead (count);
243                 }
244
245                 public override int [] MapImageCoordinates (string imageFieldName)
246                 {
247                         return w.MapImageCoordinates (imageFieldName);
248                 }
249
250                 public override string MapPath (string overridePath)
251                 {
252                         return w.MapPath (overridePath);
253                 }
254
255                 public override string MapPath (string overridePath, string baseVirtualDir, bool allowCrossAppMapping)
256                 {
257                         return w.MapPath (overridePath, baseVirtualDir, allowCrossAppMapping);
258                 }
259
260                 public override void SaveAs (string filename, bool includeHeaders)
261                 {
262                         w.SaveAs (filename, includeHeaders);
263                 }
264
265                 public override void ValidateInput ()
266                 {
267                         w.ValidateInput ();
268                 }
269         }
270 }