Uniden has asked for the wisdom of the Perl Monks concerning the following question:
My web server setup is: FreeBSD 10.0, Apache 2.4, Perl 5.16, HTML::Template::Pro 0.9510
After years of successfully using HTML::Template::Pro with FreeBSD 6.2, Apache 2.2 and Perl 5.x, I've recently moved everything to the stack named in the first line. Right after moving the Perl scripts over, I have noticed that some scripts did trigger following error in httpd:
[Tue Jul 08 09:37:26.169883 2014] [cgid:error] [pid 49924] [client x.x.x.x:59214] malformed header from script 'test.pl': Bad header: <!doctype html>First of all, all my scripts use HTML::Template::Pro. I tried this and that, thinking that the error is somewhere in the Perl scripts, but couldn't find the cause of the error. Then I saw that scripts calling smaller templates don't crash, while larger templates would trigger the above error. Then I simplified to the bone and created following Perl script 'test.pl':
..and the template 'test.tmpl':#!/usr/bin/perl use strict; use HTML::Template::Pro; my $tmpl = HTML::Template::Pro -> new(filename => 'test.tmpl'); print "Content-Type: text/html\n\n"; $tmpl -> output();
<!doctype html> <html> <body> <p>blah blah</p> </body> </html>
I ran test.pl and everything was fine, no error. Then I started adding a lot of blah blahs until the size of the template file size hit exactly 8,192 bytes, at which time it crashed with a 500 and with the above error logged in the httpd-error.log. If I delete a single character from the template file so it goes below 8K, the script runs again. I have absolutely no idea why this happens. By the way, large html files do not crash Apache, nor do Perl scripts printing html code directly (without HTML::Template::Pro. I tried both to the extreme, creating MBs of html code and wasn't able to crash anything at all.
I am not aware of any settings that I could change for HTML::Template::Pro. If anyone has an idea what I could do to prevent this from happening, I am all in for experiments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template::Pro - Issue with template files larger than 8K
by InfiniteSilence (Curate) on Jul 08, 2014 at 18:42 UTC | |
by Uniden (Initiate) on Jul 08, 2014 at 19:41 UTC | |
by Uniden (Initiate) on Jul 11, 2014 at 16:46 UTC | |
|
Re: HTML::Template::Pro - Issue with template files larger than 8K
by Anonymous Monk on Jul 08, 2014 at 18:32 UTC |