Skip to content

mod_cache_disk: preserve long cache metadata lines - #893

Open
tatikoma wants to merge 1 commit into
apache:trunkfrom
tatikoma:fix/cache-disk-long-lines
Open

tatikoma wants to merge 1 commit into
apache:trunkfrom
tatikoma:fix/cache-disk-long-lines

Conversation

@tatikoma

Copy link
Copy Markdown

Summary

mod_cache_disk serializes each cache metadata entry as one logical line. On recall, read_table() and read_array() used apr_file_gets() with a fixed buffer and parsed every returned chunk as a complete entry. A line longer than the buffer could therefore be split into multiple entries.

This change accumulates chunks through the terminating LF before parsing the line, for both response-header tables and Vary arrays. The regression primes a disk-cache entry with a response header spanning the old read boundary and verifies that recall preserves the complete value as one field.

Testing

  • Unpatched current trunk: existing cache test passed; new regression failed.
  • Patched current trunk: test/pytest_suite/tests/t/modules/test_cache.py — 2 passed.

  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases are included where appropriate.

Cache metadata is serialized as complete logical lines, but recall parsed each fixed-size read chunk as a separate line. Accumulate chunks through the terminating newline before parsing both header tables and Vary arrays.

Add a regression covering a cached response header that spans the previous read boundary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant