[Bug 1155] 404, 403, 401, 500, etc. Error pages

[email protected] Sun, 5 Jul 2009 20:33:48 +0000 (GMT)
Newsgroups gmane.comp.cms.xaraya.bugs
Message-ID <[email protected]>
http://bugs.xaraya.com/show_bug.cgi?id=1155


[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]




------- Comment #9 from [email protected]  2009-07-05 20:33 GMT -------
Errors seem to fall into 3 types;
 * those that are module specific and not occuring
 * those handled through Xaraya
 * those that cause Xaraya to cease.

Module specific errors are currently lacking (As far as I can tell).
Things like having a Xarpage that nolonger exists results i na parent page
being show (when applicable) or a root page instead.
For Articles, I believe it defaults to the Article Map or Topic Lsit.
Though such actions are understandable, and posses some Usability aspects ...
the problem is they send a 200 response - which is Wrong!.
The major problem with this is it requires Module Specific tweaks/adjustments.

Xaraya handled errors, (incorrect module calls, some template errors, incorrect
user function etc.) can be handled by the Base Module templates.
By creating overrides i na theme, it is possible to tweake them and include (as
per ...Baraboom...) Header() responses.
Further, as covered in http://xaraya.org/index.php/documentation/617 , it is
possible to create Error-specific theme tempaltes, and include various
different Header() types (such as 400/403 etc.) rather than a generic one that
would apply to all Errors.

System ceasing errors are also a major concern - as it currently stands, bad
template code, filesystem mistakes or DB connection issues can result in Xaraya
ceasing.
That's more than understandable.
The problem is, as per above - we still send a 200 response!

In all the above cases - not only is Xaraya not conforming to some standards -
it's resulting in incorrect content/crash messages getting crawled/indexed by
Search Engines!

.

There is a fix though :D
With some help/guidance from ...Dracos... and pointers from ...Random... I have
managed to tweak some core files so that we ow send 503 responses when things
DB errors etc. occur.

--------------------------------------------------

File:  index.php
Location:  /index.php
Add:  header('HTTP/1.1 503 Service Unavailable');
Line:  185(ish)
After: if (xarCurrentErrorID() == 'TEMPLATE_NOT_EXIST') {
 and
Line:  193(ish)
After: if (xarCurrentErrorType() != XAR_NO_EXCEPTION) {)

------

File:  xarCore.php
Location:  /includes/xarCore.php
Add:  header('HTTP/1.1 503 Service Unavailable');
Line:  608(ish)
After: EOD;
 and
Line:  627(ish)
After: EOM;

(NOTE: I have No IDea what these do, nor how to test them!!!!)

------

File:  xarException.php
Location:  /includes/xarException.php
Add:  header('HTTP/1.1 503 Service Unavailable');
Line:  518(ish)
After: if (isset($_GET['func']) && $_GET['func'] == 'systemexit') {  
 and
Line:  554(ish)
After: if (!function_exists('xarModURL')) {

------

To Test these changes...
* use the wrong password in the config file
* change the name of the config file (in the filesystem)
* change the name of index.php (in the filesystem)
* use incorrect code in a template (<xar:something>)
* change the name of your theme (in the filesystem)
All the above should now result in receiving 503 responses :D

--------------------------------------------------


-- 
Configure bugmail: http://bugs.xaraya.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

---- ** IMPORTANT ** READ BELOW ** ----
[Clip Me Start]
--------------------------------------------------------------------------
If you wish, you can reply to this message directly **however**, make sure
to use the "Reply To All" feature of your client **and** ensure that the 
bug specifier is in the subject (ie: [Bug ####]). Also, you _MUST_ have 
you're From or Reply-To address set to the same address you use to log
into your bugzilla account or your reply will not be attached to the bug.
--------------------------------------------------------------------------
[Clip Me End]