Re: mod_layout and dynamic images

Brian Aker <[email protected]> Mon, 30 Apr 2007 07:46:52 -0700
Newsgroups gmane.comp.apache.mod-layout
Message-ID <[email protected]>
Hi!

On Apr 30, 2007, at 12:26 AM, Aaz wrote:

> Seems that the following code fixes the problem. It should be added to
> layout_filter function.
>
> if (strstr(r->content_type,"image")!= NULL) {
>       return ap_pass_brigade(f->next, b);
> };

The problem with this solution is that it only looks at one type.

cfg->types is a list of all enabled mime_types. In 4.0 > only the URI  
is looked at. In 3.0 < It was a combination of URI and mime type. The  
reason I took this out in 4.0 was that mime type was not always set  
at the proper stage of execution (and if it wasn't then we ended up  
with a problem where more mime types had to be added/debugged).

I've not had a chance to test the solution I posted. When I do, or  
when someone else confirms, I'll whip up a test binary for anyone who  
wants to try it out.

Cheers,
	-Brian

>> Hello,
>>
>> I'd like to continue discussion about problem described
>> here
>> http://lists.tangent.org/pipermail/mod_layout/2007-February/ 
>> 002237.html
>> and here
>> http://lists.tangent.org/pipermail/mod_layout/2004-March/002069.html
>>
>> The problem is about dynamically changed Content-type header of the
>> output document.
>> For example:
>> <?php
>>     header("Content-Type: image/png");
>>     $string = $_GET['text'];
>>     $im     = imagecreate(300,300);
>>     $orange = imagecolorallocate($im, 220, 210, 60);
>>     $px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
>>     imagestring($im, 3, $px, 9, $string, $orange);
>>     imagepng($im);
>>     imagedestroy($im);
>> ?>
>>
>>
>> This script shouldnt be processed by mod_layout, but it is.
>> I have output_buffering=On in php.ini file, but it doesnt help.
>> I cant use LayoutIgnoreURI
>>
>> I'm using latest apache 2.2 and mod_layout 5.0.
>> Is there a way to avoid processing such scripts?
>> Maybe there's some workaround about this problem?
>> _______________________________________________
>> Mod_layout mailing list
>> [email protected]
>> http://lists.tangent.org/mailman/listinfo/mod_layout
>>
>>
>
> _______________________________________________
> Mod_layout mailing list
> [email protected]
> http://lists.tangent.org/mailman/listinfo/mod_layout