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

Re: CGI Mapping



Nathan R Heagy schrieb:
> 
> Thanks for the suggestion, Holger, but it isn't working on my sytem. I moved
> a cgi, whatsnew.cgi, to a document directory, localhost/heagy/, and when I
                  ^^ is file extension .cgi?
                     then add .cgi to mime-type text/x-perl.
                     Search for AddMIMEEntry in the Config file and add line
                     AddMIMEEntry "cgi  text/x-perl"
                     or change it with the GUI admin. When it works now, however
                     I suggest to use the enhanced suggestion (see below).
                     
> tried to run the cgi netscape asks me to tell it where to download
> whatsnew.exe. What have I done wrong?
^^^^       ^^ or .exe?
^^^^
If the file extension is .exe the problem is the mime-type of your CGI.
I build the example for Perl (*.pl, *.cgi) and you are using executables
(*.exe). I wrote some sentences about the possible enhancements in the
discussion of my suggestion in the last mail but I did not work out this
there.
The problem for this mime type is that it is used not only for executables
but for all binary formats. Here's my suggestion that works with perl and
.exe CGI's and has some more enhancements (see below):

1.) Default handler
Search for
        Handle CGIScripts

Change it into
        Handle
Condition="&or(&cmp($c,text/x-perl),&and(&cmp($c,application/octet-stream),\
&regexp('*.exe',$z)))" CGIScripts


2.) Change the handler object named 'CGIScripts', delete the condition-line

<Object>
        Name CGIScripts
        Class FlexibleHandlerClass
        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>

Discussion:
Now CGI is executed when the mime type is "text/x-perl" or
"application/octet-stream" and the url-file extension is ".exe".
The condition I moved out of the call of CGIScripts handler, that's
for speed optimization (ca. 200ms per request). Thank you, Ang-Chih Kao
for the hint. This example I tested for perl and executable CGI and
it worked with .pl, .cgi and .exe files.

Still Problems?
Check your configuration (GUI or config file) for the following mime entries:

                     AddMIMEEntry "cgi  text/x-perl"
                     AddMIMEEntry "exe  application/octet-stream"
                     AddMIMEEntry "pl   text/x-perl"
> 
> Thanks for any (more) suggestions.
^^^^
No matter.

> Nathan R Heagy
> -- -- --
> Sites Built Better
> http://heagy.com
> 

8< CUT >8

-- 
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
--------------------------------------------------------