[System] FileWebResponse/FileWebRequest from referencesource
authorMarek Safar <marek.safar@gmail.com>
Mon, 16 May 2016 09:18:12 +0000 (11:18 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 16 May 2016 16:09:13 +0000 (18:09 +0200)
13 files changed:
mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
mcs/class/System/ReferenceSources/Logging.cs
mcs/class/System/System.Net/FileWebRequest.cs [deleted file]
mcs/class/System/System.Net/FileWebRequestCreator.cs [deleted file]
mcs/class/System/System.Net/FileWebResponse.cs [deleted file]
mcs/class/System/System.Net/WebHeaderCollection.cs
mcs/class/System/System.Net/WebRequest.cs
mcs/class/System/System.dll.sources
mcs/class/System/Test/System.Net/FileWebRequestTest.cs
mcs/class/System/mobile_System.dll.sources
mcs/class/referencesource/System/net/System/Net/Internal.cs
mcs/class/referencesource/System/net/System/Net/WebHeaderCollection.cs
mcs/class/referencesource/System/net/System/Net/filewebrequest.cs

index 0a9d60fb98ec8bfc9c445982b5622ce200126493..37833bc67086e6b96cbf74f99025feb188174496 100644 (file)
@@ -294,7 +294,7 @@ namespace System.Net.Http
                                if (values_formated == null)
                                        continue;
 
-                               headers.AddValue (header.Key, values_formated);
+                               headers.AddInternal (header.Key, values_formated);
                        }
                        
                        return wr;
@@ -343,7 +343,7 @@ namespace System.Net.Http
 
                                                foreach (var header in content.Headers) {
                                                        foreach (var value in header.Value) {
-                                                               headers.AddValue (header.Key, value);
+                                                               headers.AddInternal (header.Key, value);
                                                        }
                                                }
 
index fe8da2b35823b9b8680f57a91ba898afb2ef4634..35474720e7a493f8a4e14965a2d609913f2051ed 100644 (file)
@@ -22,18 +22,28 @@ namespace System.Net {
                }
 
                [Conditional ("TRACE")]
-               internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject) {
-               }
+               internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject) {
+               }
+
+               [Conditional ("TRACE")]
+               internal static void Exception(TraceSource traceSource, object obj, string method, Exception e) {
+               }
 
                [Conditional ("TRACE")]
                internal static void Exit(TraceSource traceSource, object obj, string method, object retObject) {
                }
 
+               [Conditional ("TRACE")]
                internal static void PrintInfo(TraceSource traceSource, object obj, string method, string msg) {
                }
 
+               [Conditional ("TRACE")]
                internal static void PrintWarning(TraceSource traceSource, object obj, string method, string msg) {
                }
+
+               [Conditional ("TRACE")]
+               internal static void PrintWarning(TraceSource traceSource, string msg) {
+               }
        }
 
 #if MOBILE
