Commit 6082f954 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Fix test for NTLM auth over H2: HttpNetworkTransactionTest.NTLMOverHttp2

The test was simulating the H2 server hanging up after sending an H2
challenge, and then negotiating a new H1 connection, regardless of
whether net/ tried to negotiate H2 or H1 when re-establishing the
connection. This CL keeps the H2 session open, and explicitly checks
that when re-establishing a connection, we only try to negotiate H1.

Bug: 996042
Change-Id: Icb2d0e39382f9173308582b19d836a9cd26f047f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762458
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarBence Béky <bnc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689020}
parent b1454413
...@@ -7573,18 +7573,9 @@ TEST_F(HttpNetworkTransactionTest, NTLMOverHttp2) { ...@@ -7573,18 +7573,9 @@ TEST_F(HttpNetworkTransactionTest, NTLMOverHttp2) {
ntlm::test::kExpectedAuthenticateMsgEmptyChannelBindingsV2)), ntlm::test::kExpectedAuthenticateMsgEmptyChannelBindingsV2)),
&authenticate_msg); &authenticate_msg);
// Retry with authorization header.
spdy::SpdyHeaderBlock request_headers1(
spdy_util_.ConstructGetHeaderBlock(kUrl));
request_headers1["authorization"] = std::string("NTLM ") + negotiate_msg;
spdy::SpdySerializedFrame request1(spdy_util_.ConstructSpdyHeaders(
3, std::move(request_headers1), LOWEST, true));
spdy::SpdySerializedFrame rst(
spdy_util_.ConstructSpdyRstStream(3, spdy::ERROR_CODE_HTTP_1_1_REQUIRED));
MockWrite writes0[] = {CreateMockWrite(request0, 0)}; MockWrite writes0[] = {CreateMockWrite(request0, 0)};
MockRead reads0[] = {CreateMockRead(resp, 1), MockRead(ASYNC, 0, 2)}; MockRead reads0[] = {CreateMockRead(resp, 1),
MockRead(SYNCHRONOUS, ERR_IO_PENDING, 2)};
// Retry yet again using HTTP/1.1. // Retry yet again using HTTP/1.1.
MockWrite writes1[] = { MockWrite writes1[] = {
...@@ -7627,7 +7618,11 @@ TEST_F(HttpNetworkTransactionTest, NTLMOverHttp2) { ...@@ -7627,7 +7618,11 @@ TEST_F(HttpNetworkTransactionTest, NTLMOverHttp2) {
SSLSocketDataProvider ssl0(ASYNC, OK); SSLSocketDataProvider ssl0(ASYNC, OK);
ssl0.next_proto = kProtoHTTP2; ssl0.next_proto = kProtoHTTP2;
ssl0.next_protos_expected_in_ssl_config =
NextProtoVector{kProtoHTTP2, kProtoHTTP11};
SSLSocketDataProvider ssl1(ASYNC, OK); SSLSocketDataProvider ssl1(ASYNC, OK);
// When creating the second connection, only HTTP/1.1 should be allowed.
ssl1.next_protos_expected_in_ssl_config = NextProtoVector{kProtoHTTP11};
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl0); session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl0);
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment