[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-patches
Subject:    [Mono-patches] r150582 -
From:       "Chris Toshok" <mono-patches-list () lists ! ximian ! com>
Date:       2010-01-29 23:52:37
Message-ID: 20100129235237.782CC9472C () mono-cvs ! ximian ! com
[Download RAW message or body]

Author: toshok
Date: 2010-01-29 18:52:37 -0500 (Fri, 29 Jan 2010)
New Revision: 150582

Modified:
   branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequest.cs
  branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequestInternal.cs
  branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/ChangeLog
 Log:
2010-01-13  Sebastien Pouliot  <sebastien@ximian.com>

	* BrowserHttpWebRequest.cs: Override CookieContainer (not to
	throw NIE) until the client stack is ready.
	* BrowserHttpWebRequestInternal.cs: Override CookieContainer
	(not to throw NIE) until the client stack is ready. Get the
	request data even when an ObjectDisposedException is thrown.
	Fix for DRT287

Modified: branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequest.cs
 ===================================================================
--- branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequest.cs	2010-01-29 \
                23:52:30 UTC (rev 150581)
+++ branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequest.cs	2010-01-29 \
23:52:37 UTC (rev 150582) @@ -71,6 +71,12 @@
 				async_result.Dispose ();
 		}
 
+		// FIXME: to be moved to client stack only - but needed for SL3 as long as we \
share a single stack +		public override CookieContainer CookieContainer {
+			get;
+			set;
+		}
+
 		public override IWebRequestCreate CreatorInstance { 
 			get { return WebRequestCreator.BrowserHttp; }
 		}

Modified: branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequestInternal.cs
 ===================================================================
--- branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequestInternal.cs	2010-01-29 \
                23:52:30 UTC (rev 150581)
+++ branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/BrowserHttpWebRequestInternal.cs	2010-01-29 \
23:52:37 UTC (rev 150582) @@ -80,6 +80,7 @@
 			method = wreq.Method;
 			request = wreq.request;
 			Headers = wreq.Headers;
+			CookieContainer = wreq.CookieContainer; // FIXME
 		}
 
 		~BrowserHttpWebRequestInternal () /* thread-safe: all p/invokes are thread-safe */
@@ -96,6 +97,12 @@
 				NativeMethods.event_object_unref (downloader); /* thread-safe */
 		}
 
+		// FIXME: to be moved to client stack only - but needed for SL3 as long as we \
share a single stack +		public override CookieContainer CookieContainer {
+			get;
+			set;
+		}
+
 		public override WebHeaderCollection Headers {
 			get {
 				if (headers == null)
@@ -290,9 +297,24 @@
 			if (native == IntPtr.Zero)
 				throw new NotSupportedException ("Failed to create unmanaged WebHttpRequest \
object.  unsupported browser.");  
-			if (request != null && request.Length > 1) {
+			long request_length = 0;
+			byte[] body = null;
+			try {
+				if (request == null) {
+					request_length = 0;
+				} else {
+					request_length = request.Length;
+					body = (request.InnerStream as MemoryStream).ToArray ();
+				}
+			}
+			catch (ObjectDisposedException) {
+				body = request.GetData ();
+				request_length = body.Length;
+			}
+
+			if (request_length > 1) {
 				// this header cannot be set directly inside the collection (hence the helper)
-				Headers.SetHeader ("content-length", (request.Length - 1).ToString ());
+				Headers.SetHeader ("content-length", (request_length - 1).ToString ());
 			}
 
 			if (CookieContainer != null && CookieContainer.Count > 0) {
@@ -304,8 +326,7 @@
 			foreach (string header in Headers.AllKeys)
 				NativeMethods.downloader_request_set_http_header (native, header, Headers \
[header]);  
-			if (request != null && request.Length > 1) {
-				byte [] body = (request.InnerStream as MemoryStream).ToArray ();
+			if (request_length > 1) {
 				NativeMethods.downloader_request_set_body (native, body, body.Length);
 			}
 			

Modified: branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/ChangeLog
 ===================================================================
--- branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/ChangeLog	2010-01-29 \
                23:52:30 UTC (rev 150581)
+++ branches/moon/moon-2-0/moon/class/System.Windows.Browser/System.Windows.Browser.Net/ChangeLog	2010-01-29 \
23:52:37 UTC (rev 150582) @@ -1,3 +1,12 @@
+2010-01-13  Sebastien Pouliot  <sebastien@ximian.com>
+
+	* BrowserHttpWebRequest.cs: Override CookieContainer (not to 
+	throw NIE) until the client stack is ready.
+	* BrowserHttpWebRequestInternal.cs: Override CookieContainer
+	(not to throw NIE) until the client stack is ready. Get the 
+	request data even when an ObjectDisposedException is thrown.
+	Fix for DRT287
+
 2010-01-12  Sebastien Pouliot  <sebastien@ximian.com>
 
 	* BrowserHttpWebRequest.cs: Override CreatorInstance property

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic