AW: AW: [mp2] Content-Length: 0 / Location:

2004-08-05 Thread Denis Banovic
Hi Geoffrey!

Thanks, that works fine.

It would be interresting to know how to do this in mod_perl style!


I have a Output object which captures the whole output.

On Destroy i'm doing something like this:


my @header = split(/\n/, $class-http_header);
foreach (@header) {
 $_ =~ /^(.*?)\: (.*?)$/s;
$class-{r}-headers_out-add($1,$2);  
  
}

There is also a function where I can set the Location header.

The only problem ist, that when I put this all together, there is a
Content-length: 0

and the redirect doesn't work. I have no Idea where this Content-length: 0 is comming 
from, I think it's from apache.

I've followed the last discussion about the C-L but could not find a sollution for it.

I wish everyone a nice weekend, 
CU in Zürich, the biggest party in Europe this weekend!

http://www.streetparade.ch

THINK THE WEB WAY.
---
NCM - NET COMMUNICATION MANAGEMENT GmbH
---[  Denis Banovic - CTO
mailto:[EMAIL PROTECTED]
---[  Mühlstrasse 4a
  AT - 5023 Salzburg
  Tel. 0662 / 644 688
---[  Fax: 0662 / 644 688 - 88 
  http://www.ncm.at
---


-Ursprüngliche Nachricht-
Von: Geoffrey Young [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 5. August 2004 14:42
An: Denis Banovic
Cc: [EMAIL PROTECTED]
Betreff: Re: AW: [mp2] Content-Length: 0 / Location:



 What am I doing wrong?
 
 I just want him to make a Redirect when somebody calls my script.
 
 I've tried PerlSendHeader Off and On, nothing helped.

I don't have compat mode enabled, but

  PerlOptions +ParseHeaders

worked just fine for me:

Alias /perl-bin /apache/2.0/prefork/perl-5.8.5/cgi-bin
Location /perl-bin
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  Options +ExecCGI
  PerlOptions +ParseHeaders
/Location

HTH

--Geoff

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: AW: AW: [mp2] Content-Length: 0 / Location:

2004-08-05 Thread Geoffrey Young


Denis Banovic wrote:
 Hi Geoffrey!
 
 Thanks, that works fine.
 
 It would be interresting to know how to do this in mod_perl style!
 
 
 I have a Output object which captures the whole output.

sounds like you might want to consider writing a PerlOutputFilterHandler
instead.

 
 On Destroy i'm doing something like this:
   
 
   my @header = split(/\n/, $class-http_header);
   foreach (@header) {
$_ =~ /^(.*?)\: (.*?)$/s;
   $class-{r}-headers_out-add($1,$2);  
   
   }
 
 There is also a function where I can set the Location header.
 
 The only problem ist, that when I put this all together, there is a
 Content-length: 0

Apache will calculate the C-L header for you, so you pretty much don't need
to worry about it.  in fact, unless you _know_ that it is messing things up
for you, just forget about it altogether.

 
 and the redirect doesn't work. I have no Idea where this Content-length: 0 is 
 comming from, I think it's from apache.

it sounds like you are doing some funky stuff, capturing output and doing
stuff on DESTROY.  as mentioned in the pervious thread, apache will send the
headers along if you somehow pass a flush bucket along (either via a direct
API call or if your print buffer gets sufficiently large or somesuch).  so,
what you need to be careful of is printing Location:... after the headers
are sent, though if you are adding Location to $r-headers_out that
shouldn't be an issue (and neither should you need +ParseHeaders IIRC).

anyway, this is all kind of conjecture on my part - I can't really do much
with redirect doesn't work without lots more information, especially since
you can get it to work with a standard Registry setup.  so, if you suspect a
bug it is best to follow the instructions at http://perl.apache.org/bugs/,
specifically the part about creating a self-contained Apache-Test
environment as described in Problem Description.  you may find that in
stripping down your code to create the smallest test case possible you will
figure it out.

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html