diff --git a/mcs/class/System/System.Net/FileWebRequest.cs b/mcs/class/System/System.Net/FileWebRequest.cs
deleted file mode 100644 (file)
index 618c09e..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-//\r
-// System.Net.FileWebRequest\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-using System.Runtime.Remoting.Messaging;\r
-using System.Threading;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class FileWebRequest : WebRequest, ISerializable\r
-       {\r
-               private Uri uri;\r
-               private WebHeaderCollection webHeaders;\r
-               \r
-               private ICredentials credentials;\r
-               private string connectionGroup;\r
-               private long contentLength;\r
-               private FileAccess fileAccess = FileAccess.Read;\r
-               private string method = "GET";\r
-               private IWebProxy proxy;\r
-               private bool preAuthenticate;\r
-               private int timeout = 100000;\r
-               \r
-               private Stream requestStream;\r
-               private FileWebResponse webResponse;\r
-               private AutoResetEvent requestEndEvent;\r
-               private bool requesting;\r
-               private bool asyncResponding;\r
-               \r
-               // Constructors\r
-               \r
-               internal FileWebRequest (Uri uri) \r
-               { \r
-                       this.uri = uri;\r
-                       this.webHeaders = new WebHeaderCollection ();\r
-               }\r
-               \r
-               [Obsolete ("Serialization is obsoleted for this type", false)]\r
-               protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) \r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-                       webHeaders = (WebHeaderCollection) info.GetValue ("headers", typeof (WebHeaderCollection));\r
-                       proxy = (IWebProxy) info.GetValue ("proxy", typeof (IWebProxy));\r
-                       uri = (Uri) info.GetValue ("uri", typeof (Uri));\r
-                       connectionGroup = info.GetString ("connectionGroupName");\r
-                       method = info.GetString ("method");\r
-                       contentLength = info.GetInt64 ("contentLength");\r
-                       timeout = info.GetInt32 ("timeout");\r
-                       fileAccess = (FileAccess) info.GetValue ("fileAccess", typeof (FileAccess));\r
-                       preAuthenticate = info.GetBoolean ("preauthenticate");\r
-               }\r
-               \r
-               // Properties\r
-               \r
-               // currently not used according to spec\r
-               public override string ConnectionGroupName {\r
-                       get { return connectionGroup; }\r
-                       set { connectionGroup = value; }\r
-               }\r
-               \r
-               public override long ContentLength {\r
-                       get { return contentLength; }\r
-                       set {\r
-                               if (value < 0)\r
-                                       throw new ArgumentException ("The Content-Length value must be greater than or equal to zero.", "value");\r
-                               contentLength =  value;\r
-                       }\r
-               }\r
-               \r
-               public override string ContentType { \r
-                       get { return webHeaders ["Content-Type"]; }\r
-                       set { webHeaders ["Content-Type"] = value; }\r
-               }\r
-               \r
-               public override ICredentials Credentials { \r
-                       get { return credentials; }\r
-                       set { credentials = value; }\r
-               }\r
-               \r
-               public override WebHeaderCollection Headers { \r
-                       get { return webHeaders; }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override string Method { \r
-                       get { return this.method; }\r
-                       set {\r
-                               if (value == null || value.Length == 0)\r
-                                       throw new ArgumentException ("Cannot set null or blank "\r
-                                               + "methods on request.", "value");\r
-                               this.method = value;\r
-                       }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override bool PreAuthenticate { \r
-                       get { return preAuthenticate; }\r
-                       set { preAuthenticate = value; }\r
-               }\r
-               \r
-               // currently not used according to spec\r
-               public override IWebProxy Proxy {\r
-                       get { return proxy; }\r
-                       set { proxy = value; }\r
-               }\r
-               \r
-               public override Uri RequestUri { \r
-                       get { return this.uri; }\r
-               }\r
-               \r
-               public override int Timeout { \r
-                       get { return timeout; }\r
-                       set { \r
-                               if (value < -1)\r
-                                       throw new ArgumentOutOfRangeException ("Timeout can be "\r
-                                               + "only set to 'System.Threading.Timeout.Infinite' "\r
-                                               + "or a value >= 0.");\r
-                               timeout = value;\r
-                       }\r
-               }\r
-\r
-               public override bool UseDefaultCredentials\r
-               {\r
-                       get {\r
-                               throw new NotSupportedException ();\r
-                       }\r
-                       set {\r
-                               throw new NotSupportedException ();\r
-                       }\r
-               }\r
-               // Methods\r
-               \r
-               private delegate Stream GetRequestStreamCallback ();\r
-               private delegate WebResponse GetResponseCallback ();\r
-\r
-               static Exception GetMustImplement ()\r
-               {\r
-                       return new NotImplementedException ();\r
-               }\r
-               \r
-               /* LAMESPEC: Docs suggest this was present in 1.1 and\r
-                * 1.0 profiles, but the masterinfos say otherwise\r
-                */\r
-               [MonoTODO]\r
-               public override void Abort ()\r
-               {\r
-                       throw GetMustImplement ();\r
-               }\r
-\r
-               public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) \r
-               {\r
-                       if (string.Compare ("GET", method, true) == 0 ||\r
-                               string.Compare ("HEAD", method, true) == 0 ||\r
-                               string.Compare ("CONNECT", method, true) == 0)\r
-                               throw new ProtocolViolationException ("Cannot send a content-body with this verb-type.");\r
-                       lock (this) {\r
-                               if (asyncResponding || webResponse != null)\r
-                                       throw new InvalidOperationException ("This operation cannot be performed after the request has been submitted.");\r
-                               if (requesting)\r
-                                       throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");\r
-                               requesting = true;\r
-                       }\r
-                       GetRequestStreamCallback c = new GetRequestStreamCallback (this.GetRequestStreamInternal);\r
-                       return c.BeginInvoke (callback, state);\r
-               }\r
-               \r
-               public override Stream EndGetRequestStream (IAsyncResult asyncResult)\r
-               {\r
-                       if (asyncResult == null)\r
-                               throw new ArgumentNullException ("asyncResult");\r
-                       if (!asyncResult.IsCompleted)\r
-                               asyncResult.AsyncWaitHandle.WaitOne ();\r
-                       AsyncResult async = (AsyncResult) asyncResult;\r
-                       GetRequestStreamCallback cb = (GetRequestStreamCallback) async.AsyncDelegate;\r
-                       return cb.EndInvoke (asyncResult);\r
-               }\r
-\r
-               public override Stream GetRequestStream()\r
-               {\r
-                       IAsyncResult asyncResult = BeginGetRequestStream (null, null);\r
-                       if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {\r
-                               throw new WebException("The request timed out", WebExceptionStatus.Timeout);\r
-                       }\r
-                       return EndGetRequestStream (asyncResult);\r
-               }\r
-               \r
-               internal Stream GetRequestStreamInternal ()\r
-               {\r
-                       this.requestStream = new FileWebStream (\r
-                                               this,\r
-                                               FileMode.Create,\r
-                                               FileAccess.Write, \r
-                                               FileShare.Read);\r
-                       return this.requestStream;\r
-               }\r
-               \r
-               public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)\r
-               {\r
-                       lock (this) {\r
-                               if (asyncResponding)\r
-                                       throw new InvalidOperationException ("Cannot re-call start of asynchronous method while a previous call is still in progress.");\r
-                               asyncResponding = true;\r
-                       }\r
-                       GetResponseCallback c = new GetResponseCallback (this.GetResponseInternal);\r
-                       return c.BeginInvoke (callback, state);\r
-               }\r
-               \r
-               public override WebResponse EndGetResponse (IAsyncResult asyncResult)\r
-               {\r
-                       if (asyncResult == null)\r
-                               throw new ArgumentNullException ("asyncResult");\r
-                       if (!asyncResult.IsCompleted)\r
-                               asyncResult.AsyncWaitHandle.WaitOne ();\r
-                       AsyncResult async = (AsyncResult) asyncResult;\r
-                       GetResponseCallback cb = (GetResponseCallback) async.AsyncDelegate;\r
-                       FileWebResponse webResponse = (FileWebResponse) cb.EndInvoke(asyncResult);\r
-                       asyncResponding = false;\r
-                       if (webResponse.HasError)\r
-                               throw webResponse.Error;\r
-                       return webResponse;\r
-               }\r
-               \r
-               public override WebResponse GetResponse ()\r
-               {\r
-                       IAsyncResult asyncResult = BeginGetResponse (null, null);\r
-                       if (!(asyncResult.AsyncWaitHandle.WaitOne (timeout, false))) {\r
-                               throw new WebException("The request timed out", WebExceptionStatus.Timeout);\r
-                       }\r
-                       return EndGetResponse (asyncResult);\r
-               }\r
-               \r
-               WebResponse GetResponseInternal ()\r
-               {\r
-                       if (webResponse != null)\r
-                               return webResponse;\r
-                       lock (this) {\r
-                               if (requesting) {\r
-                                       requestEndEvent = new AutoResetEvent (false);\r
-                               }\r
-                       }\r
-                       if (requestEndEvent != null) {\r
-                               requestEndEvent.WaitOne ();\r
-                       }\r
-                       FileStream fileStream = null;\r
-                       try {\r
-                               fileStream = new FileWebStream (this, FileMode.Open, FileAccess.Read, FileShare.Read);\r
-                               this.webResponse = new FileWebResponse (this.uri, fileStream);\r
-                       } catch (Exception ex) {\r
-                               this.webResponse = new FileWebResponse (this.uri, new WebException (ex.Message, ex));\r
-                       }\r
-                       return this.webResponse;\r
-               }\r
-               \r
-               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       GetObjectData (serializationInfo, streamingContext);\r
-               }\r
-\r
-               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-                       info.AddValue ("headers", webHeaders, typeof (WebHeaderCollection));\r
-                       info.AddValue ("proxy", proxy, typeof (IWebProxy));\r
-                       info.AddValue ("uri", uri, typeof (Uri));\r
-                       info.AddValue ("connectionGroupName", connectionGroup);\r
-                       info.AddValue ("method", method);\r
-                       info.AddValue ("contentLength", contentLength);\r
-                       info.AddValue ("timeout", timeout);\r
-                       info.AddValue ("fileAccess", fileAccess);\r
-                       info.AddValue ("preauthenticate", false);\r
-               }\r
-               \r
-               internal void Close ()\r
-               {\r
-                       // already done in class below\r
-                       // if (requestStream != null) {\r
-                       //      requestStream.Close ();\r
-                       // }\r
-\r
-                       lock (this) {\r
-                               requesting = false;\r
-                               if (requestEndEvent != null) \r
-                                       requestEndEvent.Set ();\r
-                               // requestEndEvent = null;\r
-                       }\r
-               }\r
-               \r
-               // to catch the Close called on the FileStream\r
-               internal class FileWebStream : FileStream\r
-               {\r
-                       FileWebRequest webRequest;\r
-                       \r
-                       internal FileWebStream (FileWebRequest webRequest,    \r
-                                               FileMode mode,\r
-                                               FileAccess access,\r
-                                               FileShare share)\r
-                               : base (webRequest.RequestUri.LocalPath, \r
-                                       mode, access, share)\r
-                       {\r
-                               this.webRequest = webRequest;\r
-                       }\r
-                       \r
-                       public override void Close() \r
-                       {\r
-                               base.Close ();\r
-                               FileWebRequest req = webRequest;\r
-                               webRequest = null;\r
-                               if (req != null)\r
-                                       req.Close ();\r
-                       }\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/class/System/System.Net/FileWebRequestCreator.cs b/mcs/class/System/System.Net/FileWebRequestCreator.cs
deleted file mode 100644 (file)
index 06601bb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// System.Net.FileWebRequestCreator
-//
-// Authors:
-//     Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//
-// (C) 2003 Ximian, Inc (http://www.ximian.com)
-//
-
-//
-// 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.
-//
-
-namespace System.Net
-{
-       class FileWebRequestCreator : IWebRequestCreate
-       {
-               internal FileWebRequestCreator ()
-               {
-               }
-
-               public WebRequest Create (Uri uri)
-               {
-                       return new FileWebRequest (uri);
-               }
-       }
-}
-
diff --git a/mcs/class/System/System.Net/FileWebResponse.cs b/mcs/class/System/System.Net/FileWebResponse.cs
deleted file mode 100644 (file)
index 3d8ca21..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-//\r
-// System.Net.FileWebResponse\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       [Serializable]\r
-       public class FileWebResponse : WebResponse, ISerializable, IDisposable\r
-       {\r
-               private Uri responseUri;\r
-               private FileStream fileStream;\r
-               private long contentLength;\r
-               private WebHeaderCollection webHeaders;\r
-               private bool disposed;\r
-               Exception exception;\r
-               \r
-               // Constructors\r
-               \r
-               internal FileWebResponse (Uri responseUri, FileStream fileStream)\r
-               {\r
-                       try {\r
-                               this.responseUri = responseUri;\r
-                               this.fileStream = fileStream;\r
-                               this.contentLength = fileStream.Length;\r
-                               this.webHeaders = new WebHeaderCollection ();\r
-                               this.webHeaders.Add ("Content-Length", Convert.ToString (contentLength));\r
-                               this.webHeaders.Add ("Content-Type", "application/octet-stream");\r
-                       } catch (Exception e) {\r
-                               throw new WebException (e.Message, e);\r
-                       }\r
-               }\r
-\r
-               internal FileWebResponse (Uri responseUri, WebException exception)\r
-               {\r
-                       this.responseUri = responseUri;\r
-                       this.exception = exception;\r
-               }\r
-               \r
-               [Obsolete ("Serialization is obsoleted for this type", false)]\r
-               protected FileWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-\r
-                       responseUri = (Uri) info.GetValue ("responseUri", typeof (Uri));\r
-                       contentLength = info.GetInt64 ("contentLength");\r
-                       webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection));\r
-               }\r
-               \r
-               // Properties\r
-               internal bool HasError {\r
-                       get { return exception != null; }\r
-               }\r
-\r
-               internal Exception Error {\r
-                       get { return exception; }\r
-               }\r
-               \r
-               public override long ContentLength {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.contentLength;\r
-                       }\r
-               }\r
-               \r
-               public override string ContentType {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return "application/octet-stream";\r
-                       }\r
-               }\r
-               \r
-               public override WebHeaderCollection Headers {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.webHeaders;\r
-                       }\r
-               }\r
-               \r
-               public override Uri ResponseUri {\r
-                       get {\r
-                               CheckDisposed ();\r
-                               return this.responseUri;\r
-                       }\r
-               }\r
-\r
-               // Methods\r
-\r
-               void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       GetObjectData (serializationInfo, streamingContext);\r
-               }\r
-\r
-               protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
-               {\r
-                       SerializationInfo info = serializationInfo;\r
-\r
-                       info.AddValue ("responseUri", responseUri, typeof (Uri));\r
-                       info.AddValue ("contentLength", contentLength);\r
-                       info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));\r
-               }\r
-\r
-               public override Stream GetResponseStream()\r
-               {\r
-                       CheckDisposed ();\r
-                       return this.fileStream;\r
-               }\r
-                               \r
-               // Cleaning up stuff\r
-               \r
-               ~FileWebResponse ()\r
-               {\r
-                       Dispose (false);\r
-               }               \r
-               \r
-               public override void Close()\r
-               {\r
-                       ((IDisposable) this).Dispose ();\r
-               }\r
-\r
-               void IDisposable.Dispose()\r
-               {\r
-                       Dispose (true);\r
-                       \r
-                       // see spec, suppress finalization of this object.\r
-                       GC.SuppressFinalize (this);  \r
-               }\r
-               \r
-               protected override\r
-               void Dispose (bool disposing)\r
-               {\r
-                       if (this.disposed)\r
-                               return;\r
-                       this.disposed = true;\r
-                       \r
-                       if (disposing) {\r
-                               // release managed resources\r
-                               this.responseUri = null;\r
-                               this.webHeaders = null;\r
-                       }\r
-                       \r
-                       // release unmanaged resources\r
-                       FileStream stream = fileStream;\r
-                       fileStream = null;\r
-                       if (stream != null)\r
-                               stream.Close (); // also closes webRequest\r
-                       base.Dispose (disposing);\r
-               }\r
-               \r
-               private void CheckDisposed ()\r
-               {\r
-                       if (disposed)\r
-                               throw new ObjectDisposedException (GetType ().FullName);\r
-               }               \r
-       }\r
-}\r
index 967a4eb0fafacd31913ede4d5ac739008cbf08a0..77b6e27aed7409a67e1c36c7e29d513005d7e131 100644 (file)
@@ -186,10 +186,10 @@ namespace System.Net
                        if (!IsHeaderValue (headerValue))
                                throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
                        
