Re: [users@httpd] Apache cgid:error for HTML::Template::Pro templates larger than 8k

2014-07-14 Thread Tom Phan
 or in HTML::Template::Pro and both 
mod_cgid/mod_cgi have an issue with it at 8k/4k.




 From: Jeff Trawick traw...@gmail.com
To: users@httpd.apache.org users@httpd.apache.org; Tom Phan 
yachtus-apa...@yahoo.com 
Sent: Saturday, July 12, 2014 4:53 PM
Subject: Re: [users@httpd] Apache cgid:error for HTML::Template::Pro templates 
larger than 8k
 


On Thu, Jul 10, 2014 at 11:20 AM, Tom Phan yachtus-apa...@yahoo.com.invalid 
wrote:

My web server: FreeBSD 10.0, Apache 2.4, Perl 5.16, HTML::Template::Pro 0.9510

When I try to run any perl script calling HTML::Template::Pro templates larger 
than 8,191 bytes, I get following error in httpd:

[cgid:error] malformed header from script 'test.pl': Bad header: !doctype 
html

Running the script from command line does produce the expected output and no 
error, so I am assuming the cause of the error is related to Apache.


Here is the simple perl script 'test.pl' that I tested with:

#!/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();

..and the HTML::Template::Pro template 'test.tmpl':

!doctype html
html
body
pblah blah/p
/body
/html

I ran test.pl in the browser and everything was fine at first, no error. Then 
I started adding a lot of blah blahs to the template file until the size of 
the template file 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 even 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.

If I switch to mod_cgi instead of mod_cgid, the error appears exactly when
 template file hits 4K in size. So it is 8K for mod_cgid and 4K for mod_cgi.

What is it in Apache that imposes such limits on the size of my templates and 
how can I lift/increase them?


Can you capture the output of the CGI process run under httpd at least up to 
the point of the !doctype html text?

I'd guess you are suffering from buffering somehow, and the threshhold is a 
different value with mod_cgid vs mod_cgi. 

--
Born in Roswell... married an alien...
http://emptyhammock.com/

[users@httpd] Apache cgid:error for HTML::Template::Pro templates larger than 8k

2014-07-10 Thread Tom Phan
My web server: FreeBSD 10.0, Apache 2.4, Perl 5.16, HTML::Template::Pro 0.9510
 
When I try to run any perl script calling HTML::Template::Pro templates larger 
than 8,191 bytes, I get following error in httpd:
 
[cgid:error] malformed header from script 'test.pl': Bad header: !doctype html
 
Running the script from command line (even with template files of several MBs 
in size) produces the expected output and no error, so I am suspecting that the 
cause of the error is related to Apache.
 
Here is the simple perl script 'test.pl' that I tested with:
 
#!/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();
 
..and the HTML::Template::Pro template 'test.tmpl':
 
!doctype html
html
 body
  pblah blah/p
 /body
/html
 
I ran test.pl in the browser and everything was fine at first, no error. Then I 
started adding a lot of blah blahs to the template file until the size of the 
template file 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 even 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.
 
If I switch to mod_cgi instead of mod_cgid, the error appears exactly when 
template file hits 4K in size. So it is 8K for mod_cgid and 4K for mod_cgi.
 
What is it in Apache that imposes such limits on the size of my templates and 
how can I lift/increase them?

[users@httpd] Apache cgid:error for HTML::Template::Pro templates larger than 8k

2014-07-10 Thread Tom Phan
My web server: FreeBSD 10.0, Apache 2.4, Perl 5.16, HTML::Template::Pro 0.9510

When I try to run any perl script calling HTML::Template::Pro templates larger 
than 8,191 bytes, I get following error in httpd:

[cgid:error] malformed header from script 'test.pl': Bad header: !doctype html

Running the script from command line does produce the expected output and no 
error, so I am assuming the cause of the error is related to Apache.

Here is the simple perl script 'test.pl' that I tested with:

#!/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();

..and the HTML::Template::Pro template 'test.tmpl':

!doctype html
html
body
pblah blah/p
/body
/html

I ran test.pl in the browser and everything was fine at first, no error. Then I 
started adding a lot of blah blahs to the template file until the size of the 
template file 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 even 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.

If I switch to mod_cgi instead of mod_cgid, the error appears exactly when 
template file hits 4K in size. So it is 8K for mod_cgid and 4K for mod_cgi.

What is it in Apache that imposes such limits on the size of my templates and 
how can I lift/increase them?