initial commit
This commit is contained in:
commit
c91f0380ae
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
config.h.in
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
ltmain.sh
|
||||
missing
|
55
CMakeLists.txt
Normal file
55
CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
|
||||
|
||||
cmake_policy(VERSION 2.6.0)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
INCLUDE(FindPkgConfig)
|
||||
INCLUDE(AddTargetProperties)
|
||||
|
||||
|
||||
PROJECT(scgi-cgi C)
|
||||
SET(PACKAGE_VERSION 0.1.0)
|
||||
|
||||
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
|
||||
OPTION(GCC_LIBEVENT_STATIC "link libevent static")
|
||||
|
||||
# libevent
|
||||
pkg_check_modules (LIBEVENT REQUIRED libevent>=2.0)
|
||||
IF(GCC_LIBEVENT_STATIC)
|
||||
SET(MYLIBEVENT_LDFLAGS -Wl,-Bstatic ${LIBEVENT_LDFLAGS} -Wl,-Bdynamic)
|
||||
ELSE(GCC_LIBEVENT_STATIC)
|
||||
SET(MYLIBEVENT_LDFLAGS ${LIBEVENT_LDFLAGS})
|
||||
ENDIF(GCC_LIBEVENT_STATIC)
|
||||
|
||||
|
||||
SET(MAIN_SOURCE scgi-cgi.c)
|
||||
|
||||
SET(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
||||
SET(PACKAGE_VERSION ${PACKAGE_VERSION})
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h ESCAPE_QUOTES)
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(scgi-cgi ${MAIN_SOURCE})
|
||||
|
||||
ADD_TARGET_PROPERTIES(scgi-cgi COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W -pedantic -fPIC")
|
||||
|
||||
# libev
|
||||
TARGET_LINK_LIBRARIES(scgi-cgi ${MYLIBEVENT_LDFLAGS})
|
||||
ADD_TARGET_PROPERTIES(scgi-cgi COMPILE_FLAGS ${LIBEVENT_CFLAGS})
|
||||
|
||||
INSTALL(TARGETS scgi-cgi DESTINATION bin)
|
||||
|
||||
# man page
|
||||
|
||||
SET(CMAKE_MAN_DIR "share/man" CACHE STRING
|
||||
"Install location for man pages (relative to prefix).")
|
||||
MARK_AS_ADVANCED(CMAKE_MAN_DIR)
|
||||
|
||||
INSTALL(FILES scgi-cgi.1 DESTINATION ${CMAKE_MAN_DIR}/man1)
|
22
COPYING
Normal file
22
COPYING
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2013 Stefan Bühler
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
8
Makefile.am
Normal file
8
Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
EXTRA_DIST=autogen.sh CMakeLists.txt config.h.cmake scgi-cgi.1 README.rst
|
||||
man1_MANS=scgi-cgi.1
|
||||
|
||||
AM_CFLAGS=$(LIBEVENT_CFLAGS)
|
||||
scgi_cgi_LDADD=$(LIBEVENT_LIBS)
|
||||
|
||||
bin_PROGRAMS=scgi-cgi
|
||||
scgi_cgi_SOURCES=scgi-cgi.c
|
50
README.rst
Normal file
50
README.rst
Normal file
@ -0,0 +1,50 @@
|
||||
Description
|
||||
-----------
|
||||
|
||||
:Homepage:
|
||||
http://redmine.lighttpd.net/projects/scgi-cgi/wiki
|
||||
|
||||
scgi-cgi is a SCGI application to run normal cgi applications. It doesn't
|
||||
make CGI applications faster, but it allows you to run them on a different
|
||||
host and with different user permissions (without the need for suexec).
|
||||
|
||||
scgi-cgi is released under the `MIT license <http://git.lighttpd.net/scgi-cgi.cgi/tree/COPYING>`_
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Examples for spawning a scgi-cgi instance with daemontools or runit::
|
||||
|
||||
#!/bin/sh
|
||||
# run script
|
||||
|
||||
exec spawn-scgi -n -s /var/run/scgi-cgi.sock -u www-default -U www-data -- /usr/bin/scgi-cgi
|
||||
|
||||
|
||||
Build dependencies
|
||||
------------------
|
||||
|
||||
* libevent (http://libevent.org/)
|
||||
* cmake or autotools (for snapshots/releases the autotool generated files are included)
|
||||
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
* snapshot/release with autotools::
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
* build from git: ``git clone git://git.lighttpd.net/scgi-cgi.git``
|
||||
|
||||
* with autotools::
|
||||
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
|
||||
* with cmake (should work with snapshots/releases too)::
|
||||
|
||||
cmake .
|
||||
make
|
38
autogen.sh
Executable file
38
autogen.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
if which glibtoolize >/dev/null 2>&1; then
|
||||
LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}
|
||||
else
|
||||
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
|
||||
fi
|
||||
LIBTOOLIZE_FLAGS="--copy --force"
|
||||
ACLOCAL=${ACLOCAL:-aclocal}
|
||||
AUTOHEADER=${AUTOHEADER:-autoheader}
|
||||
AUTOMAKE=${AUTOMAKE:-automake}
|
||||
AUTOMAKE_FLAGS="--add-missing --copy"
|
||||
AUTOCONF=${AUTOCONF:-autoconf}
|
||||
|
||||
ARGV0=$0
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f configure.ac -o ! -f COPYING ]; then
|
||||
echo "Doesn't look like you're in the source directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run() {
|
||||
echo "$ARGV0: running \`$@'"
|
||||
$@
|
||||
}
|
||||
|
||||
run rm -f aclocal.m4 ar-lib config.guess config.sub configure depcomp instal-sh ltmain.sh missing
|
||||
run rm -rf m4 autom4te.cache
|
||||
|
||||
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS
|
||||
run $ACLOCAL $ACLOCAL_FLAGS
|
||||
run $AUTOHEADER
|
||||
run $AUTOMAKE $AUTOMAKE_FLAGS
|
||||
run $AUTOCONF
|
||||
echo "Now type './configure ...' and 'make' to compile."
|
13
cmake/AddTargetProperties.cmake
Normal file
13
cmake/AddTargetProperties.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
MACRO(ADD_TARGET_PROPERTIES _target _name)
|
||||
SET(_properties)
|
||||
FOREACH(_prop ${ARGN})
|
||||
SET(_properties "${_properties} ${_prop}")
|
||||
ENDFOREACH(_prop)
|
||||
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
|
||||
MESSAGE(STATUS "adding property to ${_target} ${_name}:" ${_properties})
|
||||
IF(NOT _old_properties)
|
||||
# in case it's NOTFOUND
|
||||
SET(_old_properties)
|
||||
ENDIF(NOT _old_properties)
|
||||
SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
|
||||
ENDMACRO(ADD_TARGET_PROPERTIES)
|
6
config.h.cmake
Normal file
6
config.h.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
CMake autogenerated config.h file. Do not edit!
|
||||
*/
|
||||
|
||||
#define PACKAGE_NAME "${PACKAGE_NAME}"
|
||||
#define PACKAGE_VERSION "${PACKAGE_VERSION}"
|
49
configure.ac
Normal file
49
configure.ac
Normal file
@ -0,0 +1,49 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.63])
|
||||
AC_INIT([scgi-cgi], [0.1.0], [lighttpd@stbuehler.de])
|
||||
AC_CONFIG_SRCDIR([scgi-cgi.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# libevent
|
||||
PKG_CHECK_MODULES(LIBEVENT, libevent >= 2.0, [],[AC_MSG_ERROR("libevent >= 2.0 not found")])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h stdlib.h string.h sys/socket.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_FORK
|
||||
AC_CHECK_FUNCS([dup2])
|
||||
|
||||
# check for extra compiler options (warning options)
|
||||
if test "${GCC}" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra-warnings,
|
||||
AC_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)]),
|
||||
[case "${enableval}" in
|
||||
yes) extrawarnings=true ;;
|
||||
no) extrawarnings=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-warnings) ;;
|
||||
esac],[extrawarnings=false])
|
||||
|
||||
if test x$extrawarnings = xtrue; then
|
||||
CFLAGS="${CFLAGS} -g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wno-pointer-sign -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed -Wformat-security"
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
30
scgi-cgi.1
Normal file
30
scgi-cgi.1
Normal file
@ -0,0 +1,30 @@
|
||||
.TH scgi-cgi 1 "Oct 1, 2013"
|
||||
.
|
||||
.SH NAME
|
||||
.
|
||||
scgi-cgi \- a SCGI application to run cgi applications
|
||||
.
|
||||
.SH OPTIONS
|
||||
.
|
||||
.TP 8
|
||||
.B \-b <binary>
|
||||
Executable to start instead of INTERPRETER or SCRIPT_FILENAME from SCGI environment.
|
||||
.TP 8
|
||||
.B \-c <number>
|
||||
Maximum number of connections (default 16)
|
||||
.TP 8
|
||||
.B \-v
|
||||
Shows version information and exits
|
||||
.
|
||||
.SH DESCRIPTION
|
||||
scgi-cgi is a SCGI application to run normal cgi applications. It doesn't
|
||||
make CGI applications faster, but it allows you to run them on a different
|
||||
host and with different user permissions (without the need for suexec).
|
||||
.P
|
||||
For running you probably want spawn-fcgi (http://redmine.lighttpd.net/projects/spawn-fcgi)
|
||||
.SH EXAMPLE
|
||||
Example usage:
|
||||
|
||||
spawn-fcgi -n -s /var/run/scgi-cgi.sock -u www-default -U www-data -- /usr/bin/scgi-cgi
|
||||
.SH AUTHOR
|
||||
scgi-cgi was written by Stefan Bühler.
|
1263
scgi-cgi.c
Normal file
1263
scgi-cgi.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user