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

Joshua Lavin josh at myprivacy.ca
Mon Jul 3 15:05:48 EDT 2006

On Jun 28, 2006, at 2:40 PM, Kevin Walsh wrote:

> 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:


> 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.

Thanks for the help, Kevin. Your patch gave me the missing.html with  
Apache's 404 page appended. :-) I got IC to return a simple 404 with  
this patch to Link.pm v1.10:


--- Link.pm.orig        2006-06-28 09:39:41.000000000 -0500
+++ Link.pm     2006-07-03 13:47:01.000000000 -0500
@@ -746,7 +746,7 @@
          elsif($set_status =~ /^404/) {
#warn "404 not found status\n";
              close (SOCK)                                or die  
"close: $!\n";
-            return Apache2::Const::OK;
+            return Apache2::Const::NOT_FOUND;
                 elsif($set_status eq 'httpd_deliver') {
                         $deliver_object = $set_status;


If you use the [tag] code as above, this will return a 404, but it  
*uses the default Apache 404 page*. Without the [tag] code, it gives  
missing.html with a 200 status.

I wanted the best of both worlds (I have a custom IC-generated  
missing page), so I put "ErrorDocument 404 /special_pages/ 
missing2.html" in my apache conf, and made a symlink to ../ 
special_pages from CATROOT/pages. I created the missing2.html page  
without the [tag] code, and had to use @@MV_SUBJECT@@ instead of  
[subject]. Note that this was on a catalog at the root URL.

Josh Lavin
Kingdom Design   http://www.kingdomdesign.com/

More information about the interchange-users mailing list