-                       AddValue (headerName, headerValue);
+                       AddInternal (headerName, headerValue);
                }
                        
-               internal void AddValue (string headerName, string headerValue)
+               internal void AddInternal (string headerName, string headerValue)
                {
                        base.Add (headerName, headerValue);                     
                }
index 889398ee6a42e98ae3341c4acb1df004b575da89..fd450c86653173ba5279441972e3d338e341400b 100644 (file)
@@ -60,6 +60,8 @@ namespace System.Net
                static IWebProxy defaultWebProxy;
                static RequestCachePolicy defaultCachePolicy;
 
+               internal const int DefaultTimeout = 100000;
+
                static WebRequest ()
                {
 #if MOBILE
@@ -454,12 +456,11 @@ namespace System.Net
 
                void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
                {
-                       throw new NotSupportedException ();
+                       GetObjectData(serializationInfo, streamingContext);
                }
 
                protected virtual void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
                {
-                       throw GetMustImplement ();
                }
 
                public static bool RegisterPrefix (string prefix, IWebRequestCreate creator)
@@ -543,6 +544,5 @@ namespace System.Net
                {
                        return Task<WebResponse>.Factory.FromAsync (BeginGetResponse, EndGetResponse, null);
                }
-
        }
 }
index 48bbc5c80cb3555bb6a21ca06179e8d968a04900..ba0986b2035ac00c61d527e4975edd6331287b77 100644 (file)
@@ -257,9 +257,6 @@ System.Net/DnsPermission.cs
 System.Net/EndPointListener.cs
 System.Net/EndPointManager.cs
 System.Net/EndpointPermission.cs
