Commit 9e5e6d0e authored by Garrett Rooney's avatar Garrett Rooney
Browse files

Merge the fcgi-proxy-dev branch to trunk, adding a FastCGI back end for

mod_proxy.  This log message is just a summary of the changes, for the
full original log messages see r357431:393955 in branches/fcgi-proxy-dev.

* modules/proxy/mod_proxy_fcgi.c: New file, holds the impementation of
  our new fcgi backend for mod_proxy.

* modules/proxy/fcgi_protocol.h: New file, holds constants and structures
  for the fcgi protocol.

* modules/proxy/mod_proxy_balancer.c
  (proxy_balancer_canon): Set up r->path_info, so the PATH_INFO env
   variable is correctly passed on to balancer workers.

* modules/proxy/config.m4: Build the new mod_proxy_fcgi module.

* support: Add fcgistarter to svn:ignore.

* support/Makefile.in: Build the new fcgistarter program.

* support/fcgistarter.c: New program, a helper for starting fcgi worker
  processes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@396063 13f79535-47bb-0310-9956-ffa450edef68
parent fb169dd6
Loading
Loading
Loading
Loading
+3 −0
Changes for modules/proxy/config.m4: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ APACHE_MODULE(proxy, Apache proxy module, $proxy_objs, , $proxy_mods_enable)
proxy_connect_objs="mod_proxy_connect.lo"
proxy_ftp_objs="mod_proxy_ftp.lo"
proxy_http_objs="mod_proxy_http.lo"
proxy_fcgi_objs="mod_proxy_fcgi.lo"
proxy_ajp_objs="mod_proxy_ajp.lo ajp_header.lo ajp_link.lo ajp_msg.lo"
proxy_balancer_objs="mod_proxy_balancer.lo"

@@ -26,6 +27,7 @@ case "$host" in
    proxy_connect_objs="$proxy_connect_objs mod_proxy.la"
    proxy_ftp_objs="$proxy_ftp_objs mod_proxy.la"
    proxy_http_objs="$proxy_http_objs mod_proxy.la"
    proxy_fcgi_objs="$proxy_fcgi_objs mod_proxy.la"
    proxy_ajp_objs="$proxy_ajp_objs mod_proxy.la"
    proxy_balancer_objs="$proxy_balancer_objs mod_proxy.la"
    ;;
@@ -34,6 +36,7 @@ esac
APACHE_MODULE(proxy_connect, Apache proxy CONNECT module, $proxy_connect_objs, , $proxy_mods_enable)
APACHE_MODULE(proxy_ftp, Apache proxy FTP module, $proxy_ftp_objs, , $proxy_mods_enable)
APACHE_MODULE(proxy_http, Apache proxy HTTP module, $proxy_http_objs, , $proxy_mods_enable)
APACHE_MODULE(proxy_fcgi, Apache proxy FastCGI module, $proxy_fcgi_objs, , $proxy_mods_enable)
APACHE_MODULE(proxy_ajp, Apache proxy AJP module, $proxy_ajp_objs, , $proxy_mods_enable)
APACHE_MODULE(proxy_balancer, Apache proxy BALANCER module, $proxy_balancer_objs, , $proxy_mods_enable)

+107 −0
Changes for modules/proxy/fcgi_protocol.h: 107 added lines, 0 removed lines.
Original line number Diff line number Diff line
/* Copyright 2005 The Apache Software Foundation or its licensors, as
 * applicable.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file fcgi_protocol.h
 * @brief FastCGI protocol defines
 *
 * @addtogroup FCGI_defines
 * @{
 */

#ifndef FCGI_PROTOCOL_H
#define FCGI_PROTOCOL_H


#define FCGI_VERSION 1

#define FCGI_BEGIN_REQUEST       1
#define FCGI_ABORT_REQUEST       2
#define FCGI_END_REQUEST         3
#define FCGI_PARAMS              4
#define FCGI_STDIN               5
#define FCGI_STDOUT              6
#define FCGI_STDERR              7
#define FCGI_DATA                8
#define FCGI_GET_VALUES          9
#define FCGI_GET_VALUES_RESULT  10
#define FCGI_UNKNOWN_TYPE       11
#define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)

