Forum OpenACS Development: What does it take to get a 404?!

I haven't yet been able to get my fresh installation of OpenACS 4 to return an HTTP 404 for anything. The response to a

GET /fasdfasdfsdfsdf HTTP/1.1

is a ``directory listing of /web/site-name/packages/acs-subsite/www''.

I submit that this violates the rule of least surprise, but I'm not at all sure why it's happening.

Posted by Don Baccus on
Does this happen with both the Oracle and Postgres versions?  If you've not tried with Oracle, could you do so?  If not we can probably
find out from one of our Oracle OpenACS users.

This would help us understand if we've inherited something bogus in the Oracle code or are causing something bogus due to an incorrect port of code to Postgres.

If you want to chase this down, I suggest you look at the request processor.

Certainly you should be able to trigger 404's out of the system.

Posted by Neophytos Demetriou on
Check your configuration file. Comment out these lines:

        #ns_param   directoryadp    $pageroot/dirlist.adp 
        #ns_param   directoryproc    _ns_dirlist
        #ns_param   directorylisting  fancy 
Posted by Don Baccus on
This will turn off the directory listing, but it doesn't explain why "/garbage" gets mapped there in the first place ...
Posted by Gilbert Wong on


I got this behavior too. I'm using the PG version. Is there a way to get more info from the rp? I turned on all logging and debugging params and the only line I got from the rp was:

[15/Aug/2001:14:41:22][5710.5][-conn0-] Debug: RP (1.405 ms): rp_filter: setting up request: GET /asdfsdfasdfasdfadsf


Posted by Steve Woodcock on
The chunk of code to return the directory listing is repeated in the request processor and one of them is just before the ns_returnnotfound... This patch takes care of it, will submit to SDM in a minute.
Index: tcl/request-processor-procs.tcl
RCS file: /cvsroot/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl,v
retrieving revision 1.7
diff -c -r1.7 request-processor-procs.tcl
*** tcl/request-processor-procs.tcl     2001/11/20 21:49:52     1.7
--- tcl/request-processor-procs.tcl     2002/01/10 10:27:41
*** 673,688 ****

-     if {[info exists dir_index]} {
-       set listings [ns_config "ns/server/[ns_info server]" 
-         "directorylisting" "none"]
-       if { [nsv_get rp_directory_listing_p .] } {
-       ns_returnnotice 200 "Directory listing of $dir_index" 
-           [rp_html_directory_listing $dir_index]
-       return
-       }
-     }
      ad_call_proc_if_exists ds_add rp [list transformation [list notfound $root/$path notfound] $startclicks [clock clicks]]
    } errmsg]] {
--- 673,678 ----
Posted by Andrew Piskorski on
Ah, nice solution Steve - a coworker and I were annoyed by that same problem on an ACS 4.2 site and didn't see your fix until now.

I might add that I still don't understand what the heck that offending paragraph of code was trying to do. Empirically, taking it out seems an excellent fix, but from my reading of the code I couldn't have told you whether it should have beeen good or not good to take it out. Request processor gurus, the rp_handler proc isn't all that complicated, but it sure seems like some Tcl code that could really benfit from some additional comments, when you get a chance.