-System.Net/FileWebRequestCreator.cs
-System.Net/FileWebRequest.cs
-System.Net/FileWebResponse.cs
 System.Net/FtpAsyncResult.cs
 System.Net/FtpDataStream.cs
 System.Net/FtpRequestCreator.cs
@@ -998,6 +995,8 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/UriScheme.cs
 
 ../referencesource/System/net/System/Net/_BufferOffsetSize.cs
+../referencesource/System/net/System/Net/_IStreams.cs
+../referencesource/System/net/System/Net/_NetRes.cs
 ../referencesource/System/net/System/Net/_LazyAsyncResult.cs
 ../referencesource/System/net/System/Net/_LoggingObject.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
@@ -1011,6 +1010,8 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/DnsEndPoint.cs
 ../referencesource/System/net/System/Net/EndPoint.cs
 ../referencesource/System/net/System/Net/FtpStatusCode.cs
+../referencesource/System/net/System/Net/filewebrequest.cs
+../referencesource/System/net/System/Net/filewebresponse.cs
 ../referencesource/System/net/System/Net/HttpListenerException.cs
 ../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs
 ../referencesource/System/net/System/Net/HttpRequestHeader.cs
@@ -1038,6 +1039,7 @@ ReferenceSources/_SslStream.cs
 ../referencesource/System/net/System/Net/webclient.cs
 ../referencesource/System/net/System/Net/WebException.cs
 ../referencesource/System/net/System/Net/WebExceptionStatus.cs