typedef struct {
    unsigned char version;
    unsigned char type;
    unsigned char requestIdB1;
    unsigned char requestIdB0;
    unsigned char contentLengthB1;
    unsigned char contentLengthB0;
    unsigned char paddingLength;
    unsigned char reserved;
} fcgi_header;

#define FCGI_HDR_VERSION_OFFSET         0
#define FCGI_HDR_TYPE_OFFSET            1
#define FCGI_HDR_REQUEST_ID_B1_OFFSET   2
#define FCGI_HDR_REQUEST_ID_B0_OFFSET   3
#define FCGI_HDR_CONTENT_LEN_B1_OFFSET  4
#define FCGI_HDR_CONTENT_LEN_B0_OFFSET  5
#define FCGI_HDR_PADDING_LEN_OFFSET     6
#define FCGI_HDR_RESERVED_OFFSET        7

#define FCGI_BRB_ROLEB1_OFFSET       0
#define FCGI_BRB_ROLEB0_OFFSET       1
#define FCGI_BRB_FLAGS_OFFSET        2
#define FCGI_BRB_RESERVED0_OFFSET    3
#define FCGI_BRB_RESERVED1_OFFSET    4
#define FCGI_BRB_RESERVED2_OFFSET    5
#define FCGI_BRB_RESERVED3_OFFSET    6
#define FCGI_BRB_RESERVED4_OFFSET    7

/*
 * Number of bytes in a fcgi_header.  Future versions of the protocol
 * will not reduce this number.
 */
#define FCGI_HEADER_LEN  8

/*
 * Mask for flags component of FCGI_BeginRequestBody
 */
#define FCGI_KEEP_CONN  1

/*
 * Values for role component of FCGI_BeginRequestBody
 */
#define FCGI_RESPONDER  1
#define FCGI_AUTHORIZER 2
#define FCGI_FILTER     3

typedef struct {
    unsigned char roleB1;
    unsigned char roleB0;
    unsigned char flags;
    unsigned char reserved[5];
} fcgi_begin_request_body;

/*
 * Maximum size of the allowed environment.
 */
#define FCGI_MAX_ENV_SIZE  65535

/* #define FCGI_DUMP_ENV_VARS */


#endif /* FCGI_PROTOCOL_H */
/** @} */
+3 −0
Changes for modules/proxy/mod_proxy_balancer.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ static int proxy_balancer_canon(request_rec *r, char *url)

    r->filename = apr_pstrcat(r->pool, "proxy:balancer://", host,
            "/", path, (search) ? "?" : "", (search) ? search : "", NULL);

    r->path_info = apr_pstrcat(r->pool, "/", path, NULL);

    return OK;
}

+993 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −1
Changes for support/Makefile.in: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ DISTCLEAN_TARGETS = apxs apachectl dbmmanage log_server_status \

CLEAN_TARGETS = suexec

PROGRAMS = htpasswd htdigest rotatelogs logresolve ab checkgid htdbm htcacheclean httxt2dbm
PROGRAMS = htpasswd htdigest rotatelogs logresolve ab checkgid htdbm htcacheclean httxt2dbm fcgistarter
TARGETS  = $(PROGRAMS)

PROGRAM_LDADD        = $(UTIL_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) $(AP_LIBS)
@@ -70,3 +70,6 @@ httxt2dbm_OBJECTS = httxt2dbm.lo
httxt2dbm: $(httxt2dbm_OBJECTS)
	$(LINK) $(httxt2dbm_LTFLAGS) $(httxt2dbm_OBJECTS) $(PROGRAM_LDADD)

fcgistarter_OBJECTS = fcgistarter.lo
fcgistarter: $(fcgistarter_OBJECTS)
	$(LINK) $(fcgistarter_LTFLAGS) $(fcgistarter_OBJECTS) $(PROGRAM_LDADD)
Loading