Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@geoffkizer
Copy link

Fixes #39178
Contributes to #34460

Update many remote server tests to take a RemoteServer argument (instead of just server uri) and use CreateHttpClientForRemoteServer to set the HttpClient's DefaultRequestVersion property based on the definition of the RemoteServer.

Also, validate during request processing that we are sending the correct request version and receiving the expected response version.

Also, update some remote server tests to run against the HTTP2 remote server as well.

@geoffkizer geoffkizer added this to the 3.0 milestone Jul 9, 2019
@geoffkizer geoffkizer requested a review from a team July 9, 2019 22:29
@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidsh davidsh requested a review from stephentoub July 9, 2019 22:54
yield return new object[] {
remoteServer,
remoteServer.RedirectUriForDestinationUri(
statusCode:302,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add space after ":" for named parameters.

(comment applies to other places in the PR)

@davidsh
Copy link
Contributor

davidsh commented Jul 10, 2019

Windows 7 CI runs are failing with the HTTP/2.0 check. That's probably because Windows 7 doesn't support ALPN.

@geoffkizer
Copy link
Author

Yeah, makes sense. Will fix. Thanks.

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

@stephentoub Can you review?

{
using (HttpClient client = CreateHttpClient())
using (HttpResponseMessage response = await client.GetAsync(remoteServer))
using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This HttpClientHandlerTest class has derivations for both 1.1:

public sealed class SocketsHttpHandler_HttpClientHandlerTest : HttpClientHandlerTest

and 2.0:
public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Http2 : HttpClientHandlerTest

In conjunction with this remote server approach, that then means we're running the same tests more than we should be? e.g. for both the 1.1 and 2.0 derivations, we'll run both 1.1 and 2.0 tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. See #39345.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note also that since a bunch of the tests in HttpClientHandlerTest are 1.1-loopback based (not generic loopback), we're also running these tests twice for 1.1, since in the "2.0" derivation they still run as 1.1.

The "2.0" derivation really means "use the 2.0 loopback server". It would be nice to clarify this, but it's not urgent.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than my two comments/questions, LGTM. Thanks.

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

I'm seeing an assert in the certificate code on Linux. Seems to be happening for both CurlHandler and SocketsHttpHandler. @bartonjs any idea what's going on here?

Process terminated. Assertion failed.
Unrecognized X509VerifyStatusCode:44
   at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.MapVerifyErrorToChainStatus(X509VerifyStatusCode code) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs:line 819
   at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.AddElementStatus(X509VerifyStatusCode errorCode, List`1 elementStatus, List`1 overallStatus) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs:line 703
   at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.AddElementStatus(ErrorCollection errorCodes, List`1 elementStatus, List`1 overallStatus) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs:line 694
   at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.BuildChainElements(WorkingChain workingChain, List`1& overallStatus) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs:line 599
   at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.Finish(OidCollection applicationPolicy, OidCollection certificatePolicy) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs:line 393
   at Internal.Cryptography.Pal.ChainPal.BuildChain(Boolean useMachineContext, ICertificatePal cert, X509Certificate2Collection extraStore, OidCollection applicationPolicy, OidCollection certificatePolicy, X509RevocationMode revocationMode, X509RevocationFlag revocationFlag, DateTime verificationTime, TimeSpan timeout) in /_/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/ChainPal.cs:line 99
   at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate, Boolean throwOnException) in /_/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs:line 118
   at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate) in /_/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs:line 105
   at System.Net.Security.CertificateValidation.BuildChainAndVerifyProperties(X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, String hostName) in /_/src/Common/src/System/Net/Security/CertificateValidation.Unix.cs:line 18
   at System.Net.CertificateValidationPal.VerifyCertificateProperties(SafeDeleteContext securityContext, X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, Boolean isServer, String hostName) in /_/src/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs:line 22
   at System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback, ProtocolToken& alertToken) in /_/src/System.Net.Security/src/System/Net/Security/SecureChannel.cs:line 1010
   at System.Net.Security.SslStream.CompleteHandshake(ProtocolToken& alertToken) in /_/src/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs:line 754

Unfortuately, it's not obvious which test is causing this. Likely it's an existing test that didn't run over SSL before, but does now because of HTTP2.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

Interestingly, we're still hitting the same assert even with the code I added to try to skip cert validation on Linux for the HTTP2 endpoint.

I don't see anything wrong with the code I added, so this would seem to imply that we see this even with HTTP/1.1 over SSL. Not sure what to make of this. There must be a test that wasn't running over SSL before and now is, and it's hitting this assert. But all the tests are running against the same endpoint, so I have no idea why it would cause this assert now.

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@geoffkizer geoffkizer force-pushed the enableremotetestsforhttp2 branch from 4bb8441 to 0aea825 Compare July 14, 2019 00:20
@geoffkizer
Copy link
Author

/azp run corefx-outerloop-windows

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run corefx-outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@geoffkizer
Copy link
Author

Failures are unrelated

@geoffkizer geoffkizer merged commit 6ec67c1 into dotnet:master Jul 16, 2019
wtgodbe pushed a commit to dotnet-maestro-bot/corefx that referenced this pull request Jul 16, 2019
…ttp2

ensure remote server HTTP2 tests are actually using HTTP2
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…stsforhttp2

ensure remote server HTTP2 tests are actually using HTTP2

Commit migrated from dotnet/corefx@6ec67c1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP2: Many HTTP2 remote server tests are not actually using HTTP2

4 participants