Bug 26446

Summary: flush buckets followed by eos bucket emit multiple last-chunks
Product: Apache httpd-2 Reporter: Alan Krueger <Alan_Krueger>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED LATER    
Severity: normal Keywords: MassUpdate
Priority: P3    
Version: 2.0.48   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Alan Krueger 2004-01-26 21:52:42 UTC
When an HTTP/1.1 connection to an ISAPI extension uses Keep-Alive and the 
output is written in Chunked Transfer-Encoding, multiple last-chunk markers 
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1) appear in the 
response.

This appears to be due to the isapi_handler appending both a flush bucket and 
an eos bucket on the brigade.  Another follows that, created by 
end_output_stream.  Since the eos bucket appears to drive the last-chunk 
marker, two are output in the response.

The symptoms for this vary by User-Agent, but in my situation the ISAPI 
extension is returning XML, where the extra last-chunk appears to be more 
noticeable.  Specifically, MSIE on Win2k and Mozilla on RH9 sometimes display 
the XML properly, other times they display the chunked response verbatim 
including previous leading last-chunk and the following response header as part 
of the response.  (MSIE actually just displays a 0 in those cases.)
Comment 1 Robert Olofsson 2005-01-08 20:12:40 UTC
I have seen multiple last-chunks from other web servers, not sure if it the same
problem. This came from a php-page. 

Multiple last-chunks causes my web proxy, rabbit, to read the extra last chunk
as the next http header in the keepalive stream. This results in broken images.
If I do not use a proxy mozilla seems to silently remove the extra last-chunk. 

I have a ethereal trace when this happens if anyone wants it. 

Seems to happen often, but non-deterministacally on http://www.eet.gr/
Comment 2 William A. Rowe Jr. 2006-06-22 07:20:09 UTC
Reclassified this because it's not always going to be possible for a module
author to know that a flush is ending the entire stream, depending on the
protocol they are trying to implement.

The eos bucket handler is gonna have to get a brain on this point, or else
the flush bucket handler is gonna have to learn not to flush nothing.

Either way the flaw is probably in the chunk protocol filter itself.
Comment 3 William A. Rowe Jr. 2006-06-22 07:26:36 UTC
Whoops, off to core with this.
Comment 4 Ruediger Pluem 2006-06-22 21:27:20 UTC
From my point of view this problem is independant of the flush bucket. I guess
we see this problem if pass the eos bucket twice thru the chunk filter in
different invocations (=> and in different brigades). I guess the possible
approach to solve this in the chunk filter is to remove the chunk filter from
the filter chain once we see an eos bucket in the chunk filter.
Comment 5 Joe Orton 2010-01-31 06:10:30 UTC
Why is this not simply a bug in whatever handler generated multiple EOS buckets?
Comment 6 William A. Rowe Jr. 2018-11-07 21:08:32 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.