+../referencesource/System/net/System/Net/WebHeaderCollection.cs
 ../referencesource/System/net/System/Net/WebPermission.cs
 ../referencesource/System/net/System/Net/WebRequestMethods.cs
 ../referencesource/System/net/System/Net/WebResponse.cs
index 8d6ee23de6e57f4c6979715142c2ed79318f3d65..6793d2a48fdeffefa3c47d532c664f915bcc4330 100644 (file)
@@ -660,7 +660,7 @@ namespace MonoTests.System.Net
                                Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#3");
                                Assert.IsNotNull (ex.Message, "#4");
                                Assert.IsNotNull (ex.ParamName, "#5");
-                               Assert.IsFalse (ex.ParamName == "value", "#6");
+                               Assert.AreEqual ("value", ex.ParamName, "#6");
                                Assert.IsNull (ex.InnerException, "#7");
                        }
                }
index 510c164483230db77713431a3c7898d22ac5a34e..8a8c3f43f2d3918c4addfa6f8edde6cda4be7b5a 100644 (file)
@@ -176,9 +176,6 @@ System.Net/Dns.cs
 System.Net/EndPointListener.cs
 System.Net/EndPointManager.cs
 System.Net/EndpointPermission.cs
-System.Net/FileWebRequest.cs
-System.Net/FileWebRequestCreator.cs
-System.Net/FileWebResponse.cs
 System.Net/FtpAsyncResult.cs
 System.Net/FtpDataStream.cs
 System.Net/FtpRequestCreator.cs
