Am 2019-11-13 um 17:48 schrieb Christopher Schultz:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Michael,

On 11/9/19 05:58, micha...@apache.org wrote:
This is an automated email from the ASF dual-hosted git
repository.

michaelo pushed a commit to branch master in repository
https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this
push: new ccd6518  Fix test fallout of BZ 63905 ccd6518 is
described below

commit ccd6518024ab4f8c0add42eb2b20941a6b237f5d Author: Michael
Osipov <micha...@apache.org> AuthorDate: Sat Nov 9 11:35:22 2019
+0100

Fix test fallout of BZ 63905 ---
test/org/apache/coyote/http2/TestHttp2InitialConnection.java | 2
+- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java
index 2157eae..a362a19 100644 ---
a/test/org/apache/coyote/http2/TestHttp2InitialConnection.java +++
b/test/org/apache/coyote/http2/TestHttp2InitialConnection.java @@
-127,7 +127,7 @@ public class TestHttp2InitialConnection extends
Http2TestBase { int statusHeaderLength = sm
.getString("errorReportValve.statusHeader", "", "")
.getBytes(StandardCharsets.UTF_8).length; -            int len =
1073 + serverInfoLength + statusHeaderLength * 2; +            int
len = 708 + serverInfoLength + statusHeaderLength * 2;

Why not fix this properly with:

int len =
org.apache.catalina.util.TomcatCSS.TOMCAT_CSS.getBytes(StandardCharsets.
UTF_8).length
+ serverInfoLength + statusHeaderLength * 2;

??

Thanks for raising, but simply this won't work. You have to calculate the length of:

<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 
{font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr 
class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, 
invalid request message framing, or deceptive request routing).</p><hr class="line" /><h3>Apache Tomcat/9.0.x-dev</h3></body></html>

What confuses me here for the test, why is

> sm.getString("errorReportValve.statusHeader", "", "")

performed instead of getting the real strings for HTTP 400?!
If you remove all calculatable bits and add them on the code, you have left:

<!doctype html><html lang="en"><head><title></title><style type="text/css"></style></head><body><h1></h1><hr class="line" /><p><b></b> 
</p><p><b></b> </p><hr class="line" /><h3></h3></body></html>

So one should add 196 static bytes.

I will look into it.

Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to