From davidb at chelsea.net Tue Oct 6 15:39:45 2009 From: davidb at chelsea.net (David Birnbaum) Date: Tue, 6 Oct 2009 15:39:45 -0400 (EDT) Subject: [FASTCGI] 2009 SNAPs Message-ID: Folks, Rob has put together a couple of new snaps: http://www.fastcgi.com/dist/fcgi-2.4.1-SNAP-0910052249.tar.gz http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0910052141.tar.gz These contain all of the open patches and bugs that we are aware of with the exception of the big 64-bit patch which is out there. If people would be so kind as to compile, test, and send feedback to the list, that would be grand. We'd like to cut a new minor release, perhaps a 2.4.7 for both. Cheers, David. From kuzinandrey at yandex.ru Wed Oct 7 01:18:44 2009 From: kuzinandrey at yandex.ru (Kuzin Andrey) Date: Wed, 7 Oct 2009 09:18:44 +0400 Subject: [FASTCGI] 2009 SNAPs In-Reply-To: References: Message-ID: <110491502.20091007091844@yandex.ru> DB> Rob has put together a couple of new snaps: DB> http://www.fastcgi.com/dist/fcgi-2.4.1-SNAP-0910052249.tar.gz DB> http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0910052141.tar.gz DB> These contain all of the open patches and bugs that we are aware of with the DB> exception of the big 64-bit patch which is out there. DB> If people would be so kind as to compile, test, and send feedback to the list, DB> that would be grand. We'd like to cut a new minor release, perhaps a 2.4.7 for DB> both. Many people ask me for my patches for GET/POST requests. May be you add it in library. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Kuzin Andrey - kuzinandrey at yandex.ru =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -------------- next part -------------- A non-text attachment was scrubbed... Name: fcgiapp-c.patch Type: application/octet-stream Size: 4069 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fcgiapp-h.patch Type: application/octet-stream Size: 1234 bytes Desc: not available URL: From jeffrey at digitalsynergyinc.com Fri Oct 9 16:08:01 2009 From: jeffrey at digitalsynergyinc.com (Jeffrey H. Coffield) Date: Fri, 09 Oct 2009 13:08:01 -0700 Subject: [FASTCGI] Broken link Message-ID: <4ACF9821.90401@digitalsynergyinc.com> The link on the page http://www.fastcgi.com/drupal/node/5 to my version of FastCGI for OpenVMS should be "http://www.digitalsynergyinc.com/fastcgi.html" instead of "http://www.webworldinc.com/dsi/FASTCGI.HTM". Also, please change the text from "Jeff Coffield's VMS module" to "Digital Synergy, Inc's OpenVMS module". Thanks in advance, Jeff Coffield http://www.digitalsynergyinc.com From ninive at gmx.at Sat Oct 10 06:34:16 2009 From: ninive at gmx.at (double) Date: Sat, 10 Oct 2009 12:34:16 +0200 Subject: [FASTCGI] SNAP Message-ID: <4AD06328.4090000@gmx.at> Hello, Is anyone using "mod_fastcgi-SNAP-0910052141" on a production system? Is it recommended to update? Thanks Marcus From wilburlo at gmail.com Sat Oct 10 12:18:23 2009 From: wilburlo at gmail.com (Daniel Lo) Date: Sat, 10 Oct 2009 09:18:23 -0700 Subject: [FASTCGI] Broken link In-Reply-To: <4ACF9821.90401@digitalsynergyinc.com> References: <4ACF9821.90401@digitalsynergyinc.com> Message-ID: This has been fixed. Thank you, -daniel On Fri, Oct 9, 2009 at 1:08 PM, Jeffrey H. Coffield wrote: > The link on the page http://www.fastcgi.com/drupal/node/5 to my version > of FastCGI for OpenVMS should be > "http://www.digitalsynergyinc.com/fastcgi.html" instead of > "http://www.webworldinc.com/dsi/FASTCGI.HTM". > > Also, please change the text from "Jeff Coffield's VMS module" to > "Digital Synergy, Inc's OpenVMS module". > > Thanks in advance, > > Jeff Coffield > http://www.digitalsynergyinc.com > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > -- We must make the world honest before we can honestly say to our children that honesty is the best policy. -Bernard Shaw From codehero at gmail.com Sun Oct 11 01:00:54 2009 From: codehero at gmail.com (David Bender) Date: Sun, 11 Oct 2009 05:00:54 +0000 (UTC) Subject: [FASTCGI] FastCGI spec question Message-ID: Hey, I am working on a FastCGI implementation and encountered an ambiguity in the spec. Section 4.1 says: # FCGI_MAX_CONNS: The maximum number of concurrent transport connections this application will accept, e.g. "1" or "10". # FCGI_MAX_REQS: The maximum number of concurrent requests this application will accept, e.g. "1" or "50". I am assuming that PER CONNECTION, the web server will use Request Id range [1 - FCGI_MAX_REQS] (Is this correct?). Consequently, the application must then handle (FCGI_MAX_CONNS * FCGI_MAX_REQS) concurrent requests, which violates the definition of FCGI_MAX_REQS. Or am I to assume that the web server partitions the Request ID space among its active connections? However there could be multiple web servers talking the same CGI app this would seem difficult to coordinate. Thank you, Dave From blgl at hagernas.com Sun Oct 11 12:36:39 2009 From: blgl at hagernas.com (Bo Lindbergh) Date: Sun, 11 Oct 2009 18:36:39 +0200 Subject: [FASTCGI] FastCGI spec question In-Reply-To: References: Message-ID: <9E9DC999-4A84-49FD-89D9-E5BE6B512985@hagernas.com> 2009-10-11 kl. 07.00 skrev David Bender: > Hey, > I am working on a FastCGI implementation and encountered an > ambiguity in the spec. > > Section 4.1 says: > > # FCGI_MAX_CONNS: The maximum number of concurrent transport > connections this > application will accept, e.g. "1" or "10". > > # FCGI_MAX_REQS: The maximum number of concurrent requests this > application will > accept, e.g. "1" or "50". > > I am assuming that PER CONNECTION, the web server will use Request > Id range [1 > - FCGI_MAX_REQS] (Is this correct?). There's no hard guarantee for the range. The spec only says "The Web server attempts to keep FastCGI request IDs small." > Consequently, the application must then > handle (FCGI_MAX_CONNS * FCGI_MAX_REQS) concurrent requests, which > violates the > definition of FCGI_MAX_REQS. FCGI_MAX_REQS is always per application, not per connection. If the web server balances requests over connections, expect FCGI_MAX_REQS/FCGI_MAX_CONNS concurrent requests per connection. > Or am I to assume that the web server partitions the Request ID > space among its > active connections? The request id space is always per connection, not per application. > However there could be multiple web servers talking the same > CGI app this would seem difficult to coordinate. The spec doesn't address the case of multiple un-coordinated web servers talking to the same application. At a minimum, the application would need to apply a scale factor: actually accepting N times the number of connections/requests it claims to accept. /Bo Lindbergh From chapmanm at pixia.com Tue Oct 20 16:17:37 2009 From: chapmanm at pixia.com (Martin Chapman) Date: Tue, 20 Oct 2009 14:17:37 -0600 Subject: [FASTCGI] IOCompletion Ports and FCGI application Questions Message-ID: Bill / All, I am currently implementing a fastcgi version of a server that I have on windows. My existing server uses iocompletion ports to perform async io on socket handles. I noticed in the file os_win32.c that you are using iocompletion ports on windows in the fastcgi too. I have a couple of questions: 1. If I use the fcgi defined functions defined in fcgi_stdio.h to read and write data on the socket will the underlying fcgi functions use async io to do this by default? I am assuming that is the case after looking at the code but I wanted to make sure I don't have to do anything special in my code to enable async reads and writes. 2. I like to use the optimized windows function TransmitFile() for sending data across the network. Does fcgi take advantage of this function? If not, is there a way to get a hold of the requesting socket handle from my fcgi application so I can use that function instead of a fwrite() call? If I did do that would it cause problems for the fcgi application framework? 3. I want to make my fcgi executable a single multi-threaded application in order to cache my application resources. I am very familiar with writing multi-threaded applications but wanted to know if anyone has any tips or examples of the best way to do that with fcgi. My initial thought is to create a pool of worker threads that is twice the size of the number of processors of the machine combined with a second pool of http requests received by FCGI_Accecpt(). My thread pool manager will broker the incoming requests to the worker threads and let the FCGI_Accept() block when my pool is full. Does this sound like a decent strategy or can I do better? 4. I want to support remote fcgi so I can move my application behind the firewall and scale across 1 to n application servers. I don't need per session support and my target web server will be Apache. What do I need to do to make this work? I have read the docs on the fcgi website but I am not totally clear on what needs to be done to make this work. Do I need to spawn a listener thread for the remote application or is that handled by fcgi? Should the remote servers be windows services so I can make sure they are always avaiable? Has anyone used remote fcgi processes as services? Is that a practical solution? I will be using TCP for my network communication. Best regards, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From hoshino at labs.cybozu.co.jp Tue Oct 20 21:44:02 2009 From: hoshino at labs.cybozu.co.jp (Takashi HOSHINO) Date: Wed, 21 Oct 2009 10:44:02 +0900 Subject: [FASTCGI] [PATCH] fix mod_fastcgi process manager to kill children without fail on Windows. Message-ID: <4ADE6762.40102@labs.cybozu.co.jp> Hello, We found a bug in mod_fastcgi that PHP-5.3.0 as FastCGI server often deadlocks with Apache-2.2.10 and mod_fastcgi-SNAP-0811090952 on Windows. The reason is that TerminateProcess() is not called even though fcgi_pm.c seems should do so when the child process is in blocking state with named pipe, mutex lock, or so. We created an one-line-patch to fix the problem as below. The patch must work with the latest snapshot, though we tested only in the above environment. diff -Nrub mod_fastcgi-SNAP-0811090952/fcgi_pm.c mod_fastcgi-SNAP-0811090952.new/fcgi_pm.c --- mod_fastcgi-SNAP-0811090952/fcgi_pm.c 2008-09-23 07:24:45.000000000 +0900 +++ mod_fastcgi-SNAP-0811090952.new/fcgi_pm.c 2009-10-19 17:07:02.000000000 +0900 @@ -176,7 +176,8 @@ /* Send KILL to all processes */ for (i = 0; i < numChildren; i++, proc++) { - if (proc->state == FCGI_RUNNING_STATE) + if (proc->state == FCGI_RUNNING_STATE || + proc->state == FCGI_VICTIM_STATE) { fcgi_kill(proc, SIGKILL); } Thank you, Hoshino --- HOSHINO Takashi From hoshino at labs.cybozu.co.jp Tue Oct 20 23:45:32 2009 From: hoshino at labs.cybozu.co.jp (Takashi HOSHINO) Date: Wed, 21 Oct 2009 12:45:32 +0900 Subject: [FASTCGI] [PATCH] fix mod_fastcgi process manager to kill children without fail on Windows. Message-ID: <4ADE83DC.90205@labs.cybozu.co.jp> Hello, We found a bug in mod_fastcgi that PHP-5.3.0 as FastCGI server often deadlocks with Apache-2.2.10 and mod_fastcgi-SNAP-0811090952 on Windows. The reason is that TerminateProcess() is not called even though fcgi_pm.c seems should do so when the child process is in blocking state with named pipe, mutex lock, or so. We created an one-line-patch to fix the problem as below. The patch must work with the latest snapshot, though we tested only in the above environment. diff -Nrub mod_fastcgi-SNAP-0811090952/fcgi_pm.c mod_fastcgi-SNAP-0811090952.new/fcgi_pm.c --- mod_fastcgi-SNAP-0811090952/fcgi_pm.c 2008-09-23 07:24:45.000000000 +0900 +++ mod_fastcgi-SNAP-0811090952.new/fcgi_pm.c 2009-10-19 17:07:02.000000000 +0900 @@ -176,7 +176,8 @@ /* Send KILL to all processes */ for (i = 0; i < numChildren; i++, proc++) { - if (proc->state == FCGI_RUNNING_STATE) + if (proc->state == FCGI_RUNNING_STATE || + proc->state == FCGI_VICTIM_STATE) { fcgi_kill(proc, SIGKILL); } Thank you, Hoshino --- HOSHINO Takashi From david at wanscha.com Thu Oct 22 06:47:50 2009 From: david at wanscha.com (David Wantia) Date: Thu, 22 Oct 2009 12:47:50 +0200 Subject: [FASTCGI] Segmentation fault :-( Message-ID: HI, i have a problem with my fcgi. it can be execute in two ways. Normally, from /usr/lib/fcgi-bin/req.fcgi (from fastcgi.conf as static (apache)) OR in a console with an argument, e.g. ./req.fast arg0 (then without FCGI_Accept) Commands In the first case, i can control my fcgi by browser "localhost/fcgi-bin/req.fcgi?PUSH at 21D1,23D2" In the second case, i can control my fcgi with the stdin. eg "PUSH at 21D1,23D2" But in the first case, my fcgi restarted by apache sometime and the apache errorlog say: [Thu Oct 22 10:20:14 2009] [warn] FastCGI: server "/usr/lib/fcgi-bin/req.fcgi" (pid 22514) terminated due to uncaught signal '11' (Segmentation fault) [Thu Oct 22 10:20:14 2009] [warn] FastCGI: server "/usr/lib/fcgi-bin/req.fcgi" restarted (pid 22521) Is was NEVER happen in the second case. So i must find a way to debug the fcgi with the apache. What can i do? i have no idea how to do this. And i have no idea where the error be triggered. Please answer directly to david at wanscha dot com David -- Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/ From libo.868 at gmail.com Sat Oct 24 03:02:23 2009 From: libo.868 at gmail.com (=?GB2312?B?wO6yqA==?=) Date: Sat, 24 Oct 2009 15:02:23 +0800 Subject: [FASTCGI] help me, please! Message-ID: <6bc6070910240002p6ec4de7h595dc7bf625f331f@mail.gmail.com> Hi : because my english is not very good, i wish you can understand me,thanks. my question is: i use apache2 http server with AIX 5.3 OS, installed FASTCGI module, 3 FASTCGI programe , the name are: aa.fcgi, bb.fcgi, cc.fcgi. we need to limit the number of the instance of these programes, i want: the max number of aa.fcgi is 20, the max number of bb.fcgi is 40, the max number of cc.fcgi is 50, i dont't know how to specify these option , i studied the httpd.conf , and try to find the nswer from internet ,but i can't get any useful answer. please help me , thanks a lot ! best regards , bo, li 2009 - 10 - 24 ################################################################ if you know chinese, please see the text below, if no , ignore the text below here. ????AIX+APACHE+FASTCGI???????????FASTCGI?????????????????????httpd.conf?????? ??????????internet???????????????????????????????????? ################################################################ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gordon at group309.com Sat Oct 24 16:31:28 2009 From: gordon at group309.com (Gordon Colburn) Date: Sat, 24 Oct 2009 16:31:28 -0400 Subject: [FASTCGI] help me, please! In-Reply-To: <6bc6070910240002p6ec4de7h595dc7bf625f331f@mail.gmail.com> References: <6bc6070910240002p6ec4de7h595dc7bf625f331f@mail.gmail.com> Message-ID: <001701ca54e8$f980bcb0$0138a8c0@mozart> I suggest you use static rather than dynamic fast cgi servers. To use static fast cgi servers, use one FastCgiServer directive for each of your three applications. FastCgiServer allows you to specify how many instances of the application to start via the ?processes option. So your configuration would look something like: FastCgiServer /var/www/fcgi-bin/aa.fcgi -processes 20 FastCgiServer /var/www/fcgi-bin/bb.fcgi -processes 40 FastCgiServer /var/www/fcgi-bin/cc.fcgi -processes 50 With static servers, you will always have the maximum number of servers running, even when you have few requests, but that is probably OK; since your server must be sized for peak load, you might as well allow the peak number of processes to run at all times. I hope that helps. Regards, Gordon Colburn (Sorry if this is a duplicate; I sent it a moment ago and it was rejected by the list server, so I am resending it.) _____ From: fastcgi-developers-bounces+gordon=group309.com at mailman.fastcgi.com [mailto:fastcgi-developers-bounces+gordon=group309.com at mailman.fastcgi.com] On Behalf Of ?? Sent: Saturday, October 24, 2009 3:02 AM To: fastcgi-developers at mailman.fastcgi.com Subject: [FASTCGI] help me, please! Hi : because my english is not very good, i wish you can understand me,thanks. my question is: i use apache2 http server with AIX 5.3 OS, installed FASTCGI module, 3 FASTCGI programe , the name are: aa.fcgi, bb.fcgi, cc.fcgi. we need to limit the number of the instance of these programes, i want: the max number of aa.fcgi is 20, the max number of bb.fcgi is 40, the max number of cc.fcgi is 50, i dont't know how to specify these option , i studied the httpd.conf , and try to find the nswer from internet ,but i can't get any useful answer. please help me , thanks a lot ! best regards , bo, li 2009 - 10 - 24 ################################################################ if you know chinese, please see the text below, if no , ignore the text below here. ? ????AIX+APACHE+FASTCGI???????????FASTCGI?????????????????????httpd.conf?????? ??????????internet???????????????????????????????????? ################################################################ -------------- next part -------------- An HTML attachment was scrubbed... URL: From tbandrowsky at treatyist.com Sat Oct 24 23:52:55 2009 From: tbandrowsky at treatyist.com (tbandrowsky) Date: Sat, 24 Oct 2009 23:52:55 -0400 Subject: [FASTCGI] FastCGI as a Filter? In-Reply-To: References: Message-ID: <1256442775.5812.3.camel@tbandrow-desktop> I'm trying to make heads or tales of whether or not Apache 2 supports FastCGI as a filter. Basically, I want to have a bunch of files with a particular extension in a directory all get passed through to my FastCGI application rather than get spewed out directly. I've read that one does not need filters to do this, although clearly, filters look like they would be a pretty elegant approach. Can I do this sort of a thing with Apache, or am I just banged and should use something like Sun's web server? From wollman at csail.mit.edu Mon Oct 26 11:53:04 2009 From: wollman at csail.mit.edu (Garrett Wollman) Date: Mon, 26 Oct 2009 11:53:04 -0400 Subject: [FASTCGI] FastCGI as a Filter? In-Reply-To: <1256442775.5812.3.camel@tbandrow-desktop> References: <1256442775.5812.3.camel@tbandrow-desktop> Message-ID: <19173.50656.679731.697824@khavrinen.csail.mit.edu> < said: > I'm trying to make heads or tales of whether or not Apache 2 supports > FastCGI as a filter. Basically, I want to have a bunch of files with a > particular extension in a directory all get passed through to my FastCGI > application rather than get spewed out directly. That's pretty easy to accomplish, although I don't know about using the filter mechanism for that. Here's what we do for PHP: ScriptAlias /.php5-cgi /usr/bin/php5-cgi Action php5-script /.php5-cgi Action application/x-httpd-fastphp5 /.php5-cgi AddType application/x-httpd-fastphp5 php5 -GAWollman From rclemley at booksys.com Tue Oct 27 15:01:32 2009 From: rclemley at booksys.com (Rob Lemley) Date: Tue, 27 Oct 2009 14:01:32 -0500 Subject: [FASTCGI] FastCGI as a Filter? In-Reply-To: References: Message-ID: <4AE7438C.7070901@booksys.com> Date: Sat, 24 Oct 2009 23:52:55 -0400 > From: tbandrowsky > Subject: [FASTCGI] FastCGI as a Filter? > > I'm trying to make heads or tales of whether or not Apache 2 supports > FastCGI as a filter. Basically, I want to have a bunch of files with a > particular extension in a directory all get passed through to my FastCGI > application rather than get spewed out directly. I've read that one > does not need filters to do this, although clearly, filters look like > they would be a pretty elegant approach. Can I do this sort of a thing > with Apache, or am I just banged and should use something like Sun's web > server? > Apparently mod_fastcgi (the apache fastcgi module) does not support FastCGI filter role: "mod_fastcgi does not implement the Authorizer or Filter roles described in the FastCGI specification. However, you can approximate the Filter role using Apache's Action directive to route requests to a FastCGI Responder. See the documentation for mod_actions for information on the Action directive." (http://www.fastcgi.com/om_archive/servers/apache/apache-fastcgi/mod_fastcgi.html) The mod_action solution (which I have no experience with) seems to catch all files with a given mime-type or, in this case, extension: # Files of a particular file extension AddHandler my-file-type .xyz Action my-file-type /cgi-bin/program.cgi which, translated to FastCGI, I think would look something like (untested): # Files of a particular file extension AddHandler my-file-type .xyz Action my-file-type /myfastcgiapp FastCgiServer /myfastcgiapp .... I believe the way to set this up with apache AliasMatch directive, which allows you to capture input requests based on a more general regular expression pattern, to set the Apache2 "AliasMatch" directive to pass only the files you want to filter to your FastCGI server: #APACHE CONFIG: # NameVirtualHost *:80 ServerName yourserver.example.com ServerAlias yourserver AliasMatch ^/(path/to/yourfiles/*.ext) /yourfastcgiserver FastCgiExternalServer /yourfastcgiserver -socket /var/run/yourfastcgiserver/socket #END OF APACHE CONFIG Next, you would implement the FastCGI server to read the files and filter them as necessary. This usage of FastCGI is fairly well known and I don't have a good concise example in my own code. To filter these files, generally all you would do is open the filename found in the FastCGI Environment (CGI) variable "SCRIPT_NAME." You might need to adjust the directory or something depending on how your server namespace is set up. while accept_fastcgi_request(request) #FCGX_Accept(), etc script_name = lookup(request.envp, "SCRIPT_NAME") filter(script_name) # writes using FCGX_PutStr(), may need to Put the HTTP response header too. endwhile All of the information about the request will come through the FastCGI request. You'll look at various fields in the FastCGI environment to determine the file to open and filter. Generally your program might look at REQUEST_URI, QUERY_STRING and SCRIPT_NAME. You may also want to check for POST request data in some case (depends on having "CONTENT_TYPE=multipart/form-data; boundary.....). Or you can just ignore any query string and post data and just filter the SCRIPT_NAME. NOTE: usually (always?) REQUEST_URI == SCRIPT_NAME + "?" + QUERY_STRING Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From tbandrowsky at treatyist.com Tue Oct 27 22:30:47 2009 From: tbandrowsky at treatyist.com (tbandrowsky) Date: Tue, 27 Oct 2009 22:30:47 -0400 Subject: [FASTCGI] FastCGI as a Filter? In-Reply-To: <19173.50656.679731.697824@khavrinen.csail.mit.edu> References: <1256442775.5812.3.camel@tbandrow-desktop> <19173.50656.679731.697824@khavrinen.csail.mit.edu> Message-ID: <1256697047.3271.5.camel@tbandrow-desktop> Thanks! Turns out that is exactly what I was trying to do and it works wonderfully. On Mon, 2009-10-26 at 11:53 -0400, Garrett Wollman wrote: > < said: > > > I'm trying to make heads or tales of whether or not Apache 2 supports > > FastCGI as a filter. Basically, I want to have a bunch of files with a > > particular extension in a directory all get passed through to my FastCGI > > application rather than get spewed out directly. > > That's pretty easy to accomplish, although I don't know about using > the filter mechanism for that. Here's what we do for PHP: > > ScriptAlias /.php5-cgi /usr/bin/php5-cgi > Action php5-script /.php5-cgi > Action application/x-httpd-fastphp5 /.php5-cgi > > AddType application/x-httpd-fastphp5 php5 > > -GAWollman > From Rick at LandbaseSystems.com Wed Oct 28 10:51:09 2009 From: Rick at LandbaseSystems.com (Rick Thorne) Date: Wed, 28 Oct 2009 10:51:09 -0400 Subject: [FASTCGI] Is there any method (within fcgi) to return a different HTTP status code than '200 OK'? Message-ID: <20091028145114.4F00F7C08D@smtp-ext-01.mx.pitdc1.expedient.net> Is there any method (within fcgi) to return a HTTP status code other than '200 OK'? I'm serving up images stored in a database; using fcgi and Apache. Using www.httpviewer.net to track the response 'back' from our server, a request for an existing image (through our fcgi application) returns the following HTTP information: HTTP/1.1 200 OK(CR)(LF) Date: Tue, 27 Oct 2009 16:57:57 GMT(CR)(LF) Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) Content-Length: 3302(CR)(LF) <--- written by our fcgi application Content-Type: image/png(CR)(LF) <--- written by our fcgi application (CR)(LF) <--- written by our fcgi application ...3302 bytes of .png data <--- written by our fcgi application The web page receives and displays the image correctly. The web page can also generate requests for images that do not exist, and these requests also come through our fcgi application (we don't know that they do not exist until we attempt to find them in the database). We'd like to return the '404 Not Found' header for these non-existent images, as in: HTTP/1.1 404 Not Found(CR)(LF) Date: Tue, 27 Oct 2009 17:04:47 GMT(CR)(LF) Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) (CR)(LF) However, within our fcgi application I don't appear to have control over the first three HTTP response lines (the lines that starts with 'HTTP/1.1', 'Date:', and 'Server:'). I believe Apache generates these lines when it successfully parses the fcgi request and finds the required fcgi startup file. Then it calls the fcgi application and pushes the data through the pipes to and from our fcgi application. In other words, apparently all fcgi applications have to work with only the 'HTTP/1.1 200 OK(CR)(LF)' response and cannot change this response code to another value. The FCGX_SetExitStatus() command does 'not' control this HTTP response code (?I tried w/o success on the output stream, perhaps I should have tried the error stream?). The current workaround I have for this particular issue is to keep the '200 OK' response and return an empty .png image. This solution 'works' (in this particular example), but I'd also like to be able to respond with other HTTP codes for some other error conditions. Note: I'm writing this fcgi application in 'C', so I can pretty much call any (public) operating system/Apache/fcgi dynamic link library entry point. Thoughts and/or suggestions welcome... Rick Thorne Landbase Systems Corporation One World / One Map (412)563-9120 (Office) (412)563-9122 (Desk) From andre_mikulec at hotmail.com Wed Oct 28 12:05:16 2009 From: andre_mikulec at hotmail.com (Andre Mikulec) Date: Wed, 28 Oct 2009 12:05:16 -0400 Subject: [FASTCGI] Can not get Apache2, fastcgi, and django working Message-ID: Hi, I am having difficulty getting fastcgi on apache 2 working on my a centos 5.3 computer. I have been trying to get this to work for 21 days. May I have help? ------ I do the following. service httpd restart [root at localhost mysite]# ./manage.py runfcgi method=threaded host=127.0.0.1 port=8000 Next, I browse to http://127.0.0.1:8000 I get back the message. Failed to Connect Firefox can't establish a connection to the server at 127.0.0.1:8000. This page seems to be continuously loading forever. The loading icon keeps going around in a circle. Next, I try the following. service httpd restart [root at localhost mysite]# ./manage.py runfcgi method=threaded host=127.0.0.1 port=3000 http://127.0.0.1:3000/ I get back a blank page. This page seems to be continuously loading forever. The loading icon keeps going around in a circle. ------ My /etc/httpd/conf/httpd.conf file has the default follow entry. # Load config files from the config directory "/etc/httpd/conf.d". # Include conf.d/*.conf ------ My ~/django.fcgi file has the default follow entry. #!/usr/bin/python import sys, os # Add a custom path sys.path.insert(0,'/usr/bin/python') # Switch to the directory of your project. (Optional) os.chdir('/root/Django_Projects/mysite') # OK sys.path.insert(0,'/root/Django-1.1') sys.path.insert(0,'/root/Django_Projects') # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.core.handlers.fastcgi import runfastcgi runfastcgi(method='threaded', daemonize='false') ------ My /etc/httpd/conf.d/mod_fastcgi.conf file has the following entry. LoadModule fastcgi_module modules/mod_fastcgi.so FastCGIExternalServer /root/django.fcgi -host 127.0.0.1:8000 ServerName dummy DocumentRoot /root/Django_Projects Alias /media /root/Django_Projects_Media RewriteEngine On RewriteRule ^/(Django_Projects_Media.*)$ /$1 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ /django.fcgi/$1 [QSA,L] ------ My /root/.htaccess file looks like the following. AddHandler fastcgi-script .fcgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L] ------ My /root/Django_Projects/mysite directory looks like the following. This is brand new. This has just been created. [root at localhost mysite]# pwd /root/Django_Projects/mysite [root at localhost mysite]# ls -al total 32 drwxr-xr-x 2 root root 4096 Oct 17 12:53 . drwxr-xr-x 3 root root 4096 Oct 17 12:57 .. lrwxrwxrwx 1 root root 43 Jun 20 2005 adminmedia -> /root/ Django-1.1/django/contrib/admin/media -rwxr-xr-x 1 root root 0 Jun 20 2005 __init__.py -rw-r--r-- 1 root root 120 Jun 20 2005 __init__.pyc -rwxr-xr-x 1 root root 546 Jun 20 2005 manage.py -rwxr-xr-x 1 root root 2773 Jun 20 2005 settings.py -rw-r--r-- 1 root root 1747 Jun 20 2005 settings.pyc -rwxr-xr-x 1 root root 542 Jun 20 2005 urls.py -rw-r--r-- 1 root root 217 Jun 20 2005 urls.pyc [root at localhost mysite]# ------ My home directory /root looks like the following. [root at localhost ~]# pwd /root [root at localhost ~]# ls -alrt total 504 drwxr-xr-x 8 root root 4096 Jul 29 00:59 Django-1.1 drwxr-xr-x 2 root root 4096 Oct 5 10:32 Django_Projects_Media -rw-r--r-- 1 root root 128 Oct 5 11:24 .htaccess -rwxr-xr-x 1 root root 491 Oct 17 12:31 django.fcgi drwxr-xr-x 3 root root 4096 Oct 17 12:57 Django_Projects [root at localhost ~]# ------ My (root) ~/.bash_profilee file looks like the following. PATH=$PATH:$HOME/bin:/root/Django-1.1/django/bin export PATH unset USERNAME PYTHONPATH=$HOME/Django_Projects export PYTHONPATH ------ Thank you for some help, Andre_Mikulec at Hotmail.com Thank you. Sincerely, Andre Mikulec Andre_Mikulec at Hotmail.com _________________________________________________________________ Windows 7: It works the way you want. Learn more. http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:102009 From ericg at unfoldedmind.com Wed Oct 28 12:10:00 2009 From: ericg at unfoldedmind.com (Eric J. Gustafson) Date: Wed, 28 Oct 2009 11:10:00 -0500 Subject: [FASTCGI] Is there any method (within fcgi) to return a different HTTP status code than '200 OK'? In-Reply-To: <20091028145114.4F00F7C08D@smtp-ext-01.mx.pitdc1.expedient.net> References: <20091028145114.4F00F7C08D@smtp-ext-01.mx.pitdc1.expedient.net> Message-ID: <3c11994a9af5beed67af7031b1deb514.squirrel@webmail.unfoldedmind.com> On Wed, October 28, 2009 09:51, Rick Thorne wrote: > Is there any method (within fcgi) to return a HTTP status code other > than '200 OK'? > > That's in the FAQ http://www.fastcgi.com/docs/faq.html#httpstatus -- "Tuning a mellotron doesn't." -Robert Fripp From tbandrowsky at treatyist.com Wed Oct 28 19:41:00 2009 From: tbandrowsky at treatyist.com (tbandrowsky) Date: Wed, 28 Oct 2009 19:41:00 -0400 Subject: [FASTCGI] FastCGI-developers Digest, Vol 15, Issue 10 In-Reply-To: References: Message-ID: <1256773260.5161.11.camel@tbandrow-desktop> Hey, some answers! I managed to get it to work and I'm super excited about it. For the purposes of having a FastCGI process multiple different files, the following worked, for Apache (This was on an Ubuntu based machine). In the below, xspserve is the name of my C++ FastCGI. FastCGIServer /var/www/xsp-bin/xspserve AddType application/x-httpd-fastxsp xsp Action application/x-httpd-fastxsp /xsp-bin/xspserve AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch To read the file that is my "custom script" file, I found that PATH_TRANSLATED seemed to be the one that did what I needed. SCRIPT_NAME game the name of the C++ chumpy itself, and that simply wasn't what I was looking for. Todd On Wed, 2009-10-28 at 12:00 -0400, fastcgi-developers-request at mailman.fastcgi.com wrote: > Send FastCGI-developers mailing list submissions to > fastcgi-developers at mailman.fastcgi.com > > To subscribe or unsubscribe via the World Wide Web, visit > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > or, via email, send a message with subject or body 'help' to > fastcgi-developers-request at mailman.fastcgi.com > > You can reach the person managing the list at > fastcgi-developers-owner at mailman.fastcgi.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of FastCGI-developers digest..." > > > Today's Topics: > > 1. Re: FastCGI as a Filter? (Rob Lemley) > 2. Re: FastCGI as a Filter? (tbandrowsky) > 3. Is there any method (within fcgi) to return a different HTTP > status code than '200 OK'? (Rick Thorne) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 27 Oct 2009 14:01:32 -0500 > From: Rob Lemley > Subject: Re: [FASTCGI] FastCGI as a Filter? > To: fastcgi-developers at mailman.pins.net > Message-ID: <4AE7438C.7070901 at booksys.com> > Content-Type: text/plain; charset="iso-8859-1" > > Date: Sat, 24 Oct 2009 23:52:55 -0400 > > From: tbandrowsky > > Subject: [FASTCGI] FastCGI as a Filter? > > > > I'm trying to make heads or tales of whether or not Apache 2 supports > > FastCGI as a filter. Basically, I want to have a bunch of files with a > > particular extension in a directory all get passed through to my FastCGI > > application rather than get spewed out directly. I've read that one > > does not need filters to do this, although clearly, filters look like > > they would be a pretty elegant approach. Can I do this sort of a thing > > with Apache, or am I just banged and should use something like Sun's web > > server? > > > Apparently mod_fastcgi (the apache fastcgi module) does not support > FastCGI filter role: > > "mod_fastcgi does not implement the Authorizer or Filter roles described > in the FastCGI specification. However, you can approximate the Filter > role using Apache's Action directive to route requests to a FastCGI > Responder. See the documentation for mod_actions for information on the > Action directive." > (http://www.fastcgi.com/om_archive/servers/apache/apache-fastcgi/mod_fastcgi.html) > > The mod_action solution (which I have no experience with) seems to catch > all files with a given mime-type or, in this case, extension: > > # Files of a particular file extension > AddHandler my-file-type .xyz > Action my-file-type /cgi-bin/program.cgi > > which, translated to FastCGI, I think would look something like (untested): > > # Files of a particular file extension > AddHandler my-file-type .xyz > Action my-file-type /myfastcgiapp > FastCgiServer /myfastcgiapp .... > > I believe the way to set this up with apache AliasMatch directive, > which allows you to capture input requests based on a more general > regular expression pattern, to set the Apache2 "AliasMatch" directive to > pass only the files you want to filter to your FastCGI server: > > #APACHE CONFIG: > > # NameVirtualHost *:80 > > > ServerName yourserver.example.com > ServerAlias yourserver > AliasMatch ^/(path/to/yourfiles/*.ext) /yourfastcgiserver > > > FastCgiExternalServer /yourfastcgiserver -socket > /var/run/yourfastcgiserver/socket > > #END OF APACHE CONFIG > > Next, you would implement the FastCGI server to read the files and > filter them as necessary. This usage of FastCGI is fairly well known > and I don't have a good concise example in my own code. To filter these > files, generally all you would do is open the filename found in the > FastCGI Environment (CGI) variable "SCRIPT_NAME." You might need to > adjust the directory or something depending on how your server namespace > is set up. > > while accept_fastcgi_request(request) > #FCGX_Accept(), etc > script_name = lookup(request.envp, "SCRIPT_NAME") > filter(script_name) # writes > using FCGX_PutStr(), may need to Put the HTTP response header too. > endwhile > > > All of the information about the request will come through the FastCGI > request. You'll look at various fields in the FastCGI environment to > determine the file to open and filter. Generally your program might > look at REQUEST_URI, QUERY_STRING and SCRIPT_NAME. You may also want to > check for POST request data in some case (depends on having > "CONTENT_TYPE=multipart/form-data; boundary.....). Or you can just > ignore any query string and post data and just filter the SCRIPT_NAME. > > NOTE: usually (always?) REQUEST_URI == SCRIPT_NAME + "?" + QUERY_STRING > > Rob > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 2 > Date: Tue, 27 Oct 2009 22:30:47 -0400 > From: tbandrowsky > Subject: Re: [FASTCGI] FastCGI as a Filter? > To: Garrett Wollman > Cc: fastcgi-developers at mailman.pins.net > Message-ID: <1256697047.3271.5.camel at tbandrow-desktop> > Content-Type: text/plain; charset="UTF-8" > > Thanks! Turns out that is exactly what I was trying to do and it works > wonderfully. > > On Mon, 2009-10-26 at 11:53 -0400, Garrett Wollman wrote: > > < said: > > > > > I'm trying to make heads or tales of whether or not Apache 2 supports > > > FastCGI as a filter. Basically, I want to have a bunch of files with a > > > particular extension in a directory all get passed through to my FastCGI > > > application rather than get spewed out directly. > > > > That's pretty easy to accomplish, although I don't know about using > > the filter mechanism for that. Here's what we do for PHP: > > > > ScriptAlias /.php5-cgi /usr/bin/php5-cgi > > Action php5-script /.php5-cgi > > Action application/x-httpd-fastphp5 /.php5-cgi > > > > AddType application/x-httpd-fastphp5 php5 > > > > -GAWollman > > > > > > > ------------------------------ > > Message: 3 > Date: Wed, 28 Oct 2009 10:51:09 -0400 > From: Rick Thorne > Subject: [FASTCGI] Is there any method (within fcgi) to return a > different HTTP status code than '200 OK'? > To: fastcgi-developers at mailman.fastcgi.com > Message-ID: > <20091028145114.4F00F7C08D at smtp-ext-01.mx.pitdc1.expedient.net> > Content-Type: text/plain; charset="us-ascii"; format=flowed > > Is there any method (within fcgi) to return a HTTP status code other > than '200 OK'? > > I'm serving up images stored in a database; using fcgi and Apache. > > Using www.httpviewer.net to track the response 'back' from our > server, a request for an existing image (through our fcgi > application) returns the following HTTP information: > HTTP/1.1 200 OK(CR)(LF) > Date: Tue, 27 Oct 2009 16:57:57 GMT(CR)(LF) > Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) > Content-Length: 3302(CR)(LF) <--- written by our fcgi application > Content-Type: image/png(CR)(LF) <--- written by our > fcgi application > (CR)(LF) <--- written by our > fcgi application > ...3302 bytes of .png data <--- written by our > fcgi application > > The web page receives and displays the image correctly. > > The web page can also generate requests for images that do not exist, > and these requests also come through our fcgi application (we don't > know that they do not exist until we attempt to find them in the database). > > We'd like to return the '404 Not Found' header for these non-existent > images, as in: > HTTP/1.1 404 Not Found(CR)(LF) > Date: Tue, 27 Oct 2009 17:04:47 GMT(CR)(LF) > Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) > (CR)(LF) > > However, within our fcgi application I don't appear to have control > over the first three HTTP response lines (the lines that starts with > 'HTTP/1.1', 'Date:', and 'Server:'). I believe Apache generates > these lines when it successfully parses the fcgi request and finds > the required fcgi startup file. Then it calls the fcgi application > and pushes the data through the pipes to and from our fcgi application. > > In other words, apparently all fcgi applications have to work with > only the 'HTTP/1.1 200 OK(CR)(LF)' response and cannot change this > response code to another value. > > The FCGX_SetExitStatus() command does 'not' control this HTTP > response code (?I tried w/o success on the output stream, perhaps I > should have tried the error stream?). > > The current workaround I have for this particular issue is to keep > the '200 OK' response and return an empty .png image. This solution > 'works' (in this particular example), but I'd also like to be able to > respond with other HTTP codes for some other error conditions. > > Note: I'm writing this fcgi application in 'C', so I can pretty much > call any (public) operating system/Apache/fcgi dynamic link library > entry point. > > Thoughts and/or suggestions welcome... > > Rick Thorne > Landbase Systems Corporation > One World / One Map > (412)563-9120 (Office) > (412)563-9122 (Desk) > > > > ------------------------------ > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > > > End of FastCGI-developers Digest, Vol 15, Issue 10 > ************************************************** > From rclemley at booksys.com Thu Oct 29 18:41:16 2009 From: rclemley at booksys.com (Rob Lemley) Date: Thu, 29 Oct 2009 17:41:16 -0500 Subject: [FASTCGI] FastCGI-developers Digest, Vol 15, Issue 10 In-Reply-To: <1256773260.5161.11.camel@tbandrow-desktop> References: <1256773260.5161.11.camel@tbandrow-desktop> Message-ID: <4AEA1A0C.5090008@booksys.com> Great! I guess that's one of the differences between AliasMatch ^/(path/to/yourfiles/*.ext) /yourfastcgiserver and AddHandler my-file-type .xyz Action my-file-type /myfastcgiapp In my AliasMatched fastcgi server, I don't even get a PATH_TRANSLATED var. tbandrowsky wrote: > Hey, some answers! I managed to get it to work and I'm super excited > about it. For the purposes of having a FastCGI process multiple > different files, the following worked, for Apache (This was on an Ubuntu > based machine). In the below, xspserve is the name of my C++ FastCGI. > > FastCGIServer /var/www/xsp-bin/xspserve > AddType application/x-httpd-fastxsp xsp > Action application/x-httpd-fastxsp /xsp-bin/xspserve > > > AllowOverride None > Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch > > > To read the file that is my "custom script" file, I found that > PATH_TRANSLATED seemed to be the one that did what I needed. > SCRIPT_NAME game the name of the C++ chumpy itself, and that simply > wasn't what I was looking for. > > Todd > > On Wed, 2009-10-28 at 12:00 -0400, > fastcgi-developers-request at mailman.fastcgi.com wrote: > >> Send FastCGI-developers mailing list submissions to >> fastcgi-developers at mailman.fastcgi.com >> >> To subscribe or unsubscribe via the World Wide Web, visit >> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers >> or, via email, send a message with subject or body 'help' to >> fastcgi-developers-request at mailman.fastcgi.com >> >> You can reach the person managing the list at >> fastcgi-developers-owner at mailman.fastcgi.com >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of FastCGI-developers digest..." >> >> >> Today's Topics: >> >> 1. Re: FastCGI as a Filter? (Rob Lemley) >> 2. Re: FastCGI as a Filter? (tbandrowsky) >> 3. Is there any method (within fcgi) to return a different HTTP >> status code than '200 OK'? (Rick Thorne) >> >> >> ---------------------------------------------------------------------- >> >> >> Message: 1 >> Date: Tue, 27 Oct 2009 14:01:32 -0500 >> From: Rob Lemley >> Subject: Re: [FASTCGI] FastCGI as a Filter? >> To: fastcgi-developers at mailman.pins.net >> Message-ID: <4AE7438C.7070901 at booksys.com> >> Content-Type: text/plain; charset="iso-8859-1" >> >> Date: Sat, 24 Oct 2009 23:52:55 -0400 >> >>> From: tbandrowsky >>> Subject: [FASTCGI] FastCGI as a Filter? >>> >>> I'm trying to make heads or tales of whether or not Apache 2 supports >>> FastCGI as a filter. Basically, I want to have a bunch of files with a >>> particular extension in a directory all get passed through to my FastCGI >>> application rather than get spewed out directly. I've read that one >>> does not need filters to do this, although clearly, filters look like >>> they would be a pretty elegant approach. Can I do this sort of a thing >>> with Apache, or am I just banged and should use something like Sun's web >>> server? >>> >>> >> Apparently mod_fastcgi (the apache fastcgi module) does not support >> FastCGI filter role: >> >> "mod_fastcgi does not implement the Authorizer or Filter roles described >> in the FastCGI specification. However, you can approximate the Filter >> role using Apache's Action directive to route requests to a FastCGI >> Responder. See the documentation for mod_actions for information on the >> Action directive." >> (http://www.fastcgi.com/om_archive/servers/apache/apache-fastcgi/mod_fastcgi.html) >> >> The mod_action solution (which I have no experience with) seems to catch >> all files with a given mime-type or, in this case, extension: >> # Files of a particular file extension >> AddHandler my-file-type .xyz >> Action my-file-type /cgi-bin/program.cgi >> >> which, translated to FastCGI, I think would look something like (untested): >> >> # Files of a particular file extension >> AddHandler my-file-type .xyz >> Action my-file-type /myfastcgiapp >> FastCgiServer /myfastcgiapp .... >> >> I believe the way to set this up with apache AliasMatch directive, >> which allows you to capture input requests based on a more general >> regular expression pattern, to set the Apache2 "AliasMatch" directive to >> pass only the files you want to filter to your FastCGI server: >> >> #APACHE CONFIG: >> >> # NameVirtualHost *:80 >> >> >> ServerName yourserver.example.com >> ServerAlias yourserver >> AliasMatch ^/(path/to/yourfiles/*.ext) /yourfastcgiserver >> >> >> FastCgiExternalServer /yourfastcgiserver -socket >> /var/run/yourfastcgiserver/socket >> >> #END OF APACHE CONFIG >> >> Next, you would implement the FastCGI server to read the files and >> filter them as necessary. This usage of FastCGI is fairly well known >> and I don't have a good concise example in my own code. To filter these >> files, generally all you would do is open the filename found in the >> FastCGI Environment (CGI) variable "SCRIPT_NAME." You might need to >> adjust the directory or something depending on how your server namespace >> is set up. >> >> while accept_fastcgi_request(request) >> #FCGX_Accept(), etc >> script_name = lookup(request.envp, "SCRIPT_NAME") >> filter(script_name) # writes >> using FCGX_PutStr(), may need to Put the HTTP response header too. >> endwhile >> >> >> All of the information about the request will come through the FastCGI >> request. You'll look at various fields in the FastCGI environment to >> determine the file to open and filter. Generally your program might >> look at REQUEST_URI, QUERY_STRING and SCRIPT_NAME. You may also want to >> check for POST request data in some case (depends on having >> "CONTENT_TYPE=multipart/form-data; boundary.....). Or you can just >> ignore any query string and post data and just filter the SCRIPT_NAME. >> >> NOTE: usually (always?) REQUEST_URI == SCRIPT_NAME + "?" + QUERY_STRING >> >> Rob >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> >> ------------------------------ >> >> Message: 2 >> Date: Tue, 27 Oct 2009 22:30:47 -0400 >> From: tbandrowsky >> Subject: Re: [FASTCGI] FastCGI as a Filter? >> To: Garrett Wollman >> Cc: fastcgi-developers at mailman.pins.net >> Message-ID: <1256697047.3271.5.camel at tbandrow-desktop> >> Content-Type: text/plain; charset="UTF-8" >> >> Thanks! Turns out that is exactly what I was trying to do and it works >> wonderfully. >> >> On Mon, 2009-10-26 at 11:53 -0400, Garrett Wollman wrote: >> >>> < said: >>> >>> >>>> I'm trying to make heads or tales of whether or not Apache 2 supports >>>> FastCGI as a filter. Basically, I want to have a bunch of files with a >>>> particular extension in a directory all get passed through to my FastCGI >>>> application rather than get spewed out directly. >>>> >>> That's pretty easy to accomplish, although I don't know about using >>> the filter mechanism for that. Here's what we do for PHP: >>> >>> ScriptAlias /.php5-cgi /usr/bin/php5-cgi >>> Action php5-script /.php5-cgi >>> Action application/x-httpd-fastphp5 /.php5-cgi >>> >>> AddType application/x-httpd-fastphp5 php5 >>> >>> -GAWollman >>> >>> >> >> >> ------------------------------ >> >> Message: 3 >> Date: Wed, 28 Oct 2009 10:51:09 -0400 >> From: Rick Thorne >> Subject: [FASTCGI] Is there any method (within fcgi) to return a >> different HTTP status code than '200 OK'? >> To: fastcgi-developers at mailman.fastcgi.com >> Message-ID: >> <20091028145114.4F00F7C08D at smtp-ext-01.mx.pitdc1.expedient.net> >> Content-Type: text/plain; charset="us-ascii"; format=flowed >> >> Is there any method (within fcgi) to return a HTTP status code other >> than '200 OK'? >> >> I'm serving up images stored in a database; using fcgi and Apache. >> >> Using www.httpviewer.net to track the response 'back' from our >> server, a request for an existing image (through our fcgi >> application) returns the following HTTP information: >> HTTP/1.1 200 OK(CR)(LF) >> Date: Tue, 27 Oct 2009 16:57:57 GMT(CR)(LF) >> Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) >> Content-Length: 3302(CR)(LF) <--- written by our fcgi application >> Content-Type: image/png(CR)(LF) <--- written by our >> fcgi application >> (CR)(LF) <--- written by our >> fcgi application >> ...3302 bytes of .png data <--- written by our >> fcgi application >> >> The web page receives and displays the image correctly. >> >> The web page can also generate requests for images that do not exist, >> and these requests also come through our fcgi application (we don't >> know that they do not exist until we attempt to find them in the database). >> >> We'd like to return the '404 Not Found' header for these non-existent >> images, as in: >> HTTP/1.1 404 Not Found(CR)(LF) >> Date: Tue, 27 Oct 2009 17:04:47 GMT(CR)(LF) >> Server: Apache/2.2.11 (Win32) PHP/5.3.0 mod_fastcgi/2.4.6(CR)(LF) >> (CR)(LF) >> >> However, within our fcgi application I don't appear to have control >> over the first three HTTP response lines (the lines that starts with >> 'HTTP/1.1', 'Date:', and 'Server:'). I believe Apache generates >> these lines when it successfully parses the fcgi request and finds >> the required fcgi startup file. Then it calls the fcgi application >> and pushes the data through the pipes to and from our fcgi application. >> >> In other words, apparently all fcgi applications have to work with >> only the 'HTTP/1.1 200 OK(CR)(LF)' response and cannot change this >> response code to another value. >> >> The FCGX_SetExitStatus() command does 'not' control this HTTP >> response code (?I tried w/o success on the output stream, perhaps I >> should have tried the error stream?). >> >> The current workaround I have for this particular issue is to keep >> the '200 OK' response and return an empty .png image. This solution >> 'works' (in this particular example), but I'd also like to be able to >> respond with other HTTP codes for some other error conditions. >> >> Note: I'm writing this fcgi application in 'C', so I can pretty much >> call any (public) operating system/Apache/fcgi dynamic link library >> entry point. >> >> Thoughts and/or suggestions welcome... >> >> Rick Thorne >> Landbase Systems Corporation >> One World / One Map >> (412)563-9120 (Office) >> (412)563-9122 (Desk) >> >> >> >> ------------------------------ >> >> _______________________________________________ >> FastCGI-developers mailing list >> FastCGI-developers at mailman.fastcgi.com >> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers >> >> >> End of FastCGI-developers Digest, Vol 15, Issue 10 >> ************************************************** >> >> > > > _______________________________________________ > FastCGI-developers mailing list > FastCGI-developers at mailman.fastcgi.com > http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: