X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.Net%2FHttpWebRequest.cs;h=84d59f6802517fa65be1681fc9cf57f1d8940597;hb=157cb97206f627685c15410953d2767146f6e426;hp=4b8f5aaa6eb800394cc959ab0fa2ed26a146b3ec;hpb=033a2536df5c369edec36e86d707a326d838a8ff;p=mono.git diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs index 4b8f5aaa6eb..84d59f68025 100644 --- a/mcs/class/System/System.Net/HttpWebRequest.cs +++ b/mcs/class/System/System.Net/HttpWebRequest.cs @@ -46,12 +46,8 @@ using System.Threading; namespace System.Net { -#if MOONLIGHT - internal class HttpWebRequest : WebRequest, ISerializable { -#else [Serializable] public class HttpWebRequest : WebRequest, ISerializable { -#endif Uri requestUri; Uri actualUri; bool hostChanged; @@ -194,6 +190,13 @@ namespace System.Net get { return allowBuffering; } set { allowBuffering = value; } } + +#if NET_4_5 + public virtual bool AllowReadStreamBuffering { + get { return allowBuffering; } + set { allowBuffering = value; } + } +#endif static Exception GetMustImplement () { @@ -291,6 +294,9 @@ namespace System.Net set { continueDelegate = value; } } +#if NET_4_5 + virtual +#endif public CookieContainer CookieContainer { get { return cookieContainer; } set { cookieContainer = value; } @@ -309,10 +315,15 @@ namespace System.Net return DateTime.ParseExact (date, "r", CultureInfo.InvariantCulture).ToLocalTime (); } set { - webHeaders.RemoveAndAdd ("Date", value.ToUniversalTime ().ToString ("r", CultureInfo.InvariantCulture)); + if (value.Equals (DateTime.MinValue)) + webHeaders.RemoveInternal ("Date"); + else + webHeaders.RemoveAndAdd ("Date", value.ToUniversalTime ().ToString ("r", CultureInfo.InvariantCulture)); } } #endif + +#if !NET_2_1 [MonoTODO] public static new RequestCachePolicy DefaultCachePolicy { @@ -323,6 +334,7 @@ namespace System.Net throw GetMustImplement (); } } +#endif [MonoTODO] public static int DefaultMaximumErrorResponseLength @@ -355,6 +367,9 @@ namespace System.Net } } +#if NET_4_5 + virtual +#endif public bool HaveResponse { get { return haveResponse; } } @@ -396,9 +411,6 @@ namespace System.Net static bool CheckValidHost (string scheme, string val) { - if (val == null) - throw new ArgumentNullException ("value"); - if (val.Length == 0) return false; @@ -409,6 +421,10 @@ namespace System.Net if (idx >= 0) return false; + IPAddress ipaddr; + if (IPAddress.TryParse (val, out ipaddr)) + return true; + string u = scheme + "://" + val + "/"; return Uri.IsWellFormedUriString (u, UriKind.Absolute); } @@ -477,6 +493,14 @@ namespace System.Net } } +#if NET_4_5 + [MonoTODO] + public int ContinueTimeout { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } +#endif + public string MediaType { get { return mediaType; } set { @@ -560,7 +584,14 @@ namespace System.Net internal ServicePoint ServicePointNoLock { get { return servicePoint; } } - +#if NET_4_0 + [MonoTODO ("for portable library support")] + public virtual bool SupportsCookieContainer { + get { + throw new NotImplementedException (); + } + } +#endif public override int Timeout { get { return timeout; } set { @@ -758,6 +789,9 @@ namespace System.Net lock (locker) { + if (getResponseCalled) + throw new InvalidOperationException ("The operation cannot be performed once the request has been submitted."); + if (asyncWrite != null) { throw new InvalidOperationException ("Cannot re-call start of asynchronous " + "method while a previous call is still in progress."); @@ -825,10 +859,10 @@ namespace System.Net if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering) return; #if NET_4_0 - if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength <= 0) + if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength < 0) return; - if (contentLength < 0 && writeStream.WriteBufferLength > 0) + if (contentLength < 0 && writeStream.WriteBufferLength >= 0) InternalContentLength = writeStream.WriteBufferLength; #else if (contentLength < 0 && writeStream.CanWrite == true) @@ -1138,7 +1172,9 @@ namespace System.Net if (cookieContainer != null) { string cookieHeader = cookieContainer.GetCookieHeader (actualUri); if (cookieHeader != "") - webHeaders.SetInternal ("Cookie", cookieHeader); + webHeaders.RemoveAndAdd ("Cookie", cookieHeader); + else + webHeaders.RemoveInternal ("Cookie"); } string accept_encoding = null; @@ -1450,7 +1486,7 @@ namespace System.Net if (isProxy && (proxy == null || proxy.Credentials == null)) return false; - string [] authHeaders = response.Headers.GetValues ( (isProxy) ? "Proxy-Authenticate" : "WWW-Authenticate"); + string [] authHeaders = response.Headers.GetValues_internal ( (isProxy) ? "Proxy-Authenticate" : "WWW-Authenticate", false); if (authHeaders == null || authHeaders.Length == 0) return false;