You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2014/03/19 21:56:39 UTC

[Bug 56286] New: mod_proxy_html sometimes adds random characters to HTML pages smaller than 4 bytes

https://issues.apache.org/bugzilla/show_bug.cgi?id=56286

            Bug ID: 56286
           Summary: mod_proxy_html sometimes adds random characters to
                    HTML pages smaller than 4 bytes
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_proxy_html
          Assignee: bugs@httpd.apache.org
          Reporter: micha@lenk.info

Created attachment 31409
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31409&action=edit
Skip documents smaller than 4 bytes

Apparently there is a bug that causes mod_proxy_html to add some random
characters (+html code) to the current document if the whole document is
smaller than 4 bytes. It looks like the output is from some kind of
uninitialized memory. The added string sometimes matches part of a previously
delivered request. Also, it looks like this only happens when doing multiple
HTTP requests with the same browser and using HTTP Keep Alive.

The root cause is that the charset guessing with xml2enc needs to consume at
least 4 bytes from the document to come to a conclusion. The consumed bytes are
buffered so that they can later get prepended to the output again. But
apparently it is assumed that there are always at least 4 bytes available,
which in some cases is not the case. In these cases the buffer may contain some
random bytes, probably left behind from the previous request on the same
connection.

The attached patch fixes that issue by simply skipping documents smaller than 4
bytes. The rationale behind this is, that for HTML rewriting to do something
useful, it needs to work on an absolute URL (i.e. including a schema). But as
the schema "http" is already 4 bytes, there would be nothing to rewrite.

The patch is based on httpd trunk, rev. 1579365.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 56286] mod_proxy_html sometimes adds random characters to HTML pages smaller than 4 bytes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56286

Nick Kew <ni...@webthing.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Nick Kew <ni...@webthing.com> ---
Thanks.  Fixed locally, will commit this evening.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 56286] mod_proxy_html sometimes adds random characters to HTML pages smaller than 4 bytes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56286

Micha Lenk <mi...@lenk.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org