[Xitami] gslgen & xitami & errors

Francis Turner xitami@lists.xitami.org
Thu, 25 Oct 2001 17:50:59 +0200


Francis Turner wrote:

> I started playing with gslgen to auto display some XML
>
> But there are times when I'd like to abort the file and return an 
> error. Is it possible to return HTTP error codes? And if so is it also 
> possible to redirect people using a 302 return?

Figured it out (partly) - redirects work by doing something like

.if %errorcondition%
  <HTML><HEAD><TITLE>XML Error</TITLE>
  <meta http-equiv="Refresh" content="0; 
URL=http://$(HTTP_HOST:lower)/page.html"></HEAD>
  <BODY></BODY></HTML>
.  abort
.endif

 if  you replace the redirect 'URL=http://$(HTTP_HOST:lower)/page.html' 
with 'URL=http://$(HTTP_HOST:lower)/error?321' you get a error 321 page

 if you want a meaningful 404 error you do 
'URL=http://$(HTTP_HOST:lower)/$(PATH_INFO:lower)/error' which a) logs 
the error in a form that allows you to track it in the xitami log and b) 
gives the user something meaningful to note down when he complains

Francis