You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Rafiq Ismail (ADMIN)" <ra...@joshua.dreamthought.com> on 2002/07/25 15:17:30 UTC

PerlSendHeader and $r->header_out

Hi People With Functioning Brain Cells,

I'm having a brief period of grief, which I'm sure I've been through
before.

I have this situation where I set a cookie using:
$r->header_out('Set-Cookie'=>$cookie);

Now this is all fine, however I'm having a major problem in getting my
header into the right place.

If I call $r->send_http_header right after my $r->header_out(set_stuff)
directive, and then call $r->print("page contents"), I get:

page_contents
HTTP_HEADERS DISPLAYED HERE (INCLUDING COOKIE HEADER)

Now, I experimented with PerlSendHeader being set to On, whilst disabling
the call to $r->send_http_header, yet it then appears to give me a header
which doesn't include the cookie header:

HTTP/1.1 200 OK
Date: Thu, 25 Jul 2002 13:01:12 GMT
Server: Apache/1.3.20 (Linux/SuSE) PHP/4.0.6 mod_perl/1.26
Transfer-Encoding: chunked
Content-Type: text/html

Any idea what is going on?

I'd like to just send_http_header with the headers appearing on top of my
page.  It appears to do things in the wrong order.  There is no
duplication of headers either.

If anyone can help and would fancy flying me out, I'll even buy you a
beer. :)

My content handler returns the result of another method called within the
same module.  This method is passed the request object, which in turn it
uses to send the headers and print the page.  This seems 'sensible' to me;
so why is it not working??

Many Thanks,

Fiq




========================================================
       "We're so wonderfully wonderfully wonderfully
	Wonderfully pretty
	Oh you know that I'd do anything for you
	We should have each other to tea, huh?
	We should have each other with cream
	Then curl up by the fire
	And sleep for awhile
	It's the grooviest thing
	It's the perfect dream"
		- The Cure, "Love Cats."



Re: PerlSendHeader and $r->header_out

Posted by Stas Bekman <st...@stason.org>.
Rafiq Ismail (ADMIN) wrote:
> Hi People With Functioning Brain Cells,
> 
> I'm having a brief period of grief, which I'm sure I've been through
> before.
> 
> I have this situation where I set a cookie using:
> $r->header_out('Set-Cookie'=>$cookie);
> 
> Now this is all fine, however I'm having a major problem in getting my
> header into the right place.

Have you tried using Apache::Cookie or CGI::Cookie? If these work for 
you, either stick to them or look at how their work.



__________________________________________________________________
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