You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nick Tonkin <ni...@tonkinresolutions.com> on 2003/02/19 02:53:05 UTC

[mp2] send_http_header() can't be called before the response phase

Hey,

I have a handler that is called like this:

    <Location /authenticate>
        sethandler perl-script
        PerlHandler WM::Auth::Auth
    </Location>

the handler returns like this:

return logon_form($r);

logon_form starts like this:

sub logon_form {
    my $r       = shift;
    $r->status(Apache::OK);
    $r->content_type('text/html');
    $r->send_http_header;

[...]


This throws the error:

send_http_header() can't be called before the response phase

Thanks,


- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>


Re: [mp2] send_http_header() can't be called before the response phase

Posted by Nick Tonkin <ni...@tonkinresolutions.com>.
On Thu, 20 Feb 2003, Stas Bekman wrote:

> Stas Bekman wrote:
> > Nick Tonkin wrote:
> [...]
> >> send_http_header() can't be called before the response phase
>
> Nick, I've just committed a better solution. Please verify that it works for you.

Now that the uri bug is fixed, this fix works fine, Stas. No complaints
when calling send_http_header in my Auth handler. So now I've taken it out
:)


- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>


Re: [mp2] send_http_header() can't be called before the response phase

Posted by Nick Tonkin <ni...@tonkinresolutions.com>.
On Thu, 20 Feb 2003, Stas Bekman wrote:

> Stas Bekman wrote:
> > Nick Tonkin wrote:
> [...]
> >> send_http_header() can't be called before the response phase
>
> Nick, I've just committed a better solution. Please verify that it works for you.


I'll have a go as soon as poss.


- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>


Re: [mp2] send_http_header() can't be called before the response phase

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Nick Tonkin wrote:
[...]
>> send_http_header() can't be called before the response phase

Nick, I've just committed a better solution. Please verify that it works for you.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] send_http_header() can't be called before the response phase

Posted by Stas Bekman <st...@stason.org>.
Nick Tonkin wrote:
> Hey,
> 
> I have a handler that is called like this:
> 
>     <Location /authenticate>
>         sethandler perl-script
>         PerlHandler WM::Auth::Auth
>     </Location>
> 
> the handler returns like this:
> 
> return logon_form($r);
> 
> logon_form starts like this:
> 
> sub logon_form {
>     my $r       = shift;
>     $r->status(Apache::OK);
>     $r->content_type('text/html');
>     $r->send_http_header;
> 
> [...]
> 
> 
> This throws the error:
> 
> send_http_header() can't be called before the response phase

I've posted a tentative solution to the dev list.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com