[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGI-BIN



> E. Wilbrink schrieb:
> 
> How do I run Perl scripts out of my cgi-bin directory? (eg. from the root and
> from my users' accounts)
> 
I've done this with Pi3Web's configuration witchcraft:

<Object>
  Name Default
  Class FlexibleHandlerClass
  .
  .
  .
  Condition="&not(&or(&cmpi($m,POST),&or(&cmpi($m,GET),&cmpi($m,HEAD))))" \
  StatusCode StatusCode="501"
  .
  .
  .
  Handle
Condition="&or(&cmp($c,text/x-perl),&and(&cmp($c,application/octet-stream),\
&regexp('*.exe',$z)))" CGIScripts
  Handle Condition="&and(&not(&dblookup(response,string,ObjectMap)),\
&not(&regexp('internal/*',$c)))" SendFile
  .
  .
  .
</Object>

<Object>
  Name CGIScripts
  Class FlexibleHandlerClass
  Condition "$and($c,&dbreplace(response,rfc822,Content-Type,''))"
  CheckPath RefuseFileByMask AllowFileMask="EFD" RefuseStatus=404
  CheckPath RefuseFileByMask AllowFileMask="F" RefuseStatus=403
  CheckPath ReturnCode ReturnCode=COMPLETED
  CheckAccess AccessByFile RequirePermissions="X"
  CheckType ReturnCode ReturnCode=COMPLETED
  Handle StandardCGI
</Object>

How it works:
Qualified the default handler to accept HTTP-method 'POST' and process
CGI (mime types text/x-perl or application/octet-stream with .exe
file extension).
Used a new handler called 'CGIScripts' to delete the Content-Type of
the HTTP-response (This is a trick 'cause I need a type for the
condition but on the other hand the Content-Type of the CGI-output is
only written into the response if the field is still empty).
The rest is done by the common CGI handler. Still questions?

Btw.: Embedded PHP3 in the same way.

> Thanks,
> Thijs Wilbrink
> 

-- 
with regards
Holger

---------------------------------------------------------
Holger 'Zimpel' Zimmermann    Contact me:
---------------------------------------------------------
Wendishain                    tel./fax company: on demand
Germany                       tel./fax private: on demand
---------------------------------------------------------
homepage: http://home.t-online.de/home/zimpel/
web server: surf to it from my homepage (online every
            Sunday 20:00-24:00 GMT, start shifted again)
e-Mail:     zimpel@t-online.de
--------------------------------------------------------