I think I have found a problem with the chat-index-page and many other
pages in OpenACS and ACS. The problem has to do with the `-code
return' option to the return tcl-command and appears when a user tries
to access the chat-index-page without being logged in; in this case an
error is reported in the server.log, although the registration page is
served to the user, nicely.
Here is a small example-file that causes a server error:
proc test {} {
return -code return
}
ReturnHeaders
ns_write "Hello..."
set a [test]
ns_write "...Goodbye"
If the call to test appears outside of brackets, no server error
occurs! Does someone know which is the correct behavior?
In OpenACS, one problematic procedure that uses the `-code return'
feature is ad_scope_authorize, which returns the user_id if the user
is logged in and returns with `-code return' if the user is not logged
in and registration is required. There are many files that use the
ad_scope_authorize procedure and a fix to these files is to exchange
lines of the form
set user_id [ad_scope_authorize $db $scope registered
group_member none]
into
ad_scope_authorize $db $scope registered group_member none
set user_id [ad_verify_and_get_user_id]
which does the right thing; in particular, this solution works for
../chat/index.tcl.