Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions iocore/net/QUICNetVConnection_quiche.cc
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,32 @@ QUICNetVConnection::_handle_interval()
int
QUICNetVConnection::populate_protocol(std::string_view *results, int n) const
{
return 0;
int retval = 0;
if (n > retval) {
results[retval++] = IP_PROTO_TAG_QUIC;
if (n > retval) {
results[retval++] = IP_PROTO_TAG_TLS_1_3;
if (n > retval) {
retval += super::populate_protocol(results + retval, n - retval);
}
}
}
return retval;
}

const char *
QUICNetVConnection::protocol_contains(std::string_view tag) const
{
return "";
QUICNetVConnection::protocol_contains(std::string_view prefix) const
{
const char *retval = nullptr;
if (prefix.size() <= IP_PROTO_TAG_QUIC.size() && strncmp(IP_PROTO_TAG_QUIC.data(), prefix.data(), prefix.size()) == 0) {
retval = IP_PROTO_TAG_QUIC.data();
} else if (prefix.size() <= IP_PROTO_TAG_TLS_1_3.size() &&
strncmp(IP_PROTO_TAG_TLS_1_3.data(), prefix.data(), prefix.size()) == 0) {
retval = IP_PROTO_TAG_TLS_1_3.data();
} else {
retval = super::protocol_contains(prefix);
}
return retval;
}

const char *
Expand Down
3 changes: 3 additions & 0 deletions proxy/http/HttpTransactHeaders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,11 @@ HttpTransactHeaders::write_hdr_protocol_stack(char *hdr_string, size_t len, Prot
if (ProtocolStackDetail::Standard == pSDetail) {
*hdr++ = '/';
bool http_2_p = std::find(proto_buf, proto_end, IP_PROTO_TAG_HTTP_2_0) != proto_end;
bool http_3_p = std::find(proto_buf, proto_end, IP_PROTO_TAG_HTTP_3) != proto_end;
if (http_2_p) {
*hdr++ = '2';
} else if (http_3_p) {
*hdr++ = '3';
} else if (http_1_0_p) {
memcpy(hdr, "1.0", 3);
hdr += 3;
Expand Down
23 changes: 20 additions & 3 deletions tests/gold_tests/headers/via.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
Test.ContinueOnFail = True

# Define default ATS
ts = Test.MakeATSProcess("ts", enable_tls=True)
if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'):
ts = Test.MakeATSProcess("ts", enable_tls=True, enable_quic=True)
else:
ts = Test.MakeATSProcess("ts", enable_tls=True)


server = Test.MakeOriginServer("server", options={'--load': os.path.join(Test.TestDirectory, 'via-observer.py')})

testName = "VIA"
Expand Down Expand Up @@ -64,7 +69,10 @@

# Set up to check the output after the tests have run.
via_log_id = Test.Disk.File("via.log")
via_log_id.Content = "via.gold"
if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'):
via_log_id.Content = "via_h3.gold"
else:
via_log_id.Content = "via.gold"

# Basic HTTP 1.1
tr = Test.AddTestRun()
Expand All @@ -91,13 +99,22 @@

# HTTP 2
tr = Test.AddTestRun()
tr.Processes.Default.Command = 'curl --verbose --ipv4 --insecure --header "Host: www.example.com" https://localhost:{}'.format(
tr.Processes.Default.Command = 'curl --verbose --ipv4 --http2 --insecure --header "Host: www.example.com" https://localhost:{}'.format(
ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0

tr.StillRunningAfter = server
tr.StillRunningAfter = ts

# HTTP 3
if Condition.HasATSFeature('TS_HAS_QUICHE') and Condition.HasCurlFeature('http3'):
tr = Test.AddTestRun()
tr.Processes.Default.Command = 'curl --verbose --ipv4 --http3 --insecure --header "Host: www.example.com" https://localhost:{}'.format(
ts.Variables.ssl_port)
tr.Processes.Default.ReturnCode = 0
tr.StillRunningAfter = server
tr.StillRunningAfter = ts

# TLS
tr = Test.AddTestRun()
tr.Processes.Default.Command = 'curl --verbose --ipv4 --http1.1 --insecure --header "Host: www.example.com" https://localhost:{}'.format(
Expand Down
7 changes: 7 additions & 0 deletions tests/gold_tests/headers/via_h3.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Via: http/1.1 = http/1.1 tcp ipv4
Via: http/1.0 = http/1.0 tcp ipv4
Via: https/2 = http/1.1 h2 tls/1.{} tcp ipv4
Via: https/3 = http/1.1 h3 quic tls/1.{} udp ipv4
Via: https/1.1 = http/1.1 tls/1.{} tcp ipv4
Via: http/1.1 = http/1.1 tcp ipv6
Via: https/1.1 = http/1.1 tls/1.{} tcp ipv6