Skip Menu |

This queue is for tickets about the CGI-Prototype CPAN distribution.

Report information
The Basics
Id: 11870
Status: resolved
Worked: 2 hours (118 min)
Priority: 0/
Queue: CGI-Prototype

People
Owner: MERLYN [...] cpan.org
Requestors: robert [...] rlb3.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.90
Fixed in: (no value)



Subject: Bad header
Apache: 2.0.52 mod_perl: 1.999.21 perl: 5.8.6 OS: Fedora Core 3 I'm getting bad header error from CGI::Prototype. The exact error is: malformed header from script. Bad header=<!DOCTYPE html: index.pl, referer: http://localhost/perl/email/ /perl/email/index.pl did not send an HTTP header I have self.CGI.header in my wrapper.tt. Also I mosty get the error after I have submited a page. My mod_perl setup looks like: Perlrequire "conf/startup.pl" <Directory /data/web/perl> AddHandler perl-script .pl PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI </Directory>
[guest - Mon Mar 14 14:09:23 2005]: Show quoted text
> Apache: 2.0.52 > mod_perl: 1.999.21 > perl: 5.8.6 > OS: Fedora Core 3 > > I'm getting bad header error from CGI::Prototype. The exact error is: > > malformed header from script. Bad header=<!DOCTYPE html: index.pl, > referer: http://localhost/perl/email/ > > /perl/email/index.pl did not send an HTTP header > > I have self.CGI.header in my wrapper.tt. Also I mosty get the error > after I have submited a page. > > My mod_perl setup looks like: > > Perlrequire "conf/startup.pl" > <Directory /data/web/perl> > AddHandler perl-script .pl > PerlResponseHandler ModPerl::Registry > PerlOptions +ParseHeaders > Options +ExecCGI > </Directory> > >
Very likely you are sending out blank characters before your self.CGI.header(). That's bitten me once or twice too. Make sure you have no blank lines in WRAPPER.tt before your actual beginning of macros. Or, you can issue a "CLEAR" just before your header(), which throws away any prior output. I'll close this bug unless I hear back from you, and if you need additional assitance, please attach a working set of files that demonstrates the problem.
From: robert [...] rlb3.com
I'm still having the same problem even after the changes you suggested. I am sending you code examples in a tar.gz. Robert Boone [MERLYN - Tue Mar 15 09:21:36 2005]: Show quoted text
> [guest - Mon Mar 14 14:09:23 2005]: >
> > Apache: 2.0.52 > > mod_perl: 1.999.21 > > perl: 5.8.6 > > OS: Fedora Core 3 > > > > I'm getting bad header error from CGI::Prototype. The exact error
> is:
> > > > malformed header from script. Bad header=<!DOCTYPE html:
> index.pl,
> > referer: http://localhost/perl/email/ > > > > /perl/email/index.pl did not send an HTTP header > > > > I have self.CGI.header in my wrapper.tt. Also I mosty get the error > > after I have submited a page. > > > > My mod_perl setup looks like: > > > > Perlrequire "conf/startup.pl" > > <Directory /data/web/perl> > > AddHandler perl-script .pl > > PerlResponseHandler ModPerl::Registry > > PerlOptions +ParseHeaders > > Options +ExecCGI > > </Directory> > > > >
> > Very likely you are sending out blank characters before your > self.CGI.header(). That's bitten > me once or twice too. Make sure you have no blank lines in WRAPPER.tt > before your actual > beginning of macros. Or, you can issue a "CLEAR" just before your > header(), which throws > away any prior output. > > I'll close this bug unless I hear back from you, and if you need > additional assitance, please > attach a working set of files that demonstrates the problem.
Download WT.tar.gz
application/x-gzip 1.6k

Message body not shown because it is not plain text.

[guest - Tue Mar 15 10:02:20 2005]: Show quoted text
> I'm still having the same problem even after the changes you suggested. > I am sending you code examples in a tar.gz.
Thanks... I can't run that app. Can you reduce it down to something that doesn't need DBD::MySQL?
From: robert [...] rlb3.com
I think I've got it factored out into a sqlite2 db. I changed Data.pm to work with it. [MERLYN - Tue Mar 15 10:21:19 2005]: Show quoted text
> [guest - Tue Mar 15 10:02:20 2005]: >
> > I'm still having the same problem even after the changes you
> suggested.
> > I am sending you code examples in a tar.gz.
> > Thanks... I can't run that app. Can you reduce it down to something > that doesn't > need DBD::MySQL?
Download changes.tar.gz
application/x-gzip 928b

Message body not shown because it is not plain text.

