This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 9b282da16a Future proof remaining request builders
9b282da16a is described below

commit 9b282da16ac4a7e53a230f58ebf049a53cf0a36b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Apr 23 11:34:37 2026 +0100

    Future proof remaining request builders
---
 test/org/apache/coyote/http2/Http2TestBase.java | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index 8f20cece4f..93aa0a2085 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -224,7 +224,11 @@ public abstract class Http2TestBase extends TomcatBaseTest 
{
             String url) {
         List<Header> headers = new ArrayList<>(4);
         headers.add(new Header(":method", Method.GET));
-        headers.add(new Header(":scheme", "http"));
+        if (getTomcatInstance().getConnector().getSecure()) {
+            headers.add(new Header(":scheme", "https"));
+        } else {
+            headers.add(new Header(":scheme", "http"));
+        }
         headers.add(new Header(":path", url));
         headers.add(new Header(":authority", "localhost:" + getPort()));
 
@@ -262,7 +266,11 @@ public abstract class Http2TestBase extends TomcatBaseTest 
{
     protected void buildSimpleGetRequestPart1(byte[] frameHeader, ByteBuffer 
headersPayload, int streamId) {
         List<Header> headers = new ArrayList<>(3);
         headers.add(new Header(":method", Method.GET));
-        headers.add(new Header(":scheme", "http"));
+        if (getTomcatInstance().getConnector().getSecure()) {
+            headers.add(new Header(":scheme", "https"));
+        } else {
+            headers.add(new Header(":scheme", "http"));
+        }
         headers.add(new Header(":path", "/simple"));
 
         buildSimpleGetRequestPart1(frameHeader, headersPayload, headers, 
streamId);
@@ -455,7 +463,11 @@ public abstract class Http2TestBase extends TomcatBaseTest 
{
     protected void buildHeadRequest(byte[] headersFrameHeader, ByteBuffer 
headersPayload, int streamId, String path) {
         MimeHeaders headers = new MimeHeaders();
         headers.addValue(":method").setString(Method.HEAD);
-        headers.addValue(":scheme").setString("http");
+        if (getTomcatInstance().getConnector().getSecure()) {
+            headers.addValue(":scheme").setString("https");
+        } else {
+            headers.addValue(":scheme").setString("http");
+        }
         headers.addValue(":path").setString(path);
         headers.addValue(":authority").setString("localhost:" + getPort());
         hpackEncoder.encode(headers, headersPayload);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to