Bug 66483 - Garbled characters when accessing SSI via HTTP/2 with RewriteRule
Summary: Garbled characters when accessing SSI via HTTP/2 with RewriteRule
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_http2 (show other bugs)
Version: 2.4.55
Hardware: Other Linux
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-21 02:43 UTC by kanai3id
Modified: 2023-10-23 07:34 UTC (History)
0 users



Attachments
File/Directory Configuration (4.50 KB, application/x-tar)
2023-02-21 02:43 UTC, kanai3id
Details
Error log with LogLevel of http2:trace2 (26.40 KB, text/plain)
2023-02-21 11:04 UTC, kanai3id
Details
Log with H2CopyFiles on (30.07 KB, text/plain)
2023-02-21 22:28 UTC, kanai3id
Details
Display of garbled characters. (12.59 KB, image/png)
2023-10-23 00:37 UTC, kanai3id
Details
Garbled characters are displayed correctly. (14.39 KB, image/png)
2023-10-23 00:37 UTC, kanai3id
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kanai3id 2023-02-21 02:43:47 UTC
Created attachment 38499 [details]
File/Directory Configuration

Hello

I am reporting garbled characters when accessing https with RewriteRule and SSI in the following environment.
* The problem occurs when HTTP/2 is enabled in Apache HTTPD 2.4.55, but the garbled characters do not occur when HTTP/2 is disabled.
* There was no problem with HTTP/2 enabled in Apache HTTPD 2.4.54.

Environment
OS : CentOS Linux release 7.9.2009
Apache : httpd-2.4.55
HTTP/2 : nghttp2-1.52.0
OpenSSL : openssl-1.1.1t

* SSL configuration (HTTP/2 enabled)
SSLEngine On
Protocols h2 http/1.1

File/Directory Configuration : DocumentRoot
/.htaccess
/dev/test.html
/dev/include.inc
(File is attached)

* Garbled characters when accessing via https
https://xx.xx.xx.xx/test.html
== Result displayed in web browser
'³QLÉO.©,

The file is displayed without garbled characters in Apache 2.4.54

* Garbled characters do not occur when accessing with http
== Result displayed in web browser
test
Hello include
hello
Comment 1 Stefan Eissing 2023-02-21 09:24:37 UTC
I added a test for this at <https://github.com/icing/mod_h2/blob/master/test/modules/http2/test_007_ssi.py>
and there it behaves as it should. No garbling.

Could you specify the config around this in more detail? Also, an error log with 'LogLevel http2:trace2' would be helpful.

Thanks!
Comment 2 kanai3id 2023-02-21 11:04:13 UTC
Created attachment 38501 [details]
Error log with LogLevel of http2:trace2
Comment 3 kanai3id 2023-02-21 11:05:59 UTC
Thanks for your support, it is much appreciated.

Attached is the error.log when LogLevel is set to http2:trace2. (I have changed the IP address of the access source to xxx)

Best regards.
Comment 4 kanai3id 2023-02-21 11:11:49 UTC
I have an additional question.

I am not familiar with the core or test code of Apache HTTPD, but is RewriteRule in the test code?

If it is a normal SSI, it is not a problem. The garbled characters occur when the following RewriteRule conditions are present.

Thank you in advance.

----
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/dev/
RewriteRule ^(.*) /dev/$1
Comment 5 Stefan Eissing 2023-02-21 19:40:18 UTC
Thanks for the rewrite config. I am still unable to reproduce on my dev machine. 

The thing that is new in the module is the handling of mmap'ed file content. Can you check if adding

H2CopyFiles on

makes a difference for you?
Comment 6 kanai3id 2023-02-21 22:28:58 UTC
Created attachment 38502 [details]
Log with H2CopyFiles on
Comment 7 kanai3id 2023-02-21 22:36:04 UTC
I set H2CopyFiles on but it did not change.
Please check the error_log_H2CopyFiles_on.log also attached.

(I configured H2CopyFiles on to Apache httpd 2.4.54, built with the same configure options, and there were no garbled characters here.)

Best regards.
Comment 8 kanai3id 2023-03-08 10:52:51 UTC
Hello.

Apahe 2.4.56 has been released. It may be unrelated, but mod_http2 fix was included and I checked it, but it did not improve.

I took a wild guess and "LoadModule" mod_http2.so from Apache 2.4.54 from Apache 2.4.55 and the garbled characters were fixed. This was also improved in Apache 2.4.56. Naturally, I will not use it in a production environment, but I will report back.

best regards,
Comment 9 kanai3id 2023-10-23 00:37:04 UTC
Created attachment 39172 [details]
Display of garbled characters.
Comment 10 kanai3id 2023-10-23 00:37:56 UTC
Created attachment 39173 [details]
Garbled characters are displayed correctly.
Comment 11 kanai3id 2023-10-23 00:42:59 UTC
Hello.

I confirmed that this problem was resolved with httpd2.4.58+nghttp2-1.57.0.

Before: httpd2.4.57+nghttp2-1.55.1.png
After : httpd2.4.58+nghttp2-1.57.0.png

I am not sure what change in the httpd 2.4.58 version solved the problem, but I am reporting it just in case.

best regards,
Comment 12 Stefan Eissing 2023-10-23 07:34:17 UTC
Thanks for reporting back!