You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Cris Webea <cr...@yahoo.com.ar> on 2009/02/05 18:59:48 UTC

[users@httpd] Fixed Content-Length using mod_ext_filter in mode=input

Hi, 

I wrote an input filter using mod_ext_filter. In the filter "implementation" I get the post data (from stdin) and modify it (to stdout) with no issues.. However, after changing the post data, the Content-Length of the request still has the original value. For instance: 

Original post data: param1=12345 with Content-Length: 12
Post data after filter: param1=abcdefghij with Content-Length: 12 

Then because the Content-Length is not changed, when the request post data is received after the filter, it will be truncated to the original Content-Length size (i.e. would get param1=abcde in the previous example). 

The filter implementation is a Java program (speed is not an issue), and this is how the filter definition looks: 

ExtFilterDefine filtername mode=input cmd="/path_to_java/java.exe -classpath /path_to_java_app com.my.program.Filter"

As you can see, I am not using the PreservesContentLength flag. Also, this is running on Windows XP, and using Apache 2.2.10 (I already verified and 2..2.11 does not mention anything like this in the release notes). 

Has anyone seen this behavior before? Do you think this could be a bug? (as supposedly, not using the PreservesContentLength flag should let the filter change the Content-Length). 

Any help is really appreciated. 

Regards, 

Cris. 



      Yahoo! Cocina
Recetas prácticas y comida saludable
http://ar.mujer.yahoo.com/cocina/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Fixed Content-Length using mod_ext_filter in mode=input

Posted by Cris Webea <cr...@yahoo.com.ar>.
Hi Nick, 

Thanks for your suggestion. I tried setting the Content-Length to an arbitrary value (I know, this is a kludge) and also to unset this header and in both cases it seemed to confuse Apache, as the post data was completely removed. Anyway, I will post this as a potential defect. 

Many thanks, 

Cris. 


--- El jue 5-feb-09, Nick Kew <ni...@webthing.com> escribió:

> De: Nick Kew <ni...@webthing.com>
> Asunto: Re: [users@httpd] Fixed Content-Length using mod_ext_filter in mode=input
> Para: users@httpd.apache.org
> Fecha: jueves, 5 de febrero de 2009, 3:23 pm
> On Thu, 5 Feb 2009 09:59:48 -0800 (PST)
> Cris Webea <cr...@yahoo.com.ar> wrote:
> 
> > Has anyone seen this behavior before? Do you think
> this could be a
> > bug? (as supposedly, not using the
> PreservesContentLength flag should
> > let the filter change the Content-Length). 
> 
> Sounds plausible, though the meaning of Content-Length gets
> fuzzy
> in the presence of your input filter.
> 
> As a quick-and-dirty workaround, you might be able to use
> mod_headers
> RequestHeader unset (or if you can get the new length,
> actually set it).
> 
> -- 
> Nick Kew
> 
> Application Development with Apache - the Apache Modules
> Book
> http://www.apachetutor.org/
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org


      Yahoo! Cocina
Recetas prácticas y comida saludable
http://ar.mujer.yahoo.com/cocina/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Fixed Content-Length using mod_ext_filter in mode=input

Posted by Nick Kew <ni...@webthing.com>.
On Thu, 5 Feb 2009 09:59:48 -0800 (PST)
Cris Webea <cr...@yahoo.com.ar> wrote:

> Has anyone seen this behavior before? Do you think this could be a
> bug? (as supposedly, not using the PreservesContentLength flag should
> let the filter change the Content-Length). 

Sounds plausible, though the meaning of Content-Length gets fuzzy
in the presence of your input filter.

As a quick-and-dirty workaround, you might be able to use mod_headers
RequestHeader unset (or if you can get the new length, actually set it).

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org