Merge pull request #2020 from tomjepp/master
[mono.git] / mcs / class / System / System.Net / WebResponse.cs
index 0018411b5bdf2336a7f5f96dd32f6e4829603432..f59b24fc1c38cfbe8e491a3db3fc8cf81f7d000a 100644 (file)
@@ -33,8 +33,7 @@ using System.Runtime.Serialization;
 namespace System.Net \r
 {\r
        [Serializable]\r
-       public abstract class WebResponse : MarshalByRefObject, ISerializable, IDisposable\r
-       {\r
+       public abstract class WebResponse : MarshalByRefObject, ISerializable, IDisposable {\r
                // Constructors\r
                \r
                protected WebResponse () { }\r
@@ -59,11 +58,41 @@ namespace System.Net
                public virtual WebHeaderCollection Headers {            \r
                        get { throw new NotSupportedException (); }\r
                }\r
+\r
+               static Exception GetMustImplement ()\r
+               {\r
+                       return new NotImplementedException ();\r
+               }\r
+               \r
+               [MonoTODO]\r
+               public virtual bool IsFromCache\r
+               {\r
+                       get {\r
+                               return false;\r
+                               // Better to return false than to kill the application\r
+                               // throw GetMustImplement ();\r
+                       }\r
+               }\r
+               \r
+               [MonoTODO]\r
+               public virtual bool IsMutuallyAuthenticated\r
+               {\r
+                       get {\r
+                               throw GetMustImplement ();\r
+                       }\r
+               }\r
                \r
                public virtual Uri ResponseUri {                \r
                        get { throw new NotSupportedException (); }\r
                }               \r
 \r
+               public virtual bool SupportsHeaders {\r
+                       get {\r
+                               // The managed stack always returns this as true, it is only\r
+                               // the Silverlight stack that does not support this.\r
+                               return true;\r
+                       }\r
+               }\r
                // Methods\r
                \r
                public virtual void Close()\r
@@ -75,23 +104,28 @@ namespace System.Net
                {\r
                        throw new NotSupportedException ();\r
                }\r
-#if TARGET_JVM //enable overrides for extenders\r
-               public virtual void Dispose()\r
-#else\r
-               void IDisposable.Dispose()\r
-#endif\r
+               public void Dispose ()\r
                {\r
-                       Close ();\r
+                       Dispose (true);\r
                }\r
-#if TARGET_JVM //enable overrides for extenders\r
-               public virtual void GetObjectData\r
-#else\r
+               \r
+               protected virtual void Dispose (bool disposing)\r
+               {\r
+                       if (disposing)\r
+                               Close ();\r
+               }\r
+\r
                void ISerializable.GetObjectData\r
-#endif\r
                        (SerializationInfo serializationInfo,\r
                                                  StreamingContext streamingContext)\r
                {\r
                        throw new NotSupportedException ();\r
-               }               \r
+               }\r
+\r
+               [MonoTODO]\r
+               protected virtual void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
+               {\r
+                       throw GetMustImplement ();\r
+               }\r
        }\r
 }\r