2 // System.Net.HttpWebRequest (for 2.1 profile)
5 // Atsushi Enomoto <atsushi@ximian.com>
6 // Jb Evain <jbevain@novell.com>
8 // Copyright (C) 2007, 2009-2010 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 namespace System.Net {
38 // note: the NotImplementedException are needed to match MS implementation
40 // note: MS documents a lot of thing for this type but, in truth, all happens
41 // in a type that derive from HttpWebRequest. In Moonlight case this is either
42 // * BrowserHttpWebRequest (browser stack) located in System.Windows.Browser.dll; or
43 // * System.Net.Browser.ClientHttpWebRequest (client stack) located in System.Windows.dll
45 public abstract class HttpWebRequest : WebRequest {
47 private WebHeaderCollection headers;
49 protected HttpWebRequest ()
53 public string Accept {
54 get { return Headers [HttpRequestHeader.Accept]; }
55 // this header cannot be set directly inside the collection (hence the helper)
56 set { Headers.SetHeader ("accept", value); }
59 public virtual bool AllowReadStreamBuffering {
60 get { throw NotImplemented (); }
61 set { throw NotImplemented (); }
65 public virtual bool AllowWriteStreamBuffering {
66 get { throw NotImplemented (); }
67 set { throw NotImplemented (); }
70 public override string ContentType {
71 get { return Headers [HttpRequestHeader.ContentType]; }
72 // this header cannot be set directly inside the collection (hence the helper)
73 set { Headers.SetHeader ("content-type", value); }
76 public virtual bool HaveResponse {
77 get { throw NotImplemented (); }
80 public override WebHeaderCollection Headers {
83 headers = new WebHeaderCollection (true);
87 // note: this is not a field assignment but a copy (see unit tests)
88 // make sure everything we're supplied is valid...
89 foreach (string header in value) {
90 // anything bad will throw
91 WebHeaderCollection.ValidateHeader (header);
93 // ... before making those values our own
95 foreach (string header in value) {
96 headers [header] = value [header];
101 public virtual CookieContainer CookieContainer {
102 get { throw NotImplemented (); }
103 set { throw NotImplemented (); }
106 public override string Method {
107 get { throw NotImplemented (); }
108 set { throw NotImplemented (); }
111 public override Uri RequestUri {
112 get { throw NotImplemented (); }
116 public virtual bool SupportsCookieContainer {
117 get { return false; }
120 public override void Abort ()
122 throw NotImplemented ();
125 public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
127 throw NotImplemented ();
130 public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
132 throw NotImplemented ();
135 public override Stream EndGetRequestStream (IAsyncResult asyncResult)
137 throw NotImplemented ();
140 public override WebResponse EndGetResponse (IAsyncResult asyncResult)
142 throw NotImplemented ();
145 static Exception NotImplemented ()
147 // a bit less IL and hide the "normal" NotImplementedException from corcompare-like tools
148 return new NotImplementedException ();