codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug 62955] New: HEAD request fail if GCI script do not return body part


https://bz.apache.org/bugzilla/show_bug.cgi?id=62955

            Bug ID: 62955
           Summary: HEAD request fail if GCI script do not return body
                    part
           Product: Apache httpd-2
           Version: 2.4.37
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: mod_http2
          Assignee: bugs@xxxxxxxxxxxxxxxx
          Reporter: vlado@xxxxxxxxxxx
  Target Milestone: ---

When perform http HEAD request against php CGI script, I receive PROTOCOL_ERROR
in case http/2 is used:

vlado@vladopc:~$ curl --http1.1 --head https://www.testurko.com/test/i.php
HTTP/1.1 200 OK
Date: Tue, 27 Nov 2018 11:15:13 GMT
Server: Apache
Upgrade: h2
Connection: Upgrade
Content-Type: text/html

vlado@vladopc:~$ curl --http2 --head https://www.testurko.com/test/i.php
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

Further investigation lead me to the way php respond to HEAD request: it sends
back only the header w/o the body part.
So I tried to reproduce this behavior with a simple perl script:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";

print "<html> <head>\n";
print "<title>Hello, world!</title>";
print "</head>\n";
print "<body>\n";
print "<h1>Hello, world!</h1>\n";
print "</body> </html>\n";

And both HEAD and GET requests work well via http/1.1 and http/2 until I
commented out the body part. 
Then the behavior become exactly the same as above:

# GET request:
vlado@vladopc:~$ curl --http2 https://www.testurko.com/test/i.pl

# HEAD requests:
vlado@vladopc:~$ curl --http2 --head https://www.testurko.com/test/i.pl
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

vlado@vladopc:~$ curl --http1.1 --head https://www.testurko.com/test/i.pl
HTTP/1.1 200 OK
Date: Tue, 27 Nov 2018 11:23:07 GMT
Server: Apache
Upgrade: h2
Connection: Upgrade
Content-Type: text/html

Further attempts to investigate the problem lead me to Output filters: If I set
any kind of output filter, the problem disappear. 
For example I tried both SetOutputFilter and AddOutputFilterByType in .htaccess
with INCLUDES and DEFLATE filters and no matter what kind of filter is applied,
the HEAD request via http/2 works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: bugs-help@xxxxxxxxxxxxxxxx