https://issues.apache.org/bugzilla/show_bug.cgi?id=56569

            Bug ID: 56569
           Summary: Null CRC in gzip footer with mod_cgid and
                    ErrorDocument
           Product: Apache httpd-2
           Version: 2.4.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_deflate
          Assignee: [email protected]
          Reporter: [email protected]

When using a CGI as an ErrorDocument, together with mod_deflate to compress the
response body, the CRC32 in the gzip footer may be null when the request also
contained a request body.

I'll attach a simple httpd.conf and Bash CGI script that I've reproduced the
issue with.  The issue is not unique to curl or Bash; it was originally
encountered with a Perl CGI and Java client code.

A hex dump of the response bodies shows that the second to last 32-bit word -
the CRC32 in the gzip footer - is null.  The responses are otherwise identical.

# Not working as expected - CRC is null
$ curl -s -HAccept-Encoding:gzip -XPOST -dbody http://localhost/cgi-bin/404 |
xxd
0000000: 1f8b 0800 0000 0000 0003 3dcb 310e 8020  ..........=.1..
0000010: 1044 d1de 538c 950d f134 5e40 7102 24c2  .D..S....4^@q.$.
0000020: 1a76 8972 7b8d 85c9 2fdf 5f62 52bc a964  .v.r{.../._bR..d
0000030: a224 4f18 6f83 09bc e4b3 52d5 a1af 7d04  .$O.o.....R...}.
0000040: 96c8 4ae4 a686 8d60 9116 e287 1d78 2891  ..J....`.....x(.
0000050: 0c97 94c9 1068 ffcc 7d1e 1e00 0000 0063  .....h..}......c
0000060: 0000 00                                  ...

# Working as expected
$ curl -s -HAccept-Encoding:gzip -XPOST -dbody
http://localhost/cgi-bin/test.cgi | xxd
0000000: 1f8b 0800 0000 0000 0003 3dcb 310e 8020  ..........=.1..
0000010: 1044 d1de 538c 950d f134 5e40 7102 24c2  .D..S....4^@q.$.
0000020: 1a76 8972 7b8d 85c9 2fdf 5f62 52bc a964  .v.r{.../._bR..d
0000030: a224 4f18 6f83 09bc e4b3 52d5 a1af 7d04  .$O.o.....R...}.
0000040: 96c8 4ae4 a686 8d60 9116 e287 1d78 2891  ..J....`.....x(.
0000050: 0c97 94c9 1068 ffcc 7d1e 1ee6 6eff 6b63  .....h..}...n.kc
0000060: 0000 00                                  ...


Oddly, in addition to the other conditions, the CRC is only null if the 404
occurs within the the cgi-bin directory (make-requests.sh will also be
attached):

$ bash ~/make-requests.sh
direct to CGI, with request body:
via 404 in cgi-bin, with request body:

gzip: stdin: invalid compressed data--crc error
via 404 outside cgi-bin, with request body:
via 404 in cgi-bin, without request body:

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to