There is no mechanism linking Tcl return's -errorcode or -code options to HTTP status codes. That's stuff entirely pertaining the HTTP layer (I can't see a value in tying return error codes to HTTP, it's looks to me like an overloading of the Tcl command)

the way you can do it is telling Apache to handle it sticking a 404 into the headers

::rivet::headers numeric 404

afterwards you may sent a HTML informational page before a subsequent call to ::rivet::no_body prevents any further 'puts' to actually send data. Calling ::rivet::abort_page interrupts script execution and moves control to AbortScript, which in turn may ignore based on the optional argument passed to the command

 -- Massimo


On 8/25/26 16:50, Clif Flynt wrote:
Hi,
   I've implemented a Direct_Url look-alike using the Apache's
Rewrite stuff:
In httpd.conf:

#
RewriteCond /usr/local/www/apache24/data/blackpine/%{REQUEST_FILENAME} !-f
RewriteCond /usr/local/www/apache24/data/blackpine/%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /rivet/error.rvt [PT,L,QSA]
#

   This sends control to error.rvt when the URL is not a valid file
or folder.

   I'm feeling like an idiot, but I can't figure out how to generate a
404 error when my error.rvt script fails to find a script to evaluate.

   I'd feel more like an idiot, but the various LLMs can't figure this
out, either.

   I've tried

# Doesn't return a 404.
#  return -code error -errorcode 404 -errorinfo "File Not Found" "404 error"

# Doesn't generate a 404. Sends "FAIL message" to  browser.
#        ::Rivet::finish_request "FAIL $uri\n[info body ::Rivet::finish_request$
         ::Rivet::finish_request "FAIL $uri\n" 404  AbortScript
# Aborts output, No 404 error.
   rivet::abort_page 404
logDURL "POST FINISH"
# Not generate 404
# return -code 404 -errorcode 404 -errorinfo "$uri not found"

# Nope. This doesnt exist, despite what LLMs will tell you.
#   ns_return 404 "text/html" "testing"

# Didn't generate a 404 error. Did generate the finish_requst output.
# No entry in apache access log for bad URL.
# ::rivet::exit 404

   Any clues?
Clif



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to