[Xitami] problem running .pl script

Francis Turner xitami@lists.xitami.org
Tue, 05 Mar 2002 15:26:37 +0100


nico.debackere@axa.be wrote:

>Hi all,  I have a question !  
>
>Problem:
>When I access my start page, that contains a .pl script, I get the download
>pop-up message, asking me what I want do do with the start.pl script; open
>this file from its current location or save this file to disk !!  That's not
>what I want.  
>
Xitami will only run scripts in the cgi-bin directory or subdirectories 
of there. A file in the webpaqges directory is sent to the user ratehr 
than executed on the webserver.

If you want your default page (i.e. http://my.domain.com/ to run a perl 
script then you should probably create a redirection html file as 
default.htm (or index.htm) with contents like:
<html><head>
<meta http-equiv="Refresh" content="0; URL=/cgi-bin/myscript.pl">
</head></html>

For more advanced users:
I use a trivial xml / gsl combo because I can redirect all ovber the 
place with that - it also allows you to use a frameset with 1 frame to 
hide the new URL and makes it easier to maintain changes.

the gsl file (called relo.gsl) is below

.-----------------------------------------------------------------------------
.-
.-  Relocator
.-
.-  Written:  2001/12/12  Francis Turner
.-
.-  Redirects you to another port on the same server. Either as a 
redirect or
.-  as an embedded frame. You can call it in 2 ways: either call direct
.-    relo.gsl?r=PPP&m=C&t=TTT
.-    where PPP is the port for the redirect
.-    C is either an R for redirect or an F for frame
.-    TTT is a title used to give the frame mode a title. It is ignored 
in R mode
.-  or use as the script for a service.xml script
.-    e.g. a SWAT service redirector would look like
.-    <RELO SCRIPT='/relo.gsl'>
.-      <SERVICE NAME='Swat' PORT='901' MODE='FRAME'/>
.-    </RELO>
.-
.-----------------------------------------------------------------------------
<HTML><HEAD>
.if filename <> script
.  for service
.    mode ?= 'r'
.    if (substr(mode,0,1,) = "f") | (substr(mode,0,,1) = "F")
.      port ?= 80
.      name ?= "Relo "+ port
<TITLE>$(name:)</TITLE></HEAD>
<FRAMESET cols="*">
  <FRAME name="In" src="http://$(HTTP_HOST:lower):$(port:)/">
  <NOFRAMES>
  <H1>Sorry!</H1>
  <H3>This page must be viewed by a browser that is capable of viewing 
frames.</H3>
  </NOFRAMES>
</FRAMESET></HTML>
.    else
  <meta http-equiv="Refresh" content="0; 
URL=http://$(HTTP_HOST:lower):$(port:)/"></HEAD>
  <BODY></BODY></HTML>
.-  <BODY>$(port?:)=$(name?:)=$(mode?:)-$(substr(mode,0,,1):)
.- </BODY></HTML>
.    endif
.  endfor
.elsif defined(p)
.  m ?= 'r'
.  if substr(m,0,1,) = 'r'
<meta http-equiv="Refresh" content="0; 
URL=http://$(HTTP_HOST:lower):$(p:)/"></HEAD>
<BODY></BODY></HTML>
.  else
.    .t ?= "Relo "+p
<TITLE>$(t:)</TITLE></HEAD>
<FRAMESET cols="*">
  <FRAME name="In" src="http://$(HTTP_HOST:lower):$(p:)/">
  <NOFRAMES>
  <H1>Sorry!</H1>
  <H3>This page must be viewed by a browser that is capable of viewing 
frames.</H3>
  </NOFRAMES>
</FRAMESET></HTML>
.  endif
.else
</HEAD><BODY>Bad Boy</BODY></HTML>
.endif


-- 
...if the US Government were ever to get really serious about Internet 
security, the top players in Microsoft's management hierarchy would find 
themselves handcuffed, blindfolded, led onto a tarmac within some obscure 
Air Force base, and shot.
-- Thomas C Greene (http://www.theregister.co.uk/content/55/23223.html)