Summary: | apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed | ||
---|---|---|---|
Product: | APR | Reporter: | Barnim Dzwillo <dzwillo> |
Component: | APR-util | Assignee: | Apache Portable Runtime bugs mailinglist <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 1.6.1 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Attachments: |
Bugfix for the described issue in apr-util-1.6.1
Bugfix for the described issue in apr-trunk Simple test program to demonstrate the issue |
Created attachment 37129 [details]
Bugfix for the described issue in apr-trunk
Created attachment 37130 [details]
Simple test program to demonstrate the issue
Thanks for the patch! Merged in r1915658 with some minor tweaks. |
Created attachment 37128 [details] Bugfix for the described issue in apr-util-1.6.1 Hello, When the input for a apr_brigade_split_line() ends with a linefeed, an empty bucket will be left in the input brigade when the last input line was processed. In many cases this will lead to extra work for the caller, because the input brigade is not empty after the last line was processed. For example the httpd code has extra checks to remove empty buckets from a brigade in httpd/server/core_filters.c:ap_core_input_filter(), where the call to BRIGADE_NORMALIZE(b) will trigger more often. The attached patch fixes this issue for the current apr-util-1.6.1 library, and the other patch fixes this for the apr-trunk library. Also attached is a simple apr_splittest.c program to demonstrate the issue: test "aa aa\n": - output without patch: in bucket 00: start 6 length 0 IS_EMPTY! out bucket 00: start 0 length 6 - output with patch: in brigade empty out bucket 00: start 0 length 6 Greetings, Barnim