Re: How to make FASTCGI deliver an external file
Bryan White <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Jose Adriano Baltieri wrote:
> Suppose that you have a FASTCGI like this :
>
> While there are requests()
> if request is not OK, say for security reasons, then
> send a message to the browser and loop again
> end if
> // the request is OK, that is, authorized THEN...
> // we need to send to the browser an external file
> // that is on this path : C:\SOMEWHERE\DOWN\ON\THE\SERVER\HARDDISK\EMPLOYEE_PICTURE.JPG
> end While
>
>
> Can I do that DIRECTLY ? That is, withouth having to RE-READ that file
> from inside FASTCGI itself ?
>
> IOW, is there some special order or instruction that I can issue from
> FASTCGI telling the http server :
>
> "Hey http server, deliver THE FILE ON THIS PATH to the browser, will you ?"
>
> I use something similar on a particular implementation of a webserver
> API that we have here...
>
It sounds like what you want to use FastCGI for authentication or
authorization. I have done this for my own system. I am not quite
clear on the difference between the authorizer and the authenticator
roles. What I implemented was the Authenticator role.
Paraphrasing from my apache config:
<Location /private>
AuthType Basic
AuthName PrivateStuff
FastCgiAuthenticator /var/www/bin/myauth
require valid-user
Allow from all
</Location>
The app used the REMOTE_USER, REMOTE_PASSWD and REMOTE_ADDR variables as
passed in to determine if access will be granted. If allowed it outputs
something like:
Status: 200 OK
Variable-AUTH_TYPE: Basic
Variable-REMOTE_PASSWD:
Variable-MYAUTH_USERID: SOMEUSERID
Note that every header in the response that begins 'Variable' gets
translated into a variable that is passed to the request handler (which
may also be a FastCGI app). Note also that the REMOTE_PASSWD is cleared
so that it will not be visible. The app can trust the MYAUTH_USERID/
If auth fails the the program sends:
Status: 401 Unauthorized
WWW-Authenticate: Basic realm="PrivateStuff"
which gets passed onto the browser and causes the name and password
prompt to be displayed.
--
Bryan White, ArcaMax Publishing Inc.
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/