You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@ -78,8 +78,11 @@ namespace System.Net.Http.Headers
|
||||
return v;
|
||||
|
||||
long l;
|
||||
if (content.TryComputeLength (out l))
|
||||
if (content.TryComputeLength (out l)) {
|
||||
// .net compatibility reading value actually set header property value
|
||||
SetValue ("Content-Length", l);
|
||||
return l;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ namespace System.Net.Http.Headers
|
||||
return (HttpHeaderValueCollection<T>) value.Parsed;
|
||||
}
|
||||
|
||||
void SetValue<T> (string name, T value, Func<object, string> toStringConverter = null)
|
||||
internal void SetValue<T> (string name, T value, Func<object, string> toStringConverter = null)
|
||||
{
|
||||
headers[name] = new HeaderBucket (value, toStringConverter);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ using System.IO;
|
||||
|
||||
namespace System.Net.Http
|
||||
{
|
||||
public class HttpClient : HttpMessageInvoker
|
||||
public partial class HttpClient : HttpMessageInvoker
|
||||
{
|
||||
static readonly TimeSpan TimeoutDefault = TimeSpan.FromSeconds (100);
|
||||
|
||||
@ -44,10 +44,12 @@ namespace System.Net.Http
|
||||
long buffer_size;
|
||||
TimeSpan timeout;
|
||||
|
||||
#if !XAMARIN_MODERN
|
||||
public HttpClient ()
|
||||
: this (new HttpClientHandler (), true)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public HttpClient (HttpMessageHandler handler)
|
||||
: this (handler, true)
|
||||
|
@ -66,7 +66,7 @@ namespace System.Net.Http
|
||||
|
||||
public string ReasonPhrase {
|
||||
get {
|
||||
return reasonPhrase ?? HttpListenerResponse.GetStatusDescription ((int) statusCode);
|
||||
return reasonPhrase ?? HttpListenerResponseHelper.GetStatusDescription ((int) statusCode);
|
||||
}
|
||||
set {
|
||||
reasonPhrase = value;
|
||||
|
@ -997,8 +997,8 @@ namespace MonoTests.System.Net.Http
|
||||
public void GetString_Many ()
|
||||
{
|
||||
var client = new HttpClient ();
|
||||
var t1 = client.GetStringAsync ("http://www.google.com");
|
||||
var t2 = client.GetStringAsync ("http://www.google.com");
|
||||
var t1 = client.GetStringAsync ("http://example.org");
|
||||
var t2 = client.GetStringAsync ("http://example.org");
|
||||
Assert.IsTrue (Task.WaitAll (new [] { t1, t2 }, WaitTimeout));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MonoTests.System.Net.Http
|
||||
{
|
||||
@ -327,6 +328,15 @@ namespace MonoTests.System.Net.Http
|
||||
Assert.AreEqual ("Content-MD5: AwU=\r\n", headers.ToString (), "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Headers_ContentLength ()
|
||||
{
|
||||
var content = new StreamContent (new MemoryStream (Encoding.UTF8.GetBytes ("test")));
|
||||
Assert.AreEqual ("", content.Headers.ToString ());
|
||||
var length = content.Headers.ContentLength;
|
||||
Assert.AreEqual ("Content-Length: 4\r\n", content.Headers.ToString ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Headers_Invalid ()
|
||||
{
|
||||
|
Reference in New Issue
Block a user