[PATCH] mod_proxy_html deletes wrong data from HTML when meta http-equiv tag specifies Content-Type behind other meta http-equiv tag

2014-03-19 Thread Micha Lenk

Hi Apache developers,

over the time I've accumulated some patches for mod_proxy_html which I 
would like to get reviewed, and get applied in SVN (best both, trunk and 
then backported to 2.4). This is something that I feel to owe the Apache 
httpd community.


So, lets first start with a bug that lets mod_proxy_html delete the 
wrong data from HTML code when a http-equiv meta tag specifies a 
Content-Type behind any other http-equiv meta tag (Thomas, Ewald, this 
is issue #21648 in our Mantis). For better understanding of the issue, 
please consider the following HTML file treated by mod_proxy_html:


html
 head
  meta http-equiv=X-Dummy-Header content=dummy value
  style type=text/cssdiv.ok { color: green; }   /style
  meta http-equiv=Content-Type content=text/html; charset=utf8  
 head
 body
  div class=okIf the metafix is not broken, this text should get 
rendered in green color./div

 /body
/html

Without the attached patch, mod_proxy_html will remove the style tag 
inside the head tag as soon as it parses the meta tag with the 
http-equiv=Content-Type attribute. With the attached patch applied, 
mod_proxy_html removes the meta tag with the http-equiv=Content-Type 
attribute instead. I guess this is what the code intended to do.


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

Please provide feedback whether I should file an issue in Apaches 
Bugzilla or whether this isn't needed in this case.


Regards,
Micha
Index: modules/filters/mod_proxy_html.c
===
--- modules/filters/mod_proxy_html.c	(Revision 1579365)
+++ modules/filters/mod_proxy_html.c	(Arbeitskopie)
@@ -688,8 +688,8 @@
 }
 else if (!strncasecmp(header, Content-Type, 12)) {
 ret = apr_palloc(r-pool, sizeof(meta));
-ret-start = pmatch[0].rm_so;
-ret-end = pmatch[0].rm_eo;
+ret-start = offs+pmatch[0].rm_so;
+ret-end = offs+pmatch[0].rm_eo;
 }
 if (header  content) {
 #ifndef GO_FASTER


Re: [PATCH] mod_proxy_html deletes wrong data from HTML when meta http-equiv tag specifies Content-Type behind other meta http-equiv tag

2014-03-19 Thread Micha Lenk

Hi,

Just for the records, I've just filed this issue in ASF bugzilla as 
issue #56286.


Regards,
Micha


On 19.03.2014 20:40, Micha Lenk wrote:

Hi Apache developers,

over the time I've accumulated some patches for mod_proxy_html which I
would like to get reviewed, and get applied in SVN (best both, trunk and
then backported to 2.4). This is something that I feel to owe the Apache
httpd community.

So, lets first start with a bug that lets mod_proxy_html delete the
wrong data from HTML code when a http-equiv meta tag specifies a
Content-Type behind any other http-equiv meta tag (Thomas, Ewald, this
is issue #21648 in our Mantis). For better understanding of the issue,
please consider the following HTML file treated by mod_proxy_html:

html
  head
   meta http-equiv=X-Dummy-Header content=dummy value
   style type=text/cssdiv.ok { color: green; }   /style
   meta http-equiv=Content-Type content=text/html; charset=utf8  
  head
  body
   div class=okIf the metafix is not broken, this text should get
rendered in green color./div
  /body
/html

Without the attached patch, mod_proxy_html will remove the style tag
inside the head tag as soon as it parses the meta tag with the
http-equiv=Content-Type attribute. With the attached patch applied,
mod_proxy_html removes the meta tag with the http-equiv=Content-Type
attribute instead. I guess this is what the code intended to do.

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

Please provide feedback whether I should file an issue in Apaches
Bugzilla or whether this isn't needed in this case.

Regards,
Micha




Re: [PATCH] mod_proxy_html deletes wrong data from HTML when meta http-equiv tag specifies Content-Type behind other meta http-equiv tag

2014-03-19 Thread Micha Lenk

Hi again,

Err, #56287 that is.

Regards,
Micha

On 19.03.2014 22:05, Micha Lenk wrote:

Just for the records, I've just filed this issue in ASF bugzilla as
issue #56286.