@@ -710,6 +707,8 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/UriScheme.cs
 
 ../referencesource/System/net/System/Net/_BufferOffsetSize.cs
+../referencesource/System/net/System/Net/_IStreams.cs
+../referencesource/System/net/System/Net/_NetRes.cs
 ../referencesource/System/net/System/Net/_LazyAsyncResult.cs
 ../referencesource/System/net/System/Net/_LoggingObject.cs
 ../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs
@@ -723,6 +722,8 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/DnsEndPoint.cs
 ../referencesource/System/net/System/Net/EndPoint.cs
 ../referencesource/System/net/System/Net/FtpStatusCode.cs
+../referencesource/System/net/System/Net/filewebrequest.cs
+../referencesource/System/net/System/Net/filewebresponse.cs
 ../referencesource/System/net/System/Net/HttpListenerException.cs
 ../referencesource/System/net/System/Net/HttpRequestHeader.cs
 ../referencesource/System/net/System/Net/HttpResponseHeader.cs
@@ -750,6 +751,7 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/net/System/Net/webclient.cs
 ../referencesource/System/net/System/Net/WebException.cs
 ../referencesource/System/net/System/Net/WebExceptionStatus.cs
+../referencesource/System/net/System/Net/WebHeaderCollection.cs
 ../referencesource/System/net/System/Net/WebPermission.cs
 ../referencesource/System/net/System/Net/WebRequestMethods.cs
 ../referencesource/System/net/System/Net/WebResponse.cs
