https://bz.apache.org/bugzilla/show_bug.cgi?id=60088
Bug ID: 60088
Summary: mod_ext_filter did not work if post body size larger
than 8192 bytes
Product: Apache httpd-2
Version: 2.4.6
Hardware: PC
OS: Linux
Status: NEW
Severity: major
Priority: P2
Component: mod_ext_filter
Assignee: [email protected]
Reporter: [email protected]
httpd.conf:
ExtFilterDefine MyInFilter mode=input cmd="/path/to/filters/request_filter.php"
<Location "/mywebapplication-url">
setInputFilter MyInFilter
ExtFilterOptions LogStderr
LimitRequestBody 0
</Location>
My filter code:
#!/usr/bin/php
<?php
function processFilter() {
$stdin = file_get_contents('php://stdin');
if (empty($stdin)) {
error_log("empty request");
return $stdin;
}
// do filter work here, do nothing for test
return $stdin;
}
error_log("Filter starts");
$before = microtime(true);
print(processFilter());
$after = microtime(true);
error_log("Filter needs: " . ($after-$before) ." s");
?>
If I post a request with data larger than 8192 bytes, my filter won't be called
and the request dies with an error:
[Tue Sep 06 09:58:09.470309 2016] [ext_filter:trace1] [pid 15343]
mod_ext_filter.c(629): [client 192.168.50.26:46497] filtering `/an-URL' of type
`(unspecified)' through `/path/to/filters/request_filter.php', cfg
ExtFilterOptions LogStderr !PreserveContentLength ExtFilterInType
application/x-www-form-urlencoded ExtFilterOuttype (unchanged), referer:
https://another-URL
[Tue Sep 06 09:58:09.470399 2016] [ext_filter:trace6] [pid 15343]
mod_ext_filter.c(807): (11)Resource temporarily unavailable: [client
192.168.50.26:46497] AH01466: apr_file_read(child output), len
18446744073709551615, referer: https://another-URL
[Tue Sep 06 09:58:09.470441 2016] [:error] [pid 15343] Sending error response:
The request contained fewer content data than specified by the content-length
header
I have recompiled the mod_ext_filter.c with a lot of log output and I found a
discrepancy in ef_unified_filter(), where the apr_bucket_read() gets only 8192
bytes, but the ef_input_filter() reads just before i.e. 9827 bytes from the
current brigade.
There is only one bucket within the brigade and the for-loop in
ef_unified_filter() runs therefore only once. The result is the different
content length from the error message, but at the moment I cannot find a
solution for that.
It is not a PHP-specific problem, I have tested it with a Bash-script filter
too. Also I have tested w/o LimitRequestBody.
--
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]