You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mi...@apache.org on 2019/11/09 10:58:16 UTC

[tomcat] branch master updated: Fix test fallout of BZ 63905

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 <mi...@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;
             String contentLength = String.valueOf(len);
             return getResponseBodyFrameTrace(streamId,
                     testData.getExpectedStatus(), "text/html;charset=utf-8",


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


Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

Posted by Michael Osipov <mi...@apache.org>.
Am 2019-11-13 um 17:48 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Michael,
> 
> On 11/9/19 05:58, michaelo@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 <mi...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

Posted by Michael Osipov <mi...@apache.org>.
Am 2019-11-13 um 17:48 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Michael,
> 
> On 11/9/19 05:58, michaelo@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 <mi...@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;
> 
> ??
> 
> It's just going to happen again when someone changes the CSS.

I have now pushed a change which should address this properly.


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


Re: [tomcat] branch master updated: Fix test fallout of BZ 63905

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Michael,

On 11/9/19 05:58, michaelo@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 <mi...@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;

??

It's just going to happen again when someone changes the CSS.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3MM/kACgkQHPApP6U8
pFhkUw//VSKrL5DFR+mtxdDlzsPmnMWYJQ6hKNfuuq6borShwI9smOIBaUmnBWWu
jmA+qWJ0zoQaWwOsc0mmixDzMO1Ck5/B5HVdWcwtSlif1YUK7MSEqlCIELkwvqgA
TYxiA6CLf4SQc7X3cipZvhqJQ+5tVBjS9Irc3tQ86p6Ojly3h83c3gAAKncYXLWO
nI07wIUI5uC8jh/s5lmq0fUcIvmWgwzU4vOEH2ZvCPDnfja5HYfp3JOMPkwUXD43
/FP/dewd/trDy2vYBu0StKn6Ft0fhVQzXCvMDzWUVdyMJGHUQ+gh3D4rCwpRs0p4
X1lI6pogK0GNE1mtokNcqtkIg6W4z8QWGyKK0i2zFsk3gaVLoV5K0Bhoao3LUvZ/
oFSJnQaYdhe7QQrftkXw0NlEdMKkt6kHVMbiV/GSlvcL8ERH8mBlyIUfEKLIb43n
3iXxaJqTnFXYjYqiRiZezZxHhB2OyEs3eCshxP4lxSXmL8HQOEHnAvwadW16xwA4
WDYaL31AeYqxl206ku2fQFCm5Lb+Gt6EEI9wHXc9g+oLgzcw8aLo4zr/0FgWq5US
TxcjgNfJqSF65a86oLvwx1BE545FPFctgck/lXVcKTVYgeDsfgr6V8S2cif0812H
3Tf5RtHVsmUEsML2+Ge3kIfObZioqCCaeBwdQxLE4NNkKHgfKzs=
=RvAv
-----END PGP SIGNATURE-----

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