index 19948efa34ef8728e2e23ed5445d988eec9f5dad..ed21d04c067364c498645e520e98bbd381dc695d 100644 (file)
@@ -981,7 +981,6 @@ namespace System.Net {
             }
         }
 
-#if MONO_FEATURE_WEB_STACK
         internal static WebException IsolatedException {
             get {
                 return new WebException(NetRes.GetWebStatusString("net_requestaborted", WebExceptionStatus.KeepAliveFailure),WebExceptionStatus.KeepAliveFailure, WebExceptionInternalStatus.Isolated, null);
@@ -1005,7 +1004,6 @@ namespace System.Net {
                 return new WebException(NetRes.GetWebStatusString("net_requestaborted", WebExceptionStatus.RequestProhibitedByCachePolicy), WebExceptionStatus.RequestProhibitedByCachePolicy);
             }
         }
-#endif
     }
 
     internal enum WindowsInstallationType
@@ -1893,7 +1891,6 @@ typedef struct _SCHANNEL_CRED
         WriteWait = 2,
     }
 
-#if MONO_FEATURE_WEB_STACK
     //
     // HttpVerb - used to define various per Verb Properties
     //
@@ -1964,7 +1961,7 @@ typedef struct _SCHANNEL_CRED
         }
     }
 
-
+#if MONO_FEATURE_WEB_STACK
     //
     // HttpProtocolUtils - A collection of utility functions for HTTP usage.
     //
index 49bc92e0936c999f0079182efe604b6b6d3412f0..d1b49b2aafba20153d5f9b9c2bdd98f97fda7f49 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Net {
     using System.Globalization;
     using System.Security.Permissions;
     using System.Diagnostics.CodeAnalysis;
-
+#if !MONO
     internal enum WebHeaderCollectionType : ushort {
         Unknown,
         WebRequest,
@@ -1971,7 +1971,7 @@ quit:
                 m_InnerCollection.Clear();
         }
     } // class WebHeaderCollection
-
+#endif
 
     internal class CaseInsensitiveAscii : IEqualityComparer, IComparer{
         // ASCII char ToLower table
index 4ae8d5c7c05875839a2adcf8ed0a1a0a43e44522..0db05f3620e2fc500dfb3c0db05801c66b6bf99c 100644 (file)
@@ -246,9 +246,11 @@ namespace System.Net {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetRequestStream", exception);
                 throw;
             } finally {
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogBeginGetRequestStream(success, synchronous: false);
                 }
+#endif
                 GlobalLog.Leave("FileWebRequest::BeginGetRequestSteam");
             }
 
@@ -280,9 +282,11 @@ namespace System.Net {
                 if(Logging.On)Logging.Exception(Logging.Web, this, "BeginGetResponse", exception);
                 throw;
             } finally {
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogBeginGetResponse(success, synchronous: false);
                 }
+#endif
                 GlobalLog.Leave("FileWebRequest::BeginGetResponse");
             }
 
@@ -319,9 +323,11 @@ namespace System.Net {
                 throw;
             } finally {
                 GlobalLog.Leave("FileWebRequest::EndGetRequestStream");
+#if !MONO
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogEndGetRequestStream(success, synchronous: false);
                 }
+#endif
             }
 
             return stream;
@@ -355,10 +361,12 @@ namespace System.Net {
             } finally {
                 GlobalLog.Leave("FileWebRequest::EndGetResponse");
 
+#if !MONO
                 // there is no statusCode in FileWebRequest object, defaulting it to zero.
                 if (FrameworkEventSource.Log.IsEnabled()) {
                     LogEndGetResponse(success, synchronous: false, statusCode: 0);
                 }
+#endif
             }
 
             return response;