[guest - Tue Mar 15 11:20:36 2005]: Show quoted text
> I think I've got it factored out into a sqlite2 db. I changed Data.pm to > work with it.
All I see are the db and a Data.pm file. Did you leave something out?
[MERLYN - Wed Mar 16 15:33:49 2005]: Show quoted text
> [guest - Tue Mar 15 11:20:36 2005]: >
> > I think I've got it factored out into a sqlite2 db. I changed Data.pm to > > work with it.
> > All I see are the db and a Data.pm file. Did you leave something out?
Ahh, nevermind. OK, can't reproduce the problem. Works fine for me. Closing this out unless you can give me something I can do that makes it break.
From: robert [...] rlb3.com
Sorry to keep bothering you about this. But I think I've found a way to reproduce the problem. The app will segfault under mod_perl1 or mod_perl2 is if MaxRequestsPerChild is greater than 1 and you run: ab -n 10 -c 2 http://localhost/perl/email/ Thank you for you patience. Robert Boone [MERLYN - Wed Mar 16 15:47:26 2005]: Show quoted text
> [MERLYN - Wed Mar 16 15:33:49 2005]: >
> > [guest - Tue Mar 15 11:20:36 2005]: > >
> > > I think I've got it factored out into a sqlite2 db. I changed
> Data.pm to
> > > work with it.
> > > > All I see are the db and a Data.pm file. Did you leave something
> out? > > Ahh, nevermind. OK, can't reproduce the problem. Works fine for me. > Closing this out > unless you can give me something I can do that makes it break.
From: robert [...] rlb3.com
Update: I overrode the CGI slot with: sub CGI { require CGI; CGI->new; } The problem goes away. Could there be an issue with the autoload feature of Class:: Prototyped and mod_perl? Robert Boone [guest - Sun Mar 20 05:46:20 2005]: Show quoted text
> Sorry to keep bothering you about this. But I think I've found a way > to reproduce the > problem. The app will segfault under mod_perl1 or mod_perl2 is if > MaxRequestsPerChild is > greater than 1 and you run: > ab -n 10 -c 2 http://localhost/perl/email/ > > Thank you for you patience. > Robert Boone > > > [MERLYN - Wed Mar 16 15:47:26 2005]: >
> > [MERLYN - Wed Mar 16 15:33:49 2005]: > >
> > > [guest - Tue Mar 15 11:20:36 2005]: > > >
> > > > I think I've got it factored out into a sqlite2 db. I changed
> > Data.pm to
> > > > work with it.
> > > > > > All I see are the db and a Data.pm file. Did you leave something
> > out? > > > > Ahh, nevermind. OK, can't reproduce the problem. Works fine for
> me.
> > Closing this out > > unless you can give me something I can do that makes it break.
>
[guest - Sun Mar 20 07:06:10 2005]: Show quoted text
> Update: I overrode the CGI slot with: > sub CGI { require CGI; CGI->new; } > > The problem goes away. Could there be an issue with the autoload > feature of Class:: > Prototyped and mod_perl?
Oh, Hmm. That does point to a problem. Yes, for mod_perl, you'll need to reinitialize the autoload on that variable. You don't want to call CGI->new on EVERY access, because that'll reinitialize it over and over and over even within a hit. Try this, and if it works, let me know, and I'll update the docs to say "for mod_perl, you'll want to do this": sub app_enter { my $self = shift; $self->reflect->addSlot([qw(CGI autoload)] => sub { CGI->new }); } Of course, if you have an existing app_enter, you'll have to add this to it.
I added the code to the WT::Email::App which the other pages uses as a base and got this error: ERROR: METHOD slots cannot have the 'autoload' attribute. at /data/web/perl/lib//WT/ Email/App.pm line 12 Robert Boone [MERLYN - Tue Mar 22 16:54:51 2005]: Show quoted text
> [guest - Sun Mar 20 07:06:10 2005]: >
> > Update: I overrode the CGI slot with: > > sub CGI { require CGI; CGI->new; } > > > > The problem goes away. Could there be an issue with the autoload > > feature of Class:: > > Prototyped and mod_perl?
> > Oh, Hmm. That does point to a problem. Yes, for mod_perl, you'll > need to reinitialize the > autoload on that variable. You don't want to call CGI->new on EVERY > access, because that'll > reinitialize it over and over and over even within a hit. > > Try this, and if it works, let me know, and I'll update the docs to > say "for mod_perl, you'll > want to do this": > > sub app_enter { > my $self = shift; > $self->reflect->addSlot([qw(CGI autoload)] => sub { CGI->new }); > } > > Of course, if you have an existing app_enter, you'll have to add this > to it.
From: robert [...] rlb3.com
I made one more change and it worked. From this: $self->reflect->addSlot([qw(CGI autoload)] => sub { CGI->new }); To this: $self->reflect->addSlot([qw(CGI FIELD autoload)] => sub { CGI->new }); This is more than likly what you meant anyway. Thank you... Robert Boone [guest - Tue Mar 22 20:04:49 2005]: Show quoted text
> I added the code to the WT::Email::App which the other pages uses as a > base and got this > error: > > ERROR: METHOD slots cannot have the 'autoload' attribute. at > /data/web/perl/lib//WT/ > Email/App.pm line 12 > > > Robert Boone > > [MERLYN - Tue Mar 22 16:54:51 2005]: >
> > [guest - Sun Mar 20 07:06:10 2005]: > >
> > > Update: I overrode the CGI slot with: > > > sub CGI { require CGI; CGI->new; } > > > > > > The problem goes away. Could there be an issue with the autoload > > > feature of Class:: > > > Prototyped and mod_perl?
> > > > Oh, Hmm. That does point to a problem. Yes, for mod_perl, you'll > > need to reinitialize the > > autoload on that variable. You don't want to call CGI->new on EVERY > > access, because that'll > > reinitialize it over and over and over even within a hit. > > > > Try this, and if it works, let me know, and I'll update the docs to > > say "for mod_perl, you'll > > want to do this": > > > > sub app_enter { > > my $self = shift; > > $self->reflect->addSlot([qw(CGI autoload)] => sub { CGI->new }); > > } > > > > Of course, if you have an existing app_enter, you'll have to add
> this
> > to it.
>
Fixed in 0.9005, I believe. See the new ->initialize_CGI method.