Merge pull request #409 from Alkarex/patch-1
[mono.git] / mcs / class / System / System.Net / WebConnectionStream.cs
index a1876e63f573c008aa0eee70e2931c19bd9f7093..ff370e9e8ba78d1e6f6275a49b9f6cb34570def0 100644 (file)
@@ -70,6 +70,12 @@ namespace System.Net
 
                public WebConnectionStream (WebConnection cnc)
                {
+                       if (cnc.Data == null)
+                               throw new InvalidOperationException ("cnc.Data was not initialized");
+                       if (cnc.Data.Headers == null)
+                               throw new InvalidOperationException ("cnc.Data.Headers was not initialized");
+                       if (cnc.Data.request == null)
+                               throw new InvalidOperationException ("cnc.Data.request was not initialized");
                        isRead = true;
                        cb_wrapper = new AsyncCallback (ReadCallbackWrapper);
                        pending = new ManualResetEvent (true);
@@ -137,16 +143,11 @@ namespace System.Net
                internal WebConnection Connection {
                        get { return cnc; }
                }
-#if NET_2_0
                public override bool CanTimeout {
                        get { return true; }
                }
-#endif
 
-#if NET_2_0
-               public override
-#endif
-               int ReadTimeout {
+               public override int ReadTimeout {
                        get {
                                return read_timeout;
                        }
@@ -158,10 +159,7 @@ namespace System.Net
                        }
                }
 
-#if NET_2_0
-               public override
-#endif
-               int WriteTimeout {
+               public override int WriteTimeout {
                        get {
                                return write_timeout;
                        }
@@ -644,7 +642,10 @@ namespace System.Net
                        string method = request.Method;
                        bool no_writestream = (method == "GET" || method == "CONNECT" || method == "HEAD" ||
                                                method == "TRACE");
-                       if (sendChunked || cl > -1 || no_writestream) {
+                       bool webdav = (method == "PROPFIND" || method == "PROPPATCH" || method == "MKCOL" ||
+                                      method == "COPY" || method == "MOVE" || method == "LOCK" ||
+                                      method == "UNLOCK");
+                       if (sendChunked || cl > -1 || no_writestream || webdav) {
                                WriteHeaders ();
                                if (!initRead) {
                                        initRead = true;