[EMAIL PROTECTED] (Manfred Hui) wrote:
>I have recently installed Kent Williams' Apache::Filter Module, and 
>tested it with the supplied UC module and it worked with simple cgi scripts.
>
>However I have experienced a problem though when my cgi calls CGI.pm's 
>redirect() and header().
>
>Instead of getting the appropiate headers, eg. 302 Moved.
>
>I get a standard Content-type: text/html without reference to any 
>location headers.
>
>I was wondering if anyone else had experienced the same problem and/or 
>have a solution to this?
>
>Here is what my cgi script looks like.
>
>#!/usr/bin/perl -w
>use CGI;
>my $ob = new CGI;
>print $ob->redirect('http://www.cnn.com');
>
>My Apache PerlHandler is set to Apache::RegistryFilter Apache::UC

Manfred,

I think there is a problem with the CGI->redirect method, because it
uses Apache->request (and there is a problem with that).  So your script
must use shift() to get the current request object, and then send
headers manually.  Try this instead (untested):

  #!/usr/bin/perl -w
  my $r = shift;
  $r->err_header_out(Location => 'http://www.cnn.com');
  $r->status(302);
  $r->send_http_header();

The downside of this, of course, is that it won't work under regular CGI.


  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to