Unbreak the build
[mono.git] / mcs / class / System / System.Net / FileWebRequest.cs
index 6cf6b3babfff504da521333be8c643577f7c2ad2..08c2d00c075b9294fe7e5872e8a5d11ddf619eda 100644 (file)
@@ -64,6 +64,9 @@ namespace System.Net
                        this.webHeaders = new WebHeaderCollection ();\r
                }\r
                \r
+#if NET_2_0\r
+               [Obsolete ("Serialization is obsoleted for this type", false)]\r
+#endif\r
                protected FileWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) \r
                {\r
                        SerializationInfo info = serializationInfo;\r
@@ -159,12 +162,40 @@ namespace System.Net
                                timeout = value;\r
                        }\r
                }\r
+\r
+#if NET_2_0\r
+               public override bool UseDefaultCredentials\r
+               {\r
+                       get {\r
+                               throw new NotSupportedException ();\r
+                       }\r
+                       set {\r
+                               throw new NotSupportedException ();\r
+                       }\r
+               }\r
+#endif\r
                \r
                // Methods\r
                \r
                private delegate Stream GetRequestStreamCallback ();\r
                private delegate WebResponse GetResponseCallback ();\r
 \r
+#if NET_2_0\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
+#endif\r
+\r
                public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) \r
                {\r
                        if (string.Compare ("GET", method, true) == 0 ||\r
@@ -231,8 +262,10 @@ namespace System.Net
                                asyncResult.AsyncWaitHandle.WaitOne ();\r
                        AsyncResult async = (AsyncResult) asyncResult;\r
                        GetResponseCallback cb = (GetResponseCallback) async.AsyncDelegate;\r
-                       WebResponse webResponse = cb.EndInvoke(asyncResult);\r
+                       FileWebResponse webResponse = (FileWebResponse) cb.EndInvoke(asyncResult);\r
                        asyncResponding = false;\r
+                       if (webResponse.HasError)\r
+                               throw webResponse.Error;\r
                        return webResponse;\r
                }\r
                \r
@@ -259,16 +292,23 @@ namespace System.Net
                        }\r
                        FileStream fileStream = null;\r
                        try {\r
-                               fileStream = new FileWebStream (this, FileMode.Open,\r
-                                FileAccess.Read, FileShare.Read);\r
+                               fileStream = new FileWebStream (this, FileMode.Open, FileAccess.Read, FileShare.Read);\r
+                               this.webResponse = new FileWebResponse (this.uri, fileStream);\r
                        } catch (Exception ex) {\r
-                               throw new WebException (ex.Message, ex);\r
+                               this.webResponse = new FileWebResponse (this.uri, new WebException (ex.Message, ex));\r
                        }\r
-                       this.webResponse = new FileWebResponse (this.uri, fileStream);\r
-                       return (WebResponse) this.webResponse;\r
+                       return this.webResponse;\r
                }\r
                \r
                void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
+               {\r
+                       GetObjectData (serializationInfo, streamingContext);\r
+               }\r
+\r
+#if NET_2_0\r
+               protected override\r
+#endif\r
+               void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)\r
                {\r
                        SerializationInfo info = serializationInfo;\r
                        info.AddValue ("headers", webHeaders, typeof (WebHeaderCollection));\r