You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
@ -4,11 +4,16 @@ include ../../build/rules.make
|
||||
|
||||
LIBRARY = System.Net.Http.WebRequest.dll
|
||||
|
||||
LIB_REFS = System.Net.Http System
|
||||
LIB_REFS = System.Net.Http System System.Core
|
||||
KEYFILE = ../msfinal.pub
|
||||
LIB_MCS_FLAGS =
|
||||
|
||||
TEST_MCS_FLAGS =
|
||||
TEST_LIB_REFS = System.Net.Http
|
||||
TEST_MCS_FLAGS = -d:WEBREQUEST_HANDLER
|
||||
TEST_LIB_REFS = System System.Core System.Net.Http System.Net.Http.WebRequest
|
||||
|
||||
ifndef SOCKETSHTTPHANDLER
|
||||
TEST_MCS_FLAGS += -d:LEGACY_HTTPCLIENT
|
||||
LIB_MCS_FLAGS += -d:LEGACY_HTTPCLIENT
|
||||
endif
|
||||
|
||||
include ../../build/library.make
|
||||
|
@ -1,3 +1,5 @@
|
||||
../../build/common/Consts.cs
|
||||
../../build/common/MonoTODOAttribute.cs
|
||||
Assembly/AssemblyInfo.cs
|
||||
System.Net.Http.WebRequest/WebRequestHandler.cs
|
||||
../System.Net.Http/MonoWebRequestHandler.cs
|
@ -24,141 +24,83 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Net.Cache;
|
||||
using System.Net.Security;
|
||||
using System.Security.Principal;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Net.Http
|
||||
{
|
||||
public class WebRequestHandler : HttpClientHandler
|
||||
{
|
||||
bool allowPipelining;
|
||||
RequestCachePolicy cachePolicy;
|
||||
AuthenticationLevel authenticationLevel;
|
||||
TimeSpan continueTimeout;
|
||||
TokenImpersonationLevel impersonationLevel;
|
||||
int maxResponseHeadersLength;
|
||||
int readWriteTimeout;
|
||||
RemoteCertificateValidationCallback serverCertificateValidationCallback;
|
||||
bool unsafeAuthenticatedConnectionSharing;
|
||||
X509CertificateCollection clientCertificates;
|
||||
MonoWebRequestHandler handler;
|
||||
|
||||
bool disposed;
|
||||
|
||||
public WebRequestHandler ()
|
||||
: this (new MonoWebRequestHandler ())
|
||||
{
|
||||
allowPipelining = true;
|
||||
authenticationLevel = AuthenticationLevel.MutualAuthRequested;
|
||||
cachePolicy = System.Net.WebRequest.DefaultCachePolicy;
|
||||
continueTimeout = TimeSpan.FromMilliseconds (350);
|
||||
impersonationLevel = TokenImpersonationLevel.Delegation;
|
||||
maxResponseHeadersLength = HttpWebRequest.DefaultMaximumResponseHeadersLength;
|
||||
readWriteTimeout = 300000;
|
||||
serverCertificateValidationCallback = null;
|
||||
unsafeAuthenticatedConnectionSharing = false;
|
||||
clientCertificates = new X509CertificateCollection();
|
||||
}
|
||||
|
||||
WebRequestHandler (MonoWebRequestHandler handler)
|
||||
: base (handler)
|
||||
{
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public bool AllowPipelining {
|
||||
get { return allowPipelining; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
allowPipelining = value;
|
||||
}
|
||||
get => handler.AllowPipelining;
|
||||
set => handler.AllowPipelining = value;
|
||||
}
|
||||
|
||||
public RequestCachePolicy CachePolicy {
|
||||
get { return cachePolicy; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
cachePolicy = value;
|
||||
}
|
||||
get => handler.CachePolicy;
|
||||
set => handler.CachePolicy = value;
|
||||
}
|
||||
|
||||
public AuthenticationLevel AuthenticationLevel {
|
||||
get { return authenticationLevel; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
authenticationLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public X509CertificateCollection ClientCertificates {
|
||||
get {
|
||||
if (this.ClientCertificateOptions != ClientCertificateOption.Manual) {
|
||||
throw new InvalidOperationException("The ClientCertificateOptions property must be set to 'Manual' to use this property.");
|
||||
}
|
||||
|
||||
return clientCertificates;
|
||||
}
|
||||
get => handler.AuthenticationLevel;
|
||||
set => handler.AuthenticationLevel = value;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public TimeSpan ContinueTimeout {
|
||||
get { return continueTimeout; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
continueTimeout = value;
|
||||
}
|
||||
get => handler.ContinueTimeout;
|
||||
set => handler.ContinueTimeout = value;
|
||||
}
|
||||
|
||||
public TokenImpersonationLevel ImpersonationLevel {
|
||||
get { return impersonationLevel; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
impersonationLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxResponseHeadersLength {
|
||||
get { return maxResponseHeadersLength; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
maxResponseHeadersLength = value;
|
||||
}
|
||||
get => handler.ImpersonationLevel;
|
||||
set => handler.ImpersonationLevel = value;
|
||||
}
|
||||
|
||||
public int ReadWriteTimeout {
|
||||
get { return readWriteTimeout; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
readWriteTimeout = value;
|
||||
}
|
||||
get => handler.ReadWriteTimeout;
|
||||
set => handler.ReadWriteTimeout = value;
|
||||
}
|
||||
|
||||
public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
|
||||
get { return serverCertificateValidationCallback; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
serverCertificateValidationCallback = value;
|
||||
}
|
||||
get => handler.ServerCertificateValidationCallback;
|
||||
set => handler.ServerCertificateValidationCallback = value;
|
||||
}
|
||||
|
||||
public bool UnsafeAuthenticatedConnectionSharing {
|
||||
get { return unsafeAuthenticatedConnectionSharing; }
|
||||
set {
|
||||
EnsureModifiability ();
|
||||
unsafeAuthenticatedConnectionSharing = value;
|
||||
}
|
||||
get => handler.UnsafeAuthenticatedConnectionSharing;
|
||||
set => handler.UnsafeAuthenticatedConnectionSharing = value;
|
||||
}
|
||||
|
||||
internal override HttpWebRequest CreateWebRequest (HttpRequestMessage request)
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
HttpWebRequest wr = base.CreateWebRequest (request);
|
||||
|
||||
wr.Pipelined = allowPipelining;
|
||||
wr.AuthenticationLevel = authenticationLevel;
|
||||
wr.CachePolicy = cachePolicy;
|
||||
wr.ImpersonationLevel = impersonationLevel;
|
||||
wr.MaximumResponseHeadersLength = maxResponseHeadersLength;
|
||||
wr.ReadWriteTimeout = readWriteTimeout;
|
||||
wr.UnsafeAuthenticatedConnectionSharing = unsafeAuthenticatedConnectionSharing;
|
||||
wr.ServerCertificateValidationCallback = serverCertificateValidationCallback;
|
||||
|
||||
if (this.ClientCertificateOptions == ClientCertificateOption.Manual) {
|
||||
wr.ClientCertificates = clientCertificates;
|
||||
if (disposing && !disposed) {
|
||||
Volatile.Write (ref disposed, true);
|
||||
handler.Dispose ();
|
||||
handler = null;
|
||||
}
|
||||
|
||||
return wr;
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
../../test-helpers/NetworkHelpers.cs
|
||||
HttpClientTestHelpers.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/DelegatingHandlerTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/ByteArrayContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/FormUrlEncodedContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/HttpMethodTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/HttpRequestMessageTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/HttpResponseMessageTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/MultipartContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/MultipartFormDataContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/StreamContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http/StringContentTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/AuthenticationHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/CacheControlHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/ContentDispositionHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/ContentRangeHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/EntityTagHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/HttpHeadersTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/HttpHeaderValueCollection.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/HttpRequestHeadersTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/MediaTypeHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/MediaTypeWithQualityHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/NameValueHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/NameValueWithParametersHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/ProductHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/ProductInfoHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/RangeConditionHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/RangeHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/RangeItemHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/RetryConditionHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/StringWithQualityHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/TransferCodingHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/TransferCodingWithQualityHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/ViaHeaderValueTest.cs
|
||||
../../System.Net.Http/Test/System.Net.Http.Headers/WarningHeaderValueTest.cs
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace MonoTests.System.Net.Http
|
||||
{
|
||||
static class HttpClientTestHelpers
|
||||
{
|
||||
#if LEGACY_HTTPCLIENT
|
||||
internal static bool UsingSocketsHandler => false;
|
||||
#else
|
||||
internal static bool UsingSocketsHandler => true;
|
||||
#endif
|
||||
|
||||
internal static bool IsSocketsHandler (HttpClientHandler handler) => false;
|
||||
|
||||
internal static HttpClient CreateHttpClientWithHttpClientHandler ()
|
||||
{
|
||||
return new HttpClient (CreateHttpClientHandler ());
|
||||
}
|
||||
|
||||
internal static HttpClientHandler CreateHttpClientHandler ()
|
||||
{
|
||||
return new WebRequestHandler ();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user