[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CGI again
Tadej Mali schrieb:
>
> Hi!
^^^^
Hi Tadej,
>
> I have qa question regarding running CGI perl scripts from user's home
> directory. My scripts work fine, when I run them from c:\Pi3Web\Cgi-Bin,
> but they wouldn't work, when I run them from
> c:\home\user\public_html\cgi-bin. I get the error message:
>
> 501 Not implemented
> The requested method has been been implemented on this server.
>
> Examples can be found at:
> http://f9pc25.ijs.si/~mali/gb.html (runs script from Pi3Web's
> cgi-bin)
> http://f9pc25.ijs.si/~mali/gb_at_home.html (runs script from
> ~/mali/cgi-bin directory)
>
> Any ideas how to fix it or can it be fixed at all?
^^^^
In a former mail (not yet in mailing list archive) I showed a way to do
this. Open /Pi3Web/Conf/Config.Pi3 and make the following changes:
1.) Default handler
Search for
Handle Condition="&and(¬(&dblookup(response,string,ObjectMap)),\
¬(®exp('internal/*',$c)))" SendFile
Insert the following line before it
Handle
Condition="&or(&cmp($c,text/x-perl),&and(&cmp($c,application/octet-stream),\
®exp('*.exe',$z)))" CGIScripts
2.) Insert a new handler object named 'CGIScripts'
<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>
Explanation:
The 'CGIScripts' handler is an exact copy of the 'Scripts' handler for
Standard CGI except of the condition. It is a bit tricky way to delete
the Content-Type of the HTTP-Response Header since this field has to be
filled by the called script.
With this configuration every .pl, .cgi or .exe file is executed when it
is handled by the default handler (With other words - if the request was
dispatched to the PathMapper).
Discussion:
It is possible to extend this for other mime types too. I made an CGI
implementation of PHP3 (version 3.0.3, older version are a bit different)
in that way, the core is only 1 additional line in the default handler:
<Object>
Name Default
Class FlexibleHandlerClass
...
Handle Condition="&cmp($c,text/x-php3)" CGIScripts
...
- register mime type for php3 files:
<Object>
Name HTTPLogicObject
Class HTTPDispatcherClass
...
AddMIMEEntry "php3 text/x-php3"
...
- conditional execution of PHP3.EXE in standard CGI handler:
<Object>
Name StandardCGI
Class CGIClass
...
CommandLineByExt .php3="php.exe %p%q"
...
Hope I don't forget anything. Still questions?
>
> Regards,
> Tadej
>
> --
> Tadej MALI room: C78a
> Jozef Stefan Institute tel: + 386 61 177 38 32
> Jamova 39 fax: + 386 61 125 70 74
> 1000 Ljubljana www:
> http://merlot.ijs.si/~mali/main.html
> Slovenia
> -----------------------------------------------------------------------------
>
> PLEASE NOTE: Some Quantum Physics Theories Suggest That When the
> Consumer Is
> Not Directly Observing This Product, It May Cease to Exist or Will Exist
> Only
> in a Vague and Undetermined State.
--
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
--------------------------------------------------------
- References:
- CGI again
- From: Tadej Mali <Tadej.Mali@ijs.si>