I'd like to turn off WEBHEADERART, cleanly, by using Main.TWikiPreferences. However, since WEBHEADERART is set in TWiki.TWikiPreferences, all I can do is to set it to an empty value (as far as I know there's no means to completely undefine a variable --no Unset to complement Set).
The problem is that
stylesdynamic.pattern.tmpl
uses the following code:
%IF{ 'defined WEBHEADERART' then='#patternTopBar { background-image:url("%WEBHEADERART%"); background-repeat:no-repeat;}'}%
and WEBHEADERART is still defined, albeit empty. This results in the following in
the output HTML:
#patternTopBar { background-image:url(""); background-repeat:no-repeat;}
which, for some reason beyond my ken, causes the browser to ask for the page again, e.g.:
macabre - - [25/May/2006:14:17:43 -0400] "GET /Optics/Main/DiabJerius HTTP/1.1" 200 20365
macabre - - [25/May/2006:14:17:44 -0400] "GET /Optics/Main/DiabJerius HTTP/1.1" 200 16384
Now, you might think that this is harmless, but I think its not, and here's my reasoning. Please pardon the verbosity!
I've been tracking down a sudden loss of authentication, where there's an inexplicable loss of knowledge about the user, and the demoting of the user to "guest". The cause is that
TWiki::Client::loadSession()
attempts to load an existing session file, only to find it empty! The problem is that sometimes, when the session file is written using
TWiki::Client::finish()
, the session file is opened, truncated, and then TWiki quite literally disappears before the session information is written (this happens sometime after the
sysopen
call in
CGI::Session::File::store()
).
Here's what I mean by it disappearing. I've replaced
bin/view
with the following script:
#!/bin/bash
echo "" >> /tmp/view.log
echo "$$------" >> /tmp/view.log
./view.exe "$@" 2>> /tmp/view.log
echo status = $? >> /tmp/view.log
echo "$$------" >> /tmp/view.log
Now, here's the output:
20389------
status = 0
20389------
20393------
20397------
status = 0
20397------
20405------
20459------
status = 0
20459------
20463------
Notice that there are several calls to
view
which do not show the bracketed
status
line. The script never gets to that
echo status
line! This can only mean that
apache
shut it down; there's no way to avoid that line short of another process killing the
view
script. I have
no idea why it is doing this.
Back to WEBHEADERART. If I comment out
all of the
Set WEBHEADERART
statements everywhere, so that it is never defined, the output HTML doesn't have that empty
background-image:url("");
image, there isn't a second attempt to retrieve the page, and so far I haven't seen the authentication drop problems.
So please, change the code so that it looks like this:
%IF{ "defined WEBHEADERART and $ WEBHEADERART != ''" then='#patternTopBar { background-image:url("%WEBHEADERART%"); background-repeat:no-repeat;}'}%
Note that the original code uses a single quote as the delimiter; the TWiki variable parser is unhappy if the code looks like
%IF{ 'defined WEBHEADERART and $ WEBHEADERART != ""' ...}
I see this problem using the Galeon and Firefox browsers against an apache 2.0.53 server on Fedora Core 3. I don't know if it's browser specific, server specific etc.
This one was a real bear to track down!
Thanks,
--
TWiki:Main.DiabJerius
Diab's fix look very sensible to me. We should not need to force people to edit TWiki.TWikiPreferences and as Diab explains - we have no way of unsetting a variable. I have tested his fix and found no reason not to include it. I have committed the change. Ready for release.
--
KJL
Makes sense.
AC