Sync from SUSE:SLFO:Main FastCGI revision a7f2fb7c45a16bec058c3d2ec1169b73

This commit is contained in:
Adrian Schröter 2024-05-03 10:44:26 +02:00
commit c941656c9e
13 changed files with 733 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
2.4.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,88 @@
--- cgi-fcgi/cgi-fcgi.c
+++ cgi-fcgi/cgi-fcgi.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#include "fcgi_config.h"
@@ -145,7 +146,7 @@
static int bytesToRead; /* number of bytes to read from Web Server */
-static int appServerSock = -1; /* Socket connected to FastCGI application,
+static size_t appServerSock = -1; /* Socket connected to FastCGI application,
* used by AppServerReadHandler and
* AppServerWriteHandler. */
static Buffer fromAS; /* Bytes read from the FCGI application server. */
@@ -640,7 +641,7 @@
}
if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) {
fprintf(stderr, "Cannot allocate %d bytes\n",
- strlen(tp1)+1);
+ (int)strlen(tp1)+1);
exit(-1);
}
strcpy(av[ac++], tp1);
--- examples/threaded.c
+++ examples/threaded.c
@@ -24,7 +24,7 @@
static void *doit(void *a)
{
- int rc, i, thread_id = (int)a;
+ size_t rc, i, thread_id = (size_t)a;
pid_t pid = getpid();
FCGX_Request request;
char *server_name;
@@ -53,7 +53,7 @@
"<h1>FastCGI Hello! (multi-threaded C, fcgiapp library)</h1>"
"Thread %d, Process %ld<p>"
"Request counts for %d threads running on host <i>%s</i><p><code>",
- thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
+ (int)thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
sleep(2);
@@ -71,7 +71,7 @@
int main(void)
{
- int i;
+ size_t i;
pthread_t id[THREAD_COUNT];
FCGX_Init();
--- include/fcgios.h
+++ include/fcgios.h
@@ -93,7 +93,7 @@
# if defined(__STDC__) || defined(__cplusplus)
typedef void *ClientData;
# else
- typedef int *ClientData;
+ typedef size_t *ClientData;
# endif /* __STDC__ */
#define _CLIENTDATA
#endif
--- libfcgi/os_unix.c
+++ libfcgi/os_unix.c
@@ -1155,7 +1155,7 @@
for (;;) {
do {
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);
@@ -1255,7 +1255,7 @@
struct sockaddr_in in;
struct sockaddr_un un;
} sa;
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);

View File

@ -0,0 +1,53 @@
From: Florian Ragwitz <rafl@debian.org>
Date: Sat, 24 Sep 2011 07:54:33 +0000 (+0200)
Subject: Stop leaking information across requests
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2Ffcgi2.git;a=commitdiff_plain;h=297693dc8362d25bb25e473899c72508a0f71d2e
Stop leaking information across requests
%hash is false if the hash hasn't been assigned to, *or* if the hash is simply
empty. This causes the environment from the *second* request (that is, the
environment produced by the first request) to be saved as default if the first
request had empty environment. This way, request after the first can get access
to credentials set up by the first request.
Instead of fixing this, I'd much rather remove this old and buggy
interface. However, 10 years of deprecation don't seem to have been enough for
CGI::Fast to switch to the new and properly supported interface. :-(
This is CVE-2011-2766.
---
Index: perl/FCGI.PL
===================================================================
--- perl/FCGI.PL.orig 2002-12-15 21:02:48.000000000 +0100
+++ perl/FCGI.PL 2011-12-12 11:24:08.885998082 +0100
@@ -291,14 +291,14 @@ sub Request(;***$*$) {
sub accept() {
warn "accept called as a method; you probably wanted to call Accept" if @_;
- if (defined %FCGI::ENV) {
- %ENV = %FCGI::ENV;
+ if ( defined($FCGI::ENV) ) {
+ %ENV = %$FCGI::ENV;
} else {
- %FCGI::ENV = %ENV;
+ $FCGI::ENV = {%ENV};
}
my $rc = Accept($global_request);
- for (keys %FCGI::ENV) {
- $ENV{$_} = $FCGI::ENV{$_} unless exists $ENV{$_};
+ for (keys %$FCGI::ENV) {
+ $ENV{$_} = $FCGI::ENV->{$_} unless exists $ENV{$_};
}
# not SFIO
@@ -310,7 +310,7 @@ sub accept() {
sub finish() {
warn "finish called as a method; you probably wanted to call Finish" if @_;
- %ENV = %FCGI::ENV if (defined %FCGI::ENV);
+ %ENV = %$FCGI::ENV if defined($FCGI::ENV);
# not SFIO
if (tied (*STDIN)) {

10
FastCGI-gcc44.patch Normal file
View File

@ -0,0 +1,10 @@
--- libfcgi/fcgio.cpp
+++ libfcgi/fcgio.cpp
@@ -23,6 +23,7 @@
#endif
#include <limits.h>
+#include <stdio.h>
#include "fcgio.h"
using std::streambuf;

View File

@ -0,0 +1,33 @@
--- cgi-fcgi/Makefile.am
+++ cgi-fcgi/Makefile.am
@@ -2,7 +2,7 @@
bin_PROGRAMS = cgi-fcgi
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \
--- examples/Makefile.am
+++ examples/Makefile.am
@@ -11,7 +11,7 @@
EXTRA_PROGRAMS = threaded echo-cpp
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \
--- libfcgi/Makefile.am
+++ libfcgi/Makefile.am
@@ -1,7 +1,7 @@
# $Id: Makefile.am,v 1.9 2001/12/22 03:16:20 robs Exp $
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \

26
FastCGI-perl514.patch Normal file
View File

@ -0,0 +1,26 @@
--- perl/Makefile.PL 2002-12-15 20:40:19.000000000 +0100
+++ perl/Makefile.PL 2011-05-26 22:28:06.673024204 +0200
@@ -99,10 +99,7 @@
# the contents of the Makefile that is written.
# Work around bug in previous versions of MakeMaker
-WriteMakefile(NAME => 'FCGI')
- if $ExtUtils::MakeMaker::VERSION <= 5.4302;
-
-$mm = MM->new({
+WriteMakefile(
'NAME' => 'FCGI',
'VERSION_FROM' => 'version.pm',
'dist' => { 'COMPRESS' => 'gzip -9f',
@@ -123,10 +120,7 @@
'PL_FILES' => $plfiles,
PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
@extras,
-});
-# don't install oldinterface pod
-delete $mm->{MAN3PODS}{oldinterface.pod};
-$mm->flush;
+);
exit if -f 'fcgi_config.h' or $libfound or $pure;

13
FastCGI-perl526.patch Normal file
View File

@ -0,0 +1,13 @@
Index: fcgi-2.4.0/perl/FCGI.PL
===================================================================
--- fcgi-2.4.0.orig/perl/FCGI.PL
+++ fcgi-2.4.0/perl/FCGI.PL
@@ -1,7 +1,7 @@
use Config;
use ExtUtils::MakeMaker;
-do 'FCGI.cfg' or die "no FCGI.cfg";
+do './FCGI.cfg' or die "no FCGI.cfg";
open OUT, ">FCGI.pm";

View File

@ -0,0 +1,121 @@
Index: cgi-fcgi/cgi-fcgi.c
===================================================================
--- cgi-fcgi/cgi-fcgi.c.orig
+++ cgi-fcgi/cgi-fcgi.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
#include "fcgi_config.h"
@@ -583,7 +585,7 @@
#define MAXARGS 16
static int ParseArgs(int argc, char *argv[],
int *doBindPtr, int *doStartPtr,
- char *connectPathPtr, char *appPathPtr, int *nServersPtr) {
+ char *connectPathPtr, char *appPathPtr, int *nServersPtr, int *doDaemonPtr) {
int i,
x,
err = 0,
@@ -599,6 +601,7 @@
*connectPathPtr = '\0';
*appPathPtr = '\0';
*nServersPtr = 0;
+ *doDaemonPtr = TRUE;
for(i = 0; i < MAXARGS; i++)
av[i] = NULL;
@@ -649,7 +652,7 @@
}
}
err = ParseArgs(ac, av, doBindPtr, doStartPtr,
- connectPathPtr, appPathPtr, nServersPtr);
+ connectPathPtr, appPathPtr, nServersPtr, doDaemonPtr);
for(x = 1; x < ac; x++) {
ASSERT(av[x] != NULL);
free(av[x]);
@@ -673,7 +676,9 @@
} else {
strcpy(connectPathPtr, argv[i]);
}
- } else {
+ } else if(!strcmp(argv[i], "-supervise")) {
+ *doDaemonPtr = FALSE;
+ } else {
fprintf(stderr, "Unknown option %s\n", argv[i]);
err++;
}
@@ -718,6 +723,15 @@
return err;
}
+void handle_shutdown(int s)
+{
+ /* Kill our children processes */
+ signal(s, SIG_IGN);
+ kill(0, s);
+
+ exit(0);
+}
+
int main(int argc, char **argv)
{
char **envp = environ;
@@ -728,20 +742,22 @@
int headerLen, valueLen;
char *equalPtr;
FCGI_BeginRequestRecord beginRecord;
- int doBind, doStart, nServers;
+ int doBind, doStart, nServers, doDaemon;
char appPath[MAXPATHLEN], bindPath[MAXPATHLEN];
+ int pid;
if(ParseArgs(argc, argv, &doBind, &doStart,
- (char *) &bindPath, (char *) &appPath, &nServers)) {
+ (char *) &bindPath, (char *) &appPath, &nServers, &doDaemon)) {
fprintf(stderr,
"Usage:\n"
" cgi-fcgi -f <cmdPath> , or\n"
" cgi-fcgi -connect <connName> <appPath> [<nServers>] , or\n"
-" cgi-fcgi -start -connect <connName> <appPath> [<nServers>] , or\n"
+" cgi-fcgi -start -connect [-supervise] <connName> <appPath> [<nServers>] , or\n"
" cgi-fcgi -bind -connect <connName> ,\n"
"where <connName> is either the pathname of a UNIX domain socket\n"
"or (if -bind is given) a hostName:portNumber specification\n"
-"or (if -start is given) a :portNumber specification (uses local host).\n");
+"or (if -start is given) a :portNumber specification (uses local host).\n"
+"-supervise is for running with runit or daemontools.\n");
exit(1);
}
@@ -757,12 +773,27 @@
bytesToRead = 0;
}
+ /* Become a process group leader */
+ setsid();
+
+ /* Register our signal handler */
+ signal(SIGHUP, handle_shutdown);
+ signal(SIGINT, handle_shutdown);
+ signal(SIGTERM, handle_shutdown);
+
if(doBind) {
appServerSock = OS_FcgiConnect(bindPath);
}
if(doStart && (!doBind || appServerSock < 0)) {
FCGI_Start(bindPath, appPath, nServers);
if(!doBind) {
+ if(!doDaemon) {
+ for(pid=nServers; pid != 0; pid--) {
+ wait(0);
+ }
+ }
+ signal(SIGTERM, SIG_IGN);
+ kill(0, SIGTERM);
exit(0);
} else {
appServerSock = OS_FcgiConnect(bindPath);

142
FastCGI.changes Normal file
View File

@ -0,0 +1,142 @@
-------------------------------------------------------------------
Thu May 11 15:44:16 UTC 2023 - Frederic Crozat <fcrozat@suse.com>
- Fix url for website and source, upstream is dead for a while.
-------------------------------------------------------------------
Sun Sep 24 08:10:16 UTC 2017 - coolo@suse.com
- add FastCGI-perl526.patch as perl 5.26 no longer has . in @INC
-------------------------------------------------------------------
Sat Dec 20 11:57:22 UTC 2014 - jengelh@inai.de
- "libfcgi++-0" package name is wrong (should be "libfcgi++0");
change to libfcgi0 (due to libfcgi.so.0 being present, which is
the main one).
- Remove pointless --with-pic (it is enabled by default anyway)
-------------------------------------------------------------------
Sat Dec 13 13:33:33 UTC 2014 - p.drouand@gmail.com
- Split out the system library, following the shared library
conventions
- Make devel subpackage depends on shared library package
-------------------------------------------------------------------
Mon Sep 1 07:41:20 UTC 2014 - fcrozat@suse.com
- Update license tag to spdx 1.2.
-------------------------------------------------------------------
Wed Mar 20 13:13:06 UTC 2013 - boris@steki.net
- re-enable SLE support as %perl_requires is too new
-------------------------------------------------------------------
Mon Jun 11 12:12:00 UTC 2012 - coolo@suse.com
- require the right version of perl
-------------------------------------------------------------------
Tue Mar 27 08:35:39 UTC 2012 - cfarrell@suse.com
- license update: SUSE-OML
Use SUSE- proprietary prefix until license is accepted upstream by
SPDX.org. Fedora tracks this as OML.
-------------------------------------------------------------------
Wed Dec 21 16:14:12 UTC 2011 - mrueckert@suse.com
- added FastCGI-fix_deprecated_api.patch: (bnc#735882)
Fixes an issue where CGI.pm received CGI variables from previous
requests. CVE-2011-2766
-------------------------------------------------------------------
Sat Oct 15 04:47:09 UTC 2011 - coolo@suse.com
- add libtool as buildrequire to make the spec file more reliable
-------------------------------------------------------------------
Sat Sep 17 09:16:06 UTC 2011 - jengelh@medozas.de
- Remove redundant tags/sections from specfile
- Enable parallel build
-------------------------------------------------------------------
Thu May 26 20:30:01 UTC 2011 - idonmez@novell.com
- Add FastCGI-perl514.patch: fix compilation with Perl 5.14
-------------------------------------------------------------------
Mon Dec 6 09:25:04 UTC 2010 - coolo@novell.com
- fix build for factory
-------------------------------------------------------------------
Sun Dec 20 18:13:46 CET 2009 - jengelh@medozas.de
- enable parallel build
-------------------------------------------------------------------
Thu Sep 17 18:23:25 CEST 2009 - mrueckert@suse.de
- add fastcgi-2.4.0_missing_call_to_fclose.patch (bnc#525009)
-------------------------------------------------------------------
Thu Jun 26 05:14:15 CEST 2009 - crrodriguez@suse.de
- disable static libraries
-------------------------------------------------------------------
Mon Feb 16 19:53:18 CET 2009 - coolo@suse.de
- fix build with gcc 4.4
-------------------------------------------------------------------
Fri Oct 20 03:27:49 CEST 2006 - mrueckert@suse.de
- remove perl_make_install for now ... i wont build for fedora
any time soon.
-------------------------------------------------------------------
Fri Sep 15 10:37:47 CEST 2006 - mrueckert@suse.de
- add perl_make_install for all distros other than suse.
-------------------------------------------------------------------
Fri Sep 8 03:02:47 CEST 2006 - mrueckert@suse.de
- add README.supervise
- small spec file cleanup
-------------------------------------------------------------------
Thu Sep 7 16:42:33 CEST 2006 - mrueckert@suse.de
- applied patch from
http://rubyists.com/articles/2005/05/03/spawn-fcgi-in-the-foreground
to run fastcgi application in foreground this is useful for tools
like runit/daemontools/initng
-------------------------------------------------------------------
Thu Aug 24 07:00:16 CEST 2006 - mrueckert@suse.de
- run ldconfig
-------------------------------------------------------------------
Wed Mar 8 04:11:07 CET 2006 - mrueckert@suse.de
- readded gcc-c++ to the BuildRequires
Seems it got lost in the automatic BuildRequires conversion.
fixes C++ bindings.
-------------------------------------------------------------------
Wed Jan 25 21:31:12 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Wed Aug 17 14:39:21 CEST 2005 - mrueckert@suse.de
- Initial package with version 2.4.0

170
FastCGI.spec Normal file
View File

@ -0,0 +1,170 @@
#
# spec file for package FastCGI
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: FastCGI
%define lname libfcgi0
Version: 2.4.0
Release: 0
Summary: A Scalable, Open Extension to CGI
License: OML
Group: Development/Languages/C and C++
URL: https://fastcgi-archives.github.io/
Source: https://github.com/FastCGI-Archives/fcgi2/archive/%{version}.tar.gz
Source1: README.supervise
Patch0: FastCGI-makefile.am_cppflags.patch
Patch1: FastCGI-clientdata_pointer.patch
Patch2: FastCGI-supervise_cgi-fcgi.patch
Patch3: fastcgi-2.4.0_missing_call_to_fclose.patch
Patch4: FastCGI-gcc44.patch
Patch5: FastCGI-perl514.patch
Patch6: FastCGI-fix_deprecated_api.patch
Patch7: FastCGI-perl526.patch
BuildRequires: automake
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: perl
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
FastCGI is a language-independent, scalable, open extension to CGI that
provides high performance without the limitations of server-specific
APIs.
%package devel
Summary: A scalable, open extension to CGI
Group: Development/Languages/C and C++
Requires: %lname = %version
Requires: glibc-devel
%description devel
FastCGI is a language independent, scalable, open extension to CGI that
provides high performance without the limitations of server specific
APIs.
%package -n %lname
Summary: A scalable, open extension to CGI - System library
Group: System/Libraries
Obsoletes: libfcgi++-0 < %version-%release
Provides: libfcgi++-0 = %version-%release
%description -n %lname
FastCGI is a language independent, scalable, open extension to CGI that
provides high performance without the limitations of server specific
APIs.
%package -n perl-FastCGI
Summary: A scalable, open extension to CGI
Group: Development/Languages/C and C++
Requires: %{name} = %{version}
%if 0%{?suse_version} < 1120
Requires: perl >= 5.8.0
%else
%{perl_requires}
%endif
%description -n perl-FastCGI
FastCGI is a language independent, scalable, open extension to CGI that
provides high performance without the limitations of server specific
APIs.
%prep
%setup -n fcgi2-%{version}
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7 -p1
touch NEWS AUTHORS ChangeLog COPYING
find doc/{fastcgi-prog-guide,fastcgi-whitepaper} -type f -print0 | xargs -r0 chmod 0644
cp include/fcgi_config.h.in .
cp include/fcgi_config.h.in perl
%build
libtoolize --force
aclocal
automake --add-missing
autoconf
%configure --disable-static --includedir=%{_includedir}/fastcgi
make all
pushd perl
libtoolize --force
aclocal -I..
autoconf
%configure --disable-static --includedir=%{_includedir}/fastcgi
%{__perl} Makefile.PL
make %{?_smp_mflags} all
popd
%install
%make_install
pushd perl
%perl_make_install
%perl_process_packlist
popd
pushd examples
%{__make} clean
popd
%{__install} -Dd -m 0755 \
%{buildroot}%{_mandir}/man{1,3}/ \
%{buildroot}%{_docdir}/%{name}/examples/
%{__install} -m 0644 examples/* %{buildroot}%{_docdir}/%{name}/examples/
%{__install} -m 0644 doc/*.1 %{buildroot}%{_mandir}/man1/
%{__install} -m 0644 doc/*.3 %{buildroot}%{_mandir}/man3/
%{__install} -m 0644 doc/*.htm* doc/*.gif LICENSE.TERMS README \
%{buildroot}%{_docdir}/%{name}/
%{__install} -m 0644 perl/README %{buildroot}%{_docdir}/%{name}/README.perl
%{__install} -m 0644 perl/ChangeLog %{buildroot}%{_docdir}/%{name}/ChangeLog.perl
%{__cp} -vr doc/{fastcgi-prog-guide,fastcgi-whitepaper} java %{S:1} \
%{buildroot}%{_docdir}/%{name}/
rm -f %{buildroot}%{_libdir}/libfcgi*.la
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_bindir}/cgi-fcgi
%{_mandir}/man1/*.1.gz
%doc %{_docdir}/%{name}
%files devel
%defattr(-,root,root)
%dir %{_includedir}/fastcgi/
%{_includedir}/fastcgi/*
%{_libdir}/libfcgi*.so
%{_mandir}/man3/*.3.gz
%files -n %lname
%defattr(-,root,root)
%{_libdir}/libfcgi*.so.*
%files -n perl-FastCGI
%defattr(-,root,root)
%{_mandir}/man3/*.3pm.gz
%{perl_vendorarch}/FCGI.pm
%dir %{perl_vendorarch}/auto/FCGI
%{perl_vendorarch}/auto/FCGI/*.*
%if %suse_version < 1140
%{perl_vendorarch}/auto/FCGI/.packlist
%{_var}/adm/perl-modules/%{name}
%endif
%changelog

39
README.supervise Normal file
View File

@ -0,0 +1,39 @@
taken from http://rubyists.com/articles/2005/05/03/spawn-fcgi-in-the-foreground:
spawn-fcgi in the foreground!
by Bougyman Tue, 03 May 2005 11:00:00 GMT
Been looking for a clean way to spawn fastcgi listeners in the foreground and I
believe Trey has figured it out. This patch should take care of it by keeping
spawn-fcgi from losing track of the copied listening processes and allow full
supervison. To use, call your cgi-fcgi -start -connect $host:$port script with
the -supervise option, like:
cgi-fcgi -start -supervise -connect 127.0.0.1:1791 /path/to/dispatch.fcgi
Full Supervise run script becomes
#!/bin/sh
RAIL_NUMBER=$(basename $PWD|awk -F'-' '{print $2}')
RAILS_HOST=$(<env/RAILS_HOST)
RAILS_ROOT=$(<env/RAILS_ROOT)
RAILS_PORT=179$RAIL_NUMBER
exec envdir ./env \
cgi-fcgi -supervise -start -connect \
$RAILS_HOST:$RAILS_PORT \
$RAILS_ROOT/public/dispatch.fcgi
This would be in a script called run in your ~/service/someapp-$RAIL_NUMBER
directory, where $RAIL_NUMBER is 1-99. The references to ./env require a
directory named env to be set up in the same directory as the run script.
This should have at least 3 files in it:
RAILS_ROOT => contains one line that is the full path to your rails root directory.
RAILS_ENV => contains one word, either production or development
RAILS_HOST => contains one IP address or FQDN
You can set any other environment variables in this way by simply creating a
file with the variable name and its contents will become the value of that
environment variable. Because of the envdir ./env call before the cgi-fcgi
call, your rails application has access to any variables set in this way.

View File

@ -0,0 +1,12 @@
Index: cgi-fcgi/cgi-fcgi.c
===================================================================
--- cgi-fcgi/cgi-fcgi.c.orig 2009-09-17 18:14:16.000000000 +0200
+++ cgi-fcgi/cgi-fcgi.c 2009-09-17 18:19:16.139029013 +0200
@@ -651,6 +651,7 @@ static int ParseArgs(int argc, char *arg
tp1 = tp2;
}
}
+ fclose(fp);
err = ParseArgs(ac, av, doBindPtr, doStartPtr,
connectPathPtr, appPathPtr, nServersPtr, doDaemonPtr);
for(x = 1; x < ac; x++) {