Bug 59744 - AH00717: Premature end of cache headers
Summary: AH00717: Premature end of cache headers
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache (show other bugs)
Version: 2.4.10
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-23 00:18 UTC by Raphaël Droz
Modified: 2018-10-10 19:22 UTC (History)
1 user (show)



Attachments
entity headers file after a GET (581 bytes, text/plain)
2016-06-23 00:18 UTC, Raphaël Droz
Details
entity headers file after a POST (158 bytes, text/plain)
2016-06-23 00:19 UTC, Raphaël Droz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raphaël Droz 2016-06-23 00:18:38 UTC
Created attachment 33975 [details]
entity headers file after a GET

Every once in a while I can see this error message popping-up in my logs:
> AH00717: Premature end of cache headers
So far I didn't see actual "bad" consequences other than the error message itself.

To reproduce it, it's enough to
POST twice to an already cached resource.

More information and guesses in this thread:
https://mail-archives.apache.org/mod_mbox/httpd-users/201606.mbox/%3C20160608171923.GA6425@debovo.drzraf.me%3E

Current best guess is that the first POST creates an invalid entity on which second POST hurts.
Background: When mod_cache is used, POST are expected to be ignored.
Since this commit:
https://github.com/apache/httpd/commit/dea98c9bf110c149e7e0af381221ba09fdc52d0c
This hunk was introduced:
> "PUT/POST/DELETE: Adding CACHE_INVALIDATE filter
although I couldn't spot more precisely what could be wrong.


Attached are the entity header file after a GET request, and then after the (cache invalidating) POST request.
Comment 1 Raphaël Droz 2016-06-23 00:19:49 UTC
Created attachment 33976 [details]
entity headers file after a POST
Comment 2 Breno Fernandes 2018-10-10 19:22:04 UTC
The bug also happens in Centos 7, fully updated on Apache 2.4.6.

Oct 10 14:33:29 xxxx httpd[9828]: [cache_disk:error] [pid 9828:tid 140256116471552] [client 127.0.0.1:35658] AH00717: Premature end of cache headers.

The bug is triggered when a cached GET is followed by two POSTs to the same URL.
For example: 

curl -i -X GET  https://example.com/javascript/server2.php => OK
curl -i -X POST https://example.com/javascript/server2.php => OK but not cached
curl -i -X POST https://example.com/javascript/server2.php => bug is triggered.

The second POST generates two error messages.