Re: How to make FASTCGI deliver an external file
"Ravi Menon" <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
In Linux and FreeBSD world, there is a very efficient sendfile() and the 'outfd' is usually a tcp socket fd. I haven't tried this if the fd is a unix socket as is the case with fast-cgi. The neat thing is that you don't have to re-read the file etc.. it is a zero-copy optimized, largely designed for such file serving tasks. The FreeBSD version is better has it has provisions to include a custom header (e.g. http response headers) and trailer along with the file in a single syscall. Since your example seem to imply a Windows environment, you may want to explore if such a similar syscall is available there. Ravi On 7/13/06, Jose Adriano Baltieri <jabaltie-a/[email protected]> 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... > > -- > Obrigado, > ------------------------------------------------------------------------------ > Jose Adriano Baltieri - Analista de Sistemas > DTI - CENTRO - UNIMEP - Universidade Metodista de Piracicaba > PIRACICABA - SP - Brasil - Fone : (19) 3124-1858 > ------------------------------------------------------------------------------ > > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ > ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/