[ic] Interchange::Link, missing.html, 404

Ron Phipps rphipps at reliant-solutions.com
Fri Aug 25 19:24:19 EDT 2006


> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-users-
> bounces at icdevgroup.org] On Behalf Of Kevin Walsh
> Sent: Wednesday, June 28, 2006 12:40 PM
> 
> Joshua Lavin <josh at myprivacy.ca> wrote:
> > Using IC 5.4.0, Interchange::Link for mod_perl2.
> >
> > My special_pages/missing.html does not return a header of 404/Not
> > found. Rather they return 200/OK. This is not desired.
> >
> > When I used Mod::Interchange, I used the 'tag' tag in missing.html:
> >
> > [tag op=header]
> > Status: 404 Not found
> > Content-type: text/html; charset=ISO-8859-1
> > [/tag]
> >
> > This no longer works with IC:Link (gives a blank page). Also reported
> > here:
> > http://www.icdevgroup.org/pipermail/interchange-users/2006-March/
> > 045144.html
> >
> > I believe the problem stems from this code in Link.pm:
> >
> > elsif($set_status =~ /^404/) {
> > #warn "404 not found status\n";
> >       close (SOCK)   or die "close: $!\n";
> >       return Apache2::Const::OK;
> > }
> >
> > Is there any reason why this could not return
> > Apache2::Const::NOT_FOUND? Would that not allow us to use a
> > missing.html? (Could I use an ErrorDocument then, delivered by IC?)
> >
> > Anyone else having this problem?
> >
> My "missing" pages use the [tag] code you posted above.  I use
> mod_interchange everywhere and that works fine.  In fact, I was
> going to commit that [tag] code to the Standard demo.  I won't do
> that now.
> 
> I don't have an Interchange::Link setup to play with but, looking
> at the code, it seems that you might be able to get away with the
> following (completely untried and untested) patch:
> 
> ----------------------------------------------------------------------
> 
> --- ./dist/src/mod_perl2/Interchange/Link.pm    28 Jun 2006 14:39:41 -0000
> 1.10
> +++ ./dist/src/mod_perl2/Interchange/Link.pm    28 Jun 2006 19:28:26 -0000
> @@ -743,11 +743,6 @@
>              close (SOCK)                                or die "close:
> $!\n";
>              return Apache2::Const::REDIRECT;
>          }
> -        elsif($set_status =~ /^404/) {
> -#warn "404 not found status\n";
> -            close (SOCK)                                or die "close:
> $!\n";
> -            return Apache2::Const::OK;
> -        }
>                 elsif($set_status eq 'httpd_deliver') {
>                         $deliver_object = $set_status;
>                 }
> @@ -792,6 +787,11 @@
>                 }
>                 close (SOCK)                                or die "close:
> $!\n";
>                 print @out;
> +
> +               if ($set_status =~ /^404/) {
> +#warn "Returning NOT_FOUND\n";
> +                       return Apache2::Const::NOT_FOUND;
> +               }
>         }
> 
>  #warn "Returning OK\n";
> 
> ----------------------------------------------------------------------
> 
> I'm not sure whether the NOT_FOUND return code is necessary.  It's
> probably not;  OK is probably sufficient.  If the NOT_FOUND proves to
> be incorrect then just remove the "-" lines and forget the "+" lines,
> otherwise apply the whole patch and see what it does.
> 
> If you need me, you'll find me in the nuclear fallout shelter. :-)

Hi Kevin,

This week I had to setup two sites with Interchange::Link for the first
time.  It appears that this patch does not work as expected, with and
without the "+" lines the status return is 200, regardless if [tag header]
is called or not.

I will look into it some more and see if I can come up with a patch.

Thanks,
-Ron




More information about the interchange-users mailing list