You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/05/01 13:43:45 UTC
svn commit: r1591622 [6/33] - in /httpd/mod_spdy/trunk: ./ base/
base/base.xcodeproj/ base/metrics/ build/ build/all.xcodeproj/
build/build_util.xcodeproj/ build/install.xcodeproj/ build/internal/
build/linux/ build/mac/ build/util/ build/win/ install/...
Added: httpd/mod_spdy/trunk/install/common/rpm.include
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/rpm.include?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/rpm.include (added)
+++ httpd/mod_spdy/trunk/install/common/rpm.include Thu May 1 11:43:36 2014
@@ -0,0 +1,305 @@
+@@include@@variables.include
+
+# Install the repository signing key (see also:
+# http://www.google.com/linuxrepositories/aboutkey.html)
+install_rpm_key() {
+ # Check to see if key already exists.
+ rpm -q gpg-pubkey-7fac5991-4615767f > /dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ # Key already exists
+ return 0
+ fi
+ # This is to work around a bug in RPM 4.7.0. (see http://crbug.com/22312)
+ rpm -q gpg-pubkey-7fac5991-45f06f46 > /dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ # Key already exists
+ return 0
+ fi
+
+ # RPM on Mandriva 2009 is dumb and does not understand "rpm --import -"
+ TMPKEY=$(mktemp /tmp/google.sig.XXXXXX)
+ if [ -n "$TMPKEY" ]; then
+ cat > "$TMPKEY" <<KEYDATA
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.2.2 (GNU/Linux)
+
+mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a
+kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z
+fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA
+feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u
+QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN
+b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP
+78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X
+4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf
+HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ
+bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl
+eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC
+HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF
+AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI
+A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U
+rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9
+XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo
+pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd
+K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG
+2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm
+CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9
+KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn
+cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT
+G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki
+5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD
+D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY
+/FJG
+=Quqp
+-----END PGP PUBLIC KEY BLOCK-----
+KEYDATA
+ rpm --import "$TMPKEY"
+ rc=$?
+ rm -f "$TMPKEY"
+ if [ "$rc" -eq "0" ]; then
+ return 0
+ fi
+ fi
+ return 1
+}
+
+determine_rpm_package_manager() {
+ local RELEASE
+ LSB_RELEASE="$(which lsb_release 2> /dev/null)"
+ if [ -x "$LSB_RELEASE" ]; then
+ RELEASE=$(lsb_release -i 2> /dev/null)
+ case $DISTRIB_ID in
+ "Fedora")
+ PACKAGEMANAGER=yum
+ ;;
+ "MandrivaLinux")
+ PACKAGEMANAGER=urpmi
+ ;;
+ "SUSE LINUX")
+ PACKAGEMANAGER=yast
+ ;;
+ esac
+ fi
+
+ if [ "$PACKAGEMANAGER" ]; then
+ return
+ fi
+
+ # Fallback methods that are probably unnecessary on modern systems.
+ if [ -f "/etc/lsb-release" ]; then
+ # file missing on Fedora, does not contain DISTRIB_ID on OpenSUSE.
+ eval $(sed -e '/DISTRIB_ID/!d' /etc/lsb-release)
+ case $DISTRIB_ID in
+ MandrivaLinux)
+ PACKAGEMANAGER=urpmi
+ ;;
+ esac
+ fi
+
+ if [ "$PACKAGEMANAGER" ]; then
+ return
+ fi
+
+ if [ -f "/etc/fedora-release" ] || [ -f "/etc/redhat-release" ]; then
+ PACKAGEMANAGER=yum
+ elif [ -f "/etc/SuSE-release" ]; then
+ PACKAGEMANAGER=yast
+ elif [ -f "/etc/mandriva-release" ]; then
+ PACKAGEMANAGER=urpmi
+ fi
+}
+
+DEFAULT_ARCH="@@ARCHITECTURE@@"
+YUM_REPO_FILE="/etc/yum.repos.d/@@PACKAGE@@.repo"
+ZYPPER_REPO_FILE="/etc/zypp/repos.d/@@PACKAGE@@.repo"
+URPMI_REPO_FILE="/etc/urpmi/urpmi.cfg"
+
+install_yum() {
+ install_rpm_key
+
+ if [ ! "$REPOCONFIG" ]; then
+ return 0
+ fi
+
+ if [ -d "/etc/yum.repos.d" ]; then
+cat > "$YUM_REPO_FILE" << REPOCONTENT
+[@@PACKAGE@@]
+name=@@PACKAGE@@
+baseurl=$REPOCONFIG/$DEFAULT_ARCH
+enabled=1
+gpgcheck=1
+REPOCONTENT
+ fi
+}
+
+# This is called by the cron job, rather than in the RPM postinstall.
+# We cannot do this during the install when urpmi is running due to
+# database locking. We also need to enable the repository, and we can
+# only do that while we are online.
+# see: https://qa.mandriva.com/show_bug.cgi?id=31893
+configure_urpmi() {
+ if [ ! "$REPOCONFIG" ]; then
+ return 0
+ fi
+
+ urpmq --list-media | grep -q -s "^@@PACKAGE@@$"
+ if [ "$?" -eq "0" ]; then
+ # Repository already configured
+ return 0
+ fi
+ urpmi.addmedia --update \
+ "@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
+}
+
+install_urpmi() {
+ # urpmi not smart enough to pull media_info/pubkey from the repository?
+ install_rpm_key
+
+ # Defer urpmi.addmedia to configure_urpmi() in the cron job.
+ # See comment there.
+ #
+ # urpmi.addmedia --update \
+ # "@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
+}
+
+install_yast() {
+ if [ ! "$REPOCONFIG" ]; then
+ return 0
+ fi
+
+ # We defer adding the key to later. See comment in the cron job.
+
+ # Ideally, we would run: zypper addrepo -t YUM -f \
+ # "$REPOCONFIG/$DEFAULT_ARCH" "@@PACKAGE@@"
+ # but that does not work when zypper is running.
+ if [ -d "/etc/zypp/repos.d" ]; then
+cat > "$ZYPPER_REPO_FILE" << REPOCONTENT
+[@@PACKAGE@@]
+name=@@PACKAGE@@
+enabled=1
+autorefresh=1
+baseurl=$REPOCONFIG/$DEFAULT_ARCH
+type=rpm-md
+keeppackages=0
+REPOCONTENT
+ fi
+}
+
+# Check if the automatic repository configuration is done, so we know when to
+# stop trying.
+verify_install() {
+ # It's probably enough to see that the repo configs have been created. If they
+ # aren't configured properly, update_bad_repo should catch that when it's run.
+ case $1 in
+ "yum")
+ [ -f "$YUM_REPO_FILE" ]
+ ;;
+ "yast")
+ [ -f "$ZYPPER_REPO_FILE" ]
+ ;;
+ "urpmi")
+ urpmq --list-url | grep -q -s "\b@@PACKAGE@@\b"
+ ;;
+ esac
+}
+
+# Update the Google repository if it's not set correctly.
+update_bad_repo() {
+ if [ ! "$REPOCONFIG" ]; then
+ return 0
+ fi
+
+ determine_rpm_package_manager
+
+ case $PACKAGEMANAGER in
+ "yum")
+ update_repo_file "$YUM_REPO_FILE"
+ ;;
+ "yast")
+ update_repo_file "$ZYPPER_REPO_FILE"
+ ;;
+ "urpmi")
+ update_urpmi_cfg
+ ;;
+ esac
+}
+
+update_repo_file() {
+ REPO_FILE="$1"
+
+ # Don't do anything if the file isn't there, since that probably means the
+ # user disabled it.
+ if [ ! -r "$REPO_FILE" ]; then
+ return 0
+ fi
+
+ # Check if the correct repository configuration is in there.
+ REPOMATCH=$(grep "^baseurl=$REPOCONFIG/$DEFAULT_ARCH" "$REPO_FILE" \
+ 2>/dev/null)
+ # If it's there, nothing to do
+ if [ "$REPOMATCH" ]; then
+ return 0
+ fi
+
+ # Check if it's there but disabled by commenting out (as opposed to using the
+ # 'enabled' setting).
+ MATCH_DISABLED=$(grep "^[[:space:]]*#.*baseurl=$REPOCONFIG/$DEFAULT_ARCH" \
+ "$REPO_FILE" 2>/dev/null)
+ if [ "$MATCH_DISABLED" ]; then
+ # It's OK for it to be disabled, as long as nothing bogus is enabled in its
+ # place.
+ ACTIVECONFIGS=$(grep "^baseurl=.*" "$REPO_FILE" 2>/dev/null)
+ if [ ! "$ACTIVECONFIGS" ]; then
+ return 0
+ fi
+ fi
+
+ # If we get here, the correct repository wasn't found, or something else is
+ # active, so fix it. This assumes there is a 'baseurl' setting, but if not,
+ # then that's just another way of disabling, so we won't try to add it.
+ sed -i -e "s,^baseurl=.*,baseurl=$REPOCONFIG/$DEFAULT_ARCH," "$REPO_FILE"
+}
+
+update_urpmi_cfg() {
+ REPOCFG=$(urpmq --list-url | grep "\b@@PACKAGE@@\b")
+ if [ ! "$REPOCFG" ]; then
+ # Don't do anything if the repo isn't there, since that probably means the
+ # user deleted it.
+ return 0
+ fi
+
+ # See if it's the right repo URL
+ REPOMATCH=$(echo "$REPOCFG" | grep "\b$REPOCONFIG/$DEFAULT_ARCH\b")
+ # If so, nothing to do
+ if [ "$REPOMATCH" ]; then
+ return 0
+ fi
+
+ # Looks like it's the wrong URL, so recreate it.
+ urpmi.removemedia "@@PACKAGE@@" && \
+ urpmi.addmedia --update "@@PACKAGE@@" "$REPOCONFIG/$DEFAULT_ARCH"
+}
+
+# We only remove the repository configuration during a purge. Since RPM has
+# no equivalent to dpkg --purge, the code below is actually never used. We
+# keep it only for reference purposes, should we ever need it.
+#
+#remove_yum() {
+# rm -f "$YUM_REPO_FILE"
+#}
+#
+#remove_urpmi() {
+# # Ideally, we would run: urpmi.removemedia "@@PACKAGE@@"
+# # but that does not work when urpmi is running.
+# # Sentinel comment text does not work either because urpmi.update removes
+# # all comments. So we just delete the entry that matches what we originally
+# # inserted. If such an entry was added manually, that's tough luck.
+# if [ -f "$URPMI_REPO_FILE" ]; then
+# sed -i '\_^@@PACKAGE@@ $REPOCONFIG/$DEFAULT_ARCH {$_,/^}$/d' "$URPMI_REPO_FILE"
+# fi
+#}
+#
+#remove_yast() {
+# # Ideally, we would run: zypper removerepo "@@PACKAGE@@"
+# # but that does not work when zypper is running.
+# rm -f /etc/zypp/repos.d/@@PACKAGE@@.repo
+#}
Added: httpd/mod_spdy/trunk/install/common/rpmrepo.cron
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/rpmrepo.cron?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/rpmrepo.cron (added)
+++ httpd/mod_spdy/trunk/install/common/rpmrepo.cron Thu May 1 11:43:36 2014
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# This script is part of the @@PACKAGE@@ package.
+#
+# It creates the repository configuration file for package updates, since
+# we cannot do this during the @@PACKAGE@@ installation since the repository
+# is locked.
+#
+# This functionality can be controlled by creating the $DEFAULTS_FILE and
+# setting "repo_add_once" to "true" or "false" as desired. An empty
+# $DEFAULTS_FILE is the same as setting the value to "false".
+
+@@include@@rpm.include
+
+## MAIN ##
+DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
+if [ -r "$DEFAULTS_FILE" ]; then
+ . "$DEFAULTS_FILE"
+fi
+
+if [ "$repo_add_once" = "true" ]; then
+ determine_rpm_package_manager
+
+ case $PACKAGEMANAGER in
+ "urpmi")
+ # We need to configure urpmi after the install has finished.
+ # See configure_urpmi() for details.
+ configure_urpmi
+ ;;
+ "yast")
+ # It looks as though yast/zypper has a lock on the RPM DB during
+ # postinstall, so we cannot add the signing key with install_rpm_key().
+ # Instead, we attempt to do this here. If the user attempt to update before
+ # the cron job imports the key, Yast will grab the key from our server and
+ # prompt the user to accept the key.
+ install_rpm_key
+ ;;
+ esac
+
+ if [ $? -eq 0 ]; then
+ # Before we quit auto-configuration, check that everything looks sane, since
+ # part of this happened during package install and we don't have the return
+ # value of that process.
+ verify_install $PACKAGEMANAGER
+ if [ $? -eq 0 ]; then
+ sed -i -e 's/[[:space:]]*repo_add_once=.*/repo_add_once="false"/' \
+ "$DEFAULTS_FILE"
+ fi
+ fi
+else
+ update_bad_repo
+fi
Added: httpd/mod_spdy/trunk/install/common/spdy.conf.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/spdy.conf.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/spdy.conf.template (added)
+++ httpd/mod_spdy/trunk/install/common/spdy.conf.template Thu May 1 11:43:36 2014
@@ -0,0 +1,22 @@
+<IfModule spdy_module>
+ # Turn on mod_spdy. To completely disable mod_spdy, you can set
+ # this to "off".
+ SpdyEnabled on
+
+ # In order to support concurrent multiplexing of requests over a
+ # single connection, mod_spdy maintains its own thread pool in
+ # each Apache child process for processing requests. The default
+ # size of this thread pool is very conservative; you can override
+ # it with a larger value (as below) to increase concurrency, at
+ # the possible cost of increased memory usage.
+ #
+ #SpdyMaxThreadsPerProcess 30
+
+ # Memory usage can also be affected by the maximum number of
+ # simultaneously open SPDY streams permitted for each client
+ # connection. Ideally, this limit should be set as high as
+ # possible, but you can tweak it as necessary to limit memory
+ # consumption.
+ #
+ #SpdyMaxStreamsPerConnection 100
+</IfModule>
Added: httpd/mod_spdy/trunk/install/common/spdy.load.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/spdy.load.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/spdy.load.template (added)
+++ httpd/mod_spdy/trunk/install/common/spdy.load.template Thu May 1 11:43:36 2014
@@ -0,0 +1 @@
+LoadModule spdy_module @@APACHE_MODULEDIR@@/mod_spdy.so
Added: httpd/mod_spdy/trunk/install/common/ssl.load.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/ssl.load.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/ssl.load.template (added)
+++ httpd/mod_spdy/trunk/install/common/ssl.load.template Thu May 1 11:43:36 2014
@@ -0,0 +1,15 @@
+# This version of ssl.load was placed here because you installed mod_spdy.
+
+# Using mod_spdy requires using a patched version of mod_ssl that provides
+# hooks into the Next Protocol Negotiation (NPN) data from the SSL handshake.
+# Thus, the mod_spdy package installs mod_ssl_with_npn.so, which is exactly
+# mod_ssl but with the following (small) patch applied:
+# https://issues.apache.org/bugzilla/attachment.cgi?id=27969
+
+LoadModule ssl_module @@APACHE_MODULEDIR@@/mod_ssl_with_npn.so
+
+# If you'd like to go back to using the original, unpatched version of mod_ssl,
+# simply comment out the above line and uncomment the below line. However,
+# beware that mod_spdy will probably then cease to function.
+
+#LoadModule ssl_module @@APACHE_MODULEDIR@@/mod_ssl.so
Added: httpd/mod_spdy/trunk/install/common/updater
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/updater?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/updater (added)
+++ httpd/mod_spdy/trunk/install/common/updater Thu May 1 11:43:36 2014
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO
+# - handle other distros (e.g. non-apt).
+
+@@include@@apt.include
+
+if [ -x "$APT_GET" ]; then
+ update_sources_lists
+ # If the repo was just added, force a cache update.
+ if [ $? -eq 1 ]; then
+ install_key
+ "$APT_GET" -qq update
+ fi
+
+ # TODO(mmoss) detect if apt cache is stale (> 1 day) and force update?
+
+ # Just try to install the packge. If it's already installed, apt-get won't do
+ # anything.
+ "$APT_GET" install -y -q @@PACKAGE@@
+fi
+
Propchange: httpd/mod_spdy/trunk/install/common/updater
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/common/variables.include
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/common/variables.include?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/common/variables.include (added)
+++ httpd/mod_spdy/trunk/install/common/variables.include Thu May 1 11:43:36 2014
@@ -0,0 +1,5 @@
+# System-wide package configuration.
+DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
+
+# sources.list setting for @@PACKAGE@@ updates.
+REPOCONFIG="@@REPOCONFIG@@"
Added: httpd/mod_spdy/trunk/install/debian/build.sh
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/build.sh?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/build.sh (added)
+++ httpd/mod_spdy/trunk/install/debian/build.sh Thu May 1 11:43:36 2014
@@ -0,0 +1,249 @@
+#!/bin/bash
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+if [ "$VERBOSE" ]; then
+ set -x
+fi
+set -u
+
+# Create the Debian changelog file needed by dpkg-gencontrol. This just adds a
+# placeholder change, indicating it is the result of an automatic build.
+gen_changelog() {
+ rm -f "${DEB_CHANGELOG}"
+ process_template "${SCRIPTDIR}/changelog.template" "${DEB_CHANGELOG}"
+ debchange -a --nomultimaint -m --changelog "${DEB_CHANGELOG}" \
+ --distribution UNRELEASED "automatic build"
+}
+
+# Create the Debian control file needed by dpkg-deb.
+gen_control() {
+ dpkg-gencontrol -v"${VERSIONFULL}" -c"${DEB_CONTROL}" -l"${DEB_CHANGELOG}" \
+ -f"${DEB_FILES}" -p"${PACKAGE}-${CHANNEL}" -P"${STAGEDIR}" -T"${DEB_SUBST}" \
+ -O > "${STAGEDIR}/DEBIAN/control"
+ rm -f "${DEB_CONTROL}"
+}
+
+# Create the Debian substvars file needed by dpkg-gencontrol.
+gen_substvars() {
+ # dpkg-shlibdeps requires a control file in debian/control, so we're
+ # forced to prepare a fake debian directory.
+ mkdir "${SUBSTFILEDIR}/debian"
+ cp "${DEB_CONTROL}" "${SUBSTFILEDIR}/debian"
+ pushd "${SUBSTFILEDIR}" >/dev/null
+ dpkg-shlibdeps "${STAGEDIR}${APACHE_MODULEDIR}/mod_spdy.so" \
+ -O >> "${DEB_SUBST}" 2>/dev/null
+ popd >/dev/null
+}
+
+# Setup the installation directory hierachy in the package staging area.
+prep_staging_debian() {
+ prep_staging_common
+ install -m 755 -d "${STAGEDIR}/DEBIAN" \
+ "${STAGEDIR}/etc/cron.daily"
+}
+
+# Put the package contents in the staging area.
+stage_install_debian() {
+ prep_staging_debian
+ stage_install_common
+ echo "Staging Debian install files in '${STAGEDIR}'..."
+ process_template "${BUILDDIR}/install/common/repo.cron" \
+ "${STAGEDIR}/etc/cron.daily/${PACKAGE}"
+ chmod 755 "${STAGEDIR}/etc/cron.daily/${PACKAGE}"
+ process_template "${BUILDDIR}/install/debian/preinst" \
+ "${STAGEDIR}/DEBIAN/preinst"
+ chmod 755 "${STAGEDIR}/DEBIAN/preinst"
+ process_template "${BUILDDIR}/install/debian/postinst" \
+ "${STAGEDIR}/DEBIAN/postinst"
+ chmod 755 "${STAGEDIR}/DEBIAN/postinst"
+ process_template "${BUILDDIR}/install/debian/prerm" \
+ "${STAGEDIR}/DEBIAN/prerm"
+ chmod 755 "${STAGEDIR}/DEBIAN/prerm"
+ process_template "${BUILDDIR}/install/debian/postrm" \
+ "${STAGEDIR}/DEBIAN/postrm"
+ chmod 755 "${STAGEDIR}/DEBIAN/postrm"
+ process_template "${BUILDDIR}/install/debian/conffiles.template" \
+ "${STAGEDIR}/DEBIAN/conffiles"
+ chmod 644 "${STAGEDIR}/DEBIAN/conffiles"
+ process_template "${BUILDDIR}/install/common/spdy.load.template" \
+ "${STAGEDIR}${APACHE_CONFDIR}/spdy.load"
+ chmod 644 "${STAGEDIR}${APACHE_CONFDIR}/spdy.load"
+ process_template "${BUILDDIR}/install/common/spdy.conf.template" \
+ "${STAGEDIR}${APACHE_CONFDIR}/spdy.conf"
+ chmod 644 "${STAGEDIR}${APACHE_CONFDIR}/spdy.conf"
+}
+
+# Build the deb file within a fakeroot.
+do_package_in_fakeroot() {
+ FAKEROOTFILE=$(mktemp -t fakeroot.tmp.XXXXXX) || exit 1
+ fakeroot -i "${FAKEROOTFILE}" -- \
+ dpkg-deb -b "${STAGEDIR}" .
+ rm -f "${FAKEROOTFILE}"
+}
+
+# Actually generate the package file.
+do_package() {
+ export HOST_ARCH="$1"
+ echo "Packaging ${HOST_ARCH}..."
+ PREDEPENDS="$COMMON_PREDEPS"
+ DEPENDS="${COMMON_DEPS}"
+ gen_changelog
+ process_template "${SCRIPTDIR}/control.template" "${DEB_CONTROL}"
+ export DEB_HOST_ARCH="${HOST_ARCH}"
+ gen_substvars
+ if [ -f "${DEB_CONTROL}" ]; then
+ gen_control
+ fi
+
+ do_package_in_fakeroot
+}
+
+# Remove temporary files and unwanted packaging output.
+cleanup() {
+ echo "Cleaning..."
+ rm -rf "${STAGEDIR}"
+ rm -rf "${TMPFILEDIR}"
+ rm -rf "${SUBSTFILEDIR}"
+}
+
+usage() {
+ echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] [-b 'dir']"
+ echo "-c channel the package channel (unstable, beta, stable)"
+ echo "-a arch package architecture (ia32 or x64)"
+ echo "-o dir package output directory [${OUTPUTDIR}]"
+ echo "-b dir build input directory [${BUILDDIR}]"
+ echo "-h this help message"
+}
+
+# Check that the channel name is one of the allowable ones.
+verify_channel() {
+ case $CHANNEL in
+ stable )
+ CHANNEL=stable
+ ;;
+ unstable|dev|alpha )
+ CHANNEL=unstable
+ ;;
+ testing|beta )
+ CHANNEL=beta
+ ;;
+ * )
+ echo
+ echo "ERROR: '$CHANNEL' is not a valid channel type."
+ echo
+ exit 1
+ ;;
+ esac
+}
+
+process_opts() {
+ while getopts ":o:b:c:a:h" OPTNAME
+ do
+ case $OPTNAME in
+ o )
+ OUTPUTDIR="$OPTARG"
+ mkdir -p "${OUTPUTDIR}"
+ ;;
+ b )
+ BUILDDIR=$(readlink -f "${OPTARG}")
+ ;;
+ c )
+ CHANNEL="$OPTARG"
+ ;;
+ a )
+ TARGETARCH="$OPTARG"
+ ;;
+ h )
+ usage
+ exit 0
+ ;;
+ \: )
+ echo "'-$OPTARG' needs an argument."
+ usage
+ exit 1
+ ;;
+ * )
+ echo "invalid command-line option: $OPTARG"
+ usage
+ exit 1
+ ;;
+ esac
+ done
+}
+
+#=========
+# MAIN
+#=========
+
+SCRIPTDIR=$(readlink -f "$(dirname "$0")")
+OUTPUTDIR="${PWD}"
+STAGEDIR=$(mktemp -d -t deb.build.XXXXXX) || exit 1
+TMPFILEDIR=$(mktemp -d -t deb.tmp.XXXXXX) || exit 1
+SUBSTFILEDIR=$(mktemp -d -t deb.subst.XXXXXX) || exit 1
+DEB_CHANGELOG="${TMPFILEDIR}/changelog"
+DEB_FILES="${TMPFILEDIR}/files"
+DEB_CONTROL="${TMPFILEDIR}/control"
+DEB_SUBST="${SUBSTFILEDIR}/debian/substvars"
+CHANNEL="beta"
+# Default target architecture to same as build host.
+if [ "$(uname -m)" = "x86_64" ]; then
+ TARGETARCH="x64"
+else
+ TARGETARCH="ia32"
+fi
+
+# call cleanup() on exit
+trap cleanup 0
+process_opts "$@"
+if [ ! "$BUILDDIR" ]; then
+ BUILDDIR=$(readlink -f "${BUILDDIR}/install/../mod-spdy-release/src/out/Release")
+fi
+
+source ${BUILDDIR}/install/common/installer.include
+
+get_version_info
+VERSIONFULL="${VERSION}-r${REVISION}"
+
+source "${BUILDDIR}/install/common/mod-spdy.info"
+eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \
+ "${BUILDDIR}/install/common/BRANDING")
+
+REPOCONFIG="deb http://dl.google.com/linux/${PACKAGE#google-}/deb/ stable main"
+verify_channel
+
+# Some Debian packaging tools want these set.
+export DEBFULLNAME="${MAINTNAME}"
+export DEBEMAIL="${MAINTMAIL}"
+
+# Make everything happen in the OUTPUTDIR.
+cd "${OUTPUTDIR}"
+
+COMMON_DEPS="apache2.2-common"
+COMMON_PREDEPS="dpkg (>= 1.14.0)"
+REPLACES=""
+
+APACHE_MODULEDIR="/usr/lib/apache2/modules"
+APACHE_CONFDIR="/etc/apache2/mods-available"
+APACHE_USER="www-data"
+COMMENT_OUT_DEFLATE=
+
+case "$TARGETARCH" in
+ ia32 )
+ stage_install_debian
+ do_package "i386"
+ ;;
+ x64 )
+ stage_install_debian
+ do_package "amd64"
+ ;;
+ * )
+ echo
+ echo "ERROR: Don't know how to build DEBs for '$TARGETARCH'."
+ echo
+ exit 1
+ ;;
+esac
Propchange: httpd/mod_spdy/trunk/install/debian/build.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpd/mod_spdy/trunk/install/debian/build.sh
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/debian/changelog.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/changelog.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/changelog.template (added)
+++ httpd/mod_spdy/trunk/install/debian/changelog.template Thu May 1 11:43:36 2014
@@ -0,0 +1,4 @@
+@@PACKAGE@@-@@CHANNEL@@ (@@VERSIONFULL@@) UNRELEASED; urgency=low
+ * No changes
+
+ -- @@MAINTNAME@@ <@@MAINTMAIL@@> Wed, 20 Oct 2010 14:54:35 -0800
Added: httpd/mod_spdy/trunk/install/debian/conffiles.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/conffiles.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/conffiles.template (added)
+++ httpd/mod_spdy/trunk/install/debian/conffiles.template Thu May 1 11:43:36 2014
@@ -0,0 +1,3 @@
+/etc/apache2/mods-available/spdy.load
+/etc/apache2/mods-available/spdy.conf
+/etc/cron.daily/@@PACKAGE@@
Added: httpd/mod_spdy/trunk/install/debian/control.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/control.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/control.template (added)
+++ httpd/mod_spdy/trunk/install/debian/control.template Thu May 1 11:43:36 2014
@@ -0,0 +1,16 @@
+Source: @@PACKAGE@@-@@CHANNEL@@
+Section: httpd
+Priority: optional
+Maintainer: @@MAINTNAME@@ <@@MAINTMAIL@@>
+Build-Depends: dpkg-dev, devscripts, fakeroot
+Standards-Version: 3.8.0
+
+Package: @@PACKAGE@@-@@CHANNEL@@
+Provides: @@PROVIDES@@
+Replaces: @@REPLACES@@
+Conflicts: @@CONFLICTS@@
+Pre-Depends: @@PREDEPENDS@@
+Depends: ${shlibs:Depends}, @@DEPENDS@@
+Architecture: @@ARCHITECTURE@@
+Description: @@SHORTDESC@@
+ @@FULLDESC@@
Added: httpd/mod_spdy/trunk/install/debian/postinst
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/postinst?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/postinst (added)
+++ httpd/mod_spdy/trunk/install/debian/postinst Thu May 1 11:43:36 2014
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# Based on postinst from Chromium and Google Talk.
+
+@@include@@../common/apt.include
+
+MODSPDY_ENABLE_UPDATES=@@MODSPDY_ENABLE_UPDATES@@
+
+case "$1" in
+ configure)
+ if [ -n "${MODSPDY_ENABLE_UPDATES}" -a ! -e "$DEFAULTS_FILE" ]; then
+ echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
+ echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE"
+ fi
+
+ # Run the cron job immediately to perform repository
+ # configuration.
+ nohup sh /etc/cron.daily/@@PACKAGE@@ > /dev/null 2>&1 &
+
+ test ! -e /etc/apache2/mods-enabled/spdy.load && \
+ a2enmod spdy
+ ;;
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+set -e # If any command fails from here on, the whole scripts fails.
+
+# Regardless of what argument postinst is called with, we should make sure at
+# this point that we're set up to load our version of mod_ssl. Note that if we
+# upgrade mod-spdy, the old package's prerm will first get called, which will
+# undo changes to ssl.load, and then we'll redo them here. This is good, in
+# case we ever need to change the way we modify ssl.load.
+if [ -f "@@APACHE_CONFDIR@@/ssl.load" ]; then
+ # Don't do anything if the magic "MOD_SPDY" marker is already present in the
+ # file; this helps ensure that this prerm script is idempotent. See
+ # http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-idempotency
+ # for why this is important.
+ if ! grep -q 'MOD_SPDY' @@APACHE_CONFDIR@@/ssl.load; then
+ # First, comment out all lines in the file, using a special prefix. We
+ # will look for that prefix later when we uninstall.
+ sed --in-place 's/^.*$/#ORIG# &/' @@APACHE_CONFDIR@@/ssl.load
+ # Next, append a new LoadModule line to the file, with some explanitory
+ # comments. The first line we append contains the magic marker "MOD_SPDY",
+ # which we look for in the prerm script so that we can remove the below
+ # text when we uninstall.
+ cat >> @@APACHE_CONFDIR@@/ssl.load <<EOF
+########## MOD_SPDY CHANGES BELOW ##########
+# If mod_spdy is uninstalled, this file will be restored to its original form
+# by deleting everything below here and uncommenting everything above.
+
+# Using mod_spdy requires using a patched version of mod_ssl that provides
+# hooks into the Next Protocol Negotiation (NPN) data from the SSL handshake.
+# Thus, the mod_spdy package installs mod_ssl_with_npn.so, which is exactly
+# mod_ssl but with the following (small) patch applied:
+# https://issues.apache.org/bugzilla/attachment.cgi?id=27969
+
+LoadModule ssl_module @@APACHE_MODULEDIR@@/mod_ssl_with_npn.so
+EOF
+ fi
+fi
+
+exit 0
Propchange: httpd/mod_spdy/trunk/install/debian/postinst
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/debian/postrm
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/postrm?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/postrm (added)
+++ httpd/mod_spdy/trunk/install/debian/postrm Thu May 1 11:43:36 2014
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+action="$1"
+
+# Only do complete clean-up on purge.
+if [ "$action" != "purge" ] ; then
+ exit 0
+fi
+
+@@include@@../common/apt.include
+
+# Only remove the defaults file if it is not empty. An empty file was probably
+# put there by the sysadmin to disable automatic repository configuration, as
+# per the instructions on the package download page.
+if [ -s "$DEFAULTS_FILE" ]; then
+ # Make sure the package defaults are removed before the repository config,
+ # otherwise it could result in the repository config being removed, but the
+ # package defaults remain and are set to not recreate the repository config.
+ # In that case, future installs won't recreate it and won't get auto-updated.
+ rm "$DEFAULTS_FILE" || exit 1
+fi
+# Remove any Google repository added by the package.
+clean_sources_lists
Propchange: httpd/mod_spdy/trunk/install/debian/postrm
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/debian/preinst
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/preinst?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/preinst (added)
+++ httpd/mod_spdy/trunk/install/debian/preinst Thu May 1 11:43:36 2014
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 0
Added: httpd/mod_spdy/trunk/install/debian/prerm
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/debian/prerm?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/debian/prerm (added)
+++ httpd/mod_spdy/trunk/install/debian/prerm Thu May 1 11:43:36 2014
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+case "$1" in
+ remove)
+ test -e /etc/apache2/mods-enabled/spdy.load && a2dismod spdy
+ ;;
+ upgrade|deconfigure|failed-upgrade)
+ ;;
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+set -e # If any command fails from here on, the whole scripts fails.
+
+# Regardless of the argument prerm is called with, we should undo our changes
+# to ssl.load. If we're upgrading to a newer version of mod_spdy, the new
+# package will redo its changes to ssl.load in its postinst script. See
+# http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-unpackphase
+# for details.
+if [ -f "@@APACHE_CONFDIR@@/ssl.load" ]; then
+ # Don't do anything if we don't see the magic "MOD_SPDY" marker; this helps
+ # ensure that this prerm script is idempotent. See
+ # http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-idempotency
+ # for why this is important.
+ if grep -q 'MOD_SPDY' @@APACHE_CONFDIR@@/ssl.load; then
+ # First, we uncomment any line that starts with "#ORIG# " (we use that
+ # particular prefix, to reduce the chances that we break the file if the
+ # user has added their own comments to the file for some reason), up until
+ # we see the "MOD_SPDY" marker. Second, we delete the line containing the
+ # "MOD_SPDY" marker and all lines thereafter, thus removing the stuff we
+ # appended to the file in the postinst script.
+ sed --in-place \
+ -e '1,/MOD_SPDY/ s/^#ORIG# \(.*\)$/\1/' \
+ -e '/MOD_SPDY/,$ d' \
+ @@APACHE_CONFDIR@@/ssl.load
+ fi
+fi
+
+exit 0
Propchange: httpd/mod_spdy/trunk/install/debian/prerm
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/rpm/build.sh
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/rpm/build.sh?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/rpm/build.sh (added)
+++ httpd/mod_spdy/trunk/install/rpm/build.sh Thu May 1 11:43:36 2014
@@ -0,0 +1,238 @@
+#!/bin/bash
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+if [ "$VERBOSE" ]; then
+ set -x
+fi
+set -u
+
+gen_spec() {
+ rm -f "${SPEC}"
+ process_template "${SCRIPTDIR}/mod-spdy.spec.template" "${SPEC}"
+}
+
+# Setup the installation directory hierachy in the package staging area.
+prep_staging_rpm() {
+ prep_staging_common
+ install -m 755 -d "${STAGEDIR}/etc/cron.daily"
+}
+
+# Put the package contents in the staging area.
+stage_install_rpm() {
+ prep_staging_rpm
+ stage_install_common
+ echo "Staging RPM install files in '${STAGEDIR}'..."
+ process_template "${BUILDDIR}/install/common/rpmrepo.cron" \
+ "${STAGEDIR}/etc/cron.daily/${PACKAGE}"
+ chmod 755 "${STAGEDIR}/etc/cron.daily/${PACKAGE}"
+
+ # For CentOS, the load and conf files are combined into a single
+ # 'conf' file. So we install the load template as the conf file, and
+ # then concatenate the actual conf file.
+ process_template "${BUILDDIR}/install/common/spdy.load.template" \
+ "${STAGEDIR}${APACHE_CONFDIR}/spdy.conf"
+ process_template "${BUILDDIR}/install/common/spdy.conf.template" \
+ "${BUILDDIR}/install/common/spdy.conf"
+ cat "${BUILDDIR}/install/common/spdy.conf" >> \
+ "${STAGEDIR}${APACHE_CONFDIR}/spdy.conf"
+ chmod 644 "${STAGEDIR}${APACHE_CONFDIR}/spdy.conf"
+
+ # Our conf file for loading mod_ssl_with_npn.so must come alphabetically
+ # before the built-in ssl.conf file, so we can't call it "ssl_with_npn.conf".
+ # Since all it will do is load the module (not configure it),
+ # "load_ssl_with_npn.conf" seems like an appropriate name.
+ process_template "${BUILDDIR}/install/common/ssl.load.template" \
+ "${STAGEDIR}${APACHE_CONFDIR}/load_ssl_with_npn.conf"
+ chmod 644 "${STAGEDIR}${APACHE_CONFDIR}/load_ssl_with_npn.conf"
+}
+
+# Actually generate the package file.
+do_package() {
+ echo "Packaging ${HOST_ARCH}..."
+ PROVIDES="${PACKAGE}"
+ local REPS="$REPLACES"
+ REPLACES=""
+ for rep in $REPS; do
+ if [ -z "$REPLACES" ]; then
+ REPLACES="$PACKAGE-$rep"
+ else
+ REPLACES="$REPLACES $PACKAGE-$rep"
+ fi
+ done
+
+ # If we specify a dependecy of foo.so below, we would depend on both the
+ # 32 and 64-bit versions on a 64-bit machine. The current version of RPM
+ # we use is too old and doesn't provide %{_isa}, so we do this manually.
+ if [ "$HOST_ARCH" = "x86_64" ] ; then
+ local EMPTY_VERSION="()"
+ local PKG_ARCH="(64bit)"
+ elif [ "$HOST_ARCH" = "i386" ] ; then
+ local EMPTY_VERSION=""
+ local PKG_ARCH=""
+ fi
+
+ DEPENDS="httpd >= 2.2.4, \
+ mod_ssl >= 2.2, \
+ libstdc++ >= 4.1.2, \
+ at"
+ gen_spec
+
+ # Create temporary rpmbuild dirs.
+ RPMBUILD_DIR=$(mktemp -d -t rpmbuild.XXXXXX) || exit 1
+ mkdir -p "$RPMBUILD_DIR/BUILD"
+ mkdir -p "$RPMBUILD_DIR/RPMS"
+
+ rpmbuild --buildroot="$RPMBUILD_DIR/BUILD" -bb \
+ --target="$HOST_ARCH" --rmspec \
+ --define "_topdir $RPMBUILD_DIR" \
+ --define "_binary_payload w9.bzdio" \
+ "${SPEC}"
+ PKGNAME="${PACKAGE}-${CHANNEL}-${VERSION}-${REVISION}"
+ mv "$RPMBUILD_DIR/RPMS/$HOST_ARCH/${PKGNAME}.${HOST_ARCH}.rpm" "${OUTPUTDIR}"
+ # Make sure the package is world-readable, otherwise it causes problems when
+ # copied to share drive.
+ chmod a+r "${OUTPUTDIR}/${PKGNAME}.$HOST_ARCH.rpm"
+ rm -rf "$RPMBUILD_DIR"
+}
+
+# Remove temporary files and unwanted packaging output.
+cleanup() {
+ rm -rf "${STAGEDIR}"
+ rm -rf "${TMPFILEDIR}"
+}
+
+usage() {
+ echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] [-b 'dir']"
+ echo "-c channel the package channel (unstable, beta, stable)"
+ echo "-a arch package architecture (ia32 or x64)"
+ echo "-o dir package output directory [${OUTPUTDIR}]"
+ echo "-b dir build input directory [${BUILDDIR}]"
+ echo "-h this help message"
+}
+
+# Check that the channel name is one of the allowable ones.
+verify_channel() {
+ case $CHANNEL in
+ stable )
+ CHANNEL=stable
+ REPLACES="unstable beta"
+ ;;
+ unstable|dev|alpha )
+ CHANNEL=unstable
+ REPLACES="stable beta"
+ ;;
+ testing|beta )
+ CHANNEL=beta
+ REPLACES="unstable stable"
+ ;;
+ * )
+ echo
+ echo "ERROR: '$CHANNEL' is not a valid channel type."
+ echo
+ exit 1
+ ;;
+ esac
+}
+
+process_opts() {
+ while getopts ":o:b:c:a:h" OPTNAME
+ do
+ case $OPTNAME in
+ o )
+ OUTPUTDIR="$OPTARG"
+ mkdir -p "${OUTPUTDIR}"
+ ;;
+ b )
+ BUILDDIR=$(readlink -f "${OPTARG}")
+ ;;
+ c )
+ CHANNEL="$OPTARG"
+ verify_channel
+ ;;
+ a )
+ TARGETARCH="$OPTARG"
+ ;;
+ h )
+ usage
+ exit 0
+ ;;
+ \: )
+ echo "'-$OPTARG' needs an argument."
+ usage
+ exit 1
+ ;;
+ * )
+ echo "invalid command-line option: $OPTARG"
+ usage
+ exit 1
+ ;;
+ esac
+ done
+}
+
+#=========
+# MAIN
+#=========
+
+SCRIPTDIR=$(readlink -f "$(dirname "$0")")
+OUTPUTDIR="${PWD}"
+STAGEDIR=$(mktemp -d -t rpm.build.XXXXXX) || exit 1
+TMPFILEDIR=$(mktemp -d -t rpm.tmp.XXXXXX) || exit 1
+CHANNEL="beta"
+# Default target architecture to same as build host.
+if [ "$(uname -m)" = "x86_64" ]; then
+ TARGETARCH="x64"
+else
+ TARGETARCH="ia32"
+fi
+SPEC="${TMPFILEDIR}/mod-spdy.spec"
+
+# call cleanup() on exit
+trap cleanup 0
+process_opts "$@"
+if [ ! "$BUILDDIR" ]; then
+ BUILDDIR=$(readlink -f "${SCRIPTDIR}/../../out/Release")
+fi
+
+source ${BUILDDIR}/install/common/installer.include
+
+get_version_info
+
+source "${BUILDDIR}/install/common/mod-spdy.info"
+eval $(sed -e "s/^\([^=]\+\)=\(.*\)$/export \1='\2'/" \
+ "${BUILDDIR}/install/common/BRANDING")
+
+REPOCONFIG="http://dl.google.com/linux/${PACKAGE#google-}/rpm/stable"
+verify_channel
+
+APACHE_CONFDIR="/etc/httpd/conf.d"
+APACHE_USER="apache"
+COMMENT_OUT_DEFLATE=
+
+# Make everything happen in the OUTPUTDIR.
+cd "${OUTPUTDIR}"
+
+case "$TARGETARCH" in
+ ia32 )
+ export APACHE_MODULEDIR="/usr/lib/httpd/modules"
+ export HOST_ARCH="i386"
+ stage_install_rpm
+ ;;
+ x64 )
+ export APACHE_MODULEDIR="/usr/lib64/httpd/modules"
+ export HOST_ARCH="x86_64"
+ stage_install_rpm
+ ;;
+ * )
+ echo
+ echo "ERROR: Don't know how to build RPMs for '$TARGETARCH'."
+ echo
+ exit 1
+ ;;
+esac
+
+do_package "$HOST_ARCH"
Propchange: httpd/mod_spdy/trunk/install/rpm/build.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpd/mod_spdy/trunk/install/rpm/build.sh
------------------------------------------------------------------------------
svn:executable = *
Added: httpd/mod_spdy/trunk/install/rpm/mod-spdy.spec.template
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/install/rpm/mod-spdy.spec.template?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/install/rpm/mod-spdy.spec.template (added)
+++ httpd/mod_spdy/trunk/install/rpm/mod-spdy.spec.template Thu May 1 11:43:36 2014
@@ -0,0 +1,179 @@
+#------------------------------------------------------------------------------
+# mod-spdy.spec
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# Prologue information
+#------------------------------------------------------------------------------
+Summary : @@SHORTDESC@@
+License : Apache Software License
+Name : @@PACKAGE@@-@@CHANNEL@@
+Version : @@VERSION@@
+Release : @@REVISION@@
+Group : System Environment/Daemons
+Vendor : @@COMPANY_FULLNAME@@
+Url : @@PRODUCTURL@@
+Packager : @@MAINTNAME@@ <@@MAINTMAIL@@>
+
+#------------------------------------------------------------------------------
+# Tested on:
+# TODO
+#------------------------------------------------------------------------------
+
+Provides : @@PROVIDES@@ = %{version}
+Requires : @@DEPENDS@@
+Conflicts : @@REPLACES@@
+
+#------------------------------------------------------------------------------
+# Description
+#------------------------------------------------------------------------------
+%Description
+@@FULLDESC@@
+
+#------------------------------------------------------------------------------
+# Build rule - How to make the package
+#------------------------------------------------------------------------------
+%build
+
+#------------------------------------------------------------------------------
+# Installation rule - how to install it (note that it
+# gets installed into a temp directory given by $RPM_BUILD_ROOT)
+#------------------------------------------------------------------------------
+%install
+rm -rf "$RPM_BUILD_ROOT"
+
+if [ -z "@@STAGEDIR@@" -o ! -d "@@STAGEDIR@@" ] ; then
+ echo "@@STAGEDIR@@ appears to be incorrectly set - aborting"
+ exit 1
+fi
+
+install -m 755 -d \
+ "$RPM_BUILD_ROOT/etc" \
+ "$RPM_BUILD_ROOT/usr"
+# This is hard coded for now
+cp -a "@@STAGEDIR@@/etc/" "$RPM_BUILD_ROOT/"
+cp -a "@@STAGEDIR@@/usr/" "$RPM_BUILD_ROOT/"
+
+#------------------------------------------------------------------------------
+# Rule to clean up a build
+#------------------------------------------------------------------------------
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+#------------------------------------------------------------------------------
+# Files listing.
+#------------------------------------------------------------------------------
+%files
+%defattr(-,root,root)
+@@APACHE_MODULEDIR@@/mod_spdy.so
+@@APACHE_MODULEDIR@@/mod_ssl_with_npn.so
+%config(noreplace) @@APACHE_CONFDIR@@/spdy.conf
+%config @@APACHE_CONFDIR@@/load_ssl_with_npn.conf
+/etc/cron.daily/mod-spdy
+
+#------------------------------------------------------------------------------
+# Pre install script
+#------------------------------------------------------------------------------
+%pre
+
+exit 0
+
+#------------------------------------------------------------------------------
+# Post install script
+#------------------------------------------------------------------------------
+%post
+
+@@include@@../common/rpm.include
+
+MODSPDY_ENABLE_UPDATES=@@MODSPDY_ENABLE_UPDATES@@
+
+DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
+if [ -n "${MODSPDY_ENABLE_UPDATES}" -a ! -e "$DEFAULTS_FILE" ]; then
+ echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
+fi
+
+if [ -e "$DEFAULTS_FILE" ]; then
+. "$DEFAULTS_FILE"
+
+if [ "$repo_add_once" = "true" ]; then
+ determine_rpm_package_manager
+
+ case $PACKAGEMANAGER in
+ "yum")
+ install_yum
+ ;;
+ "urpmi")
+ install_urpmi
+ ;;
+ "yast")
+ install_yast
+ ;;
+ esac
+fi
+
+# Some package managers have locks that prevent everything from being
+# configured at install time, so wait a bit then kick the cron job to do
+# whatever is left. Probably the db will be unlocked by then, but if not, the
+# cron job will keep retrying.
+# Do this with 'at' instead of a backgrounded shell because zypper waits on all
+# sub-shells to finish before it finishes, which is exactly the opposite of
+# what we want here. Also preemptively start atd because for some reason it's
+# not always running, which kind of defeats the purpose of having 'at' as a
+# required LSB command.
+service atd start
+echo "sh /etc/cron.daily/@@PACKAGE@@" | at now + 2 minute
+fi
+
+# Turn off loading of the normal mod_ssl.so:
+sed --in-place \
+ 's/^ *LoadModule \+ssl_module .*$/#& # See load_ssl_with_npn.conf/' \
+ @@APACHE_CONFDIR@@/ssl.conf
+
+exit 0
+
+
+#------------------------------------------------------------------------------
+# Pre uninstallation script
+#------------------------------------------------------------------------------
+%preun
+
+if [ "$1" -eq "0" ]; then
+ mode="uninstall"
+elif [ "$1" -eq "1" ]; then
+ mode="upgrade"
+fi
+
+@@include@@../common/rpm.include
+
+# On Debian we only remove when we purge. However, RPM has no equivalent to
+# dpkg --purge, so this is all disabled.
+#
+#determine_rpm_package_manager
+#
+#case $PACKAGEMANAGER in
+#"yum")
+# remove_yum
+# ;;
+#"urpmi")
+# remove_urpmi
+# ;;
+#"yast")
+# remove_yast
+# ;;
+#esac
+
+if [ "$mode" == "uninstall" ]; then
+ # Re-enable loading of the normal mod_ssl.so:
+ sed --in-place \
+ 's/^#\( *LoadModule.*[^ ]\) *# See load_ssl_with_npn.conf$/\1/' \
+ @@APACHE_CONFDIR@@/ssl.conf
+fi
+
+exit 0
+
+#------------------------------------------------------------------------------
+# Post uninstallation script
+#------------------------------------------------------------------------------
+%postun
+
+exit 0
Added: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.cc (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.cc Thu May 1 11:43:36 2014
@@ -0,0 +1,188 @@
+// Copyright 2011 Google Inc.
+//
+// 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.
+
+#include "mod_spdy/apache/apache_spdy_session_io.h"
+
+#include "apr_buckets.h"
+#include "http_log.h"
+#include "util_filter.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "mod_spdy/apache/pool_util.h" // for AprStatusString
+#include "mod_spdy/common/protocol_util.h" // for FrameData
+#include "net/spdy/buffered_spdy_framer.h"
+#include "net/spdy/spdy_protocol.h"
+
+namespace mod_spdy {
+
+namespace {
+
+// How many bytes to ask for at a time when pulling data from the connection
+// input filters. We use non-blocking reads, so we'll sometimes get less than
+// this.
+const apr_off_t kReadBytes = 4096;
+
+} // namespace
+
+ApacheSpdySessionIO::ApacheSpdySessionIO(conn_rec* connection)
+ : connection_(connection),
+ input_brigade_(apr_brigade_create(connection_->pool,
+ connection_->bucket_alloc)),
+ output_brigade_(apr_brigade_create(connection_->pool,
+ connection_->bucket_alloc)) {}
+
+ApacheSpdySessionIO::~ApacheSpdySessionIO() {}
+
+bool ApacheSpdySessionIO::IsConnectionAborted() {
+ return static_cast<bool>(connection_->aborted);
+}
+
+SpdySessionIO::ReadStatus ApacheSpdySessionIO::ProcessAvailableInput(
+ bool block, net::BufferedSpdyFramer* framer) {
+ const apr_read_type_e read_type = block ? APR_BLOCK_READ : APR_NONBLOCK_READ;
+
+ // Make sure the input brigade we're using is empty.
+ if (!APR_BRIGADE_EMPTY(input_brigade_)) {
+ LOG(DFATAL) << "input_brigade_ should be empty";
+ apr_brigade_cleanup(input_brigade_);
+ }
+
+ // Try to read some data into the brigade.
+ {
+ const apr_status_t status = ap_get_brigade(
+ connection_->input_filters, input_brigade_, AP_MODE_READBYTES,
+ read_type, kReadBytes);
+ if (status == APR_SUCCESS) {
+ // Success; we'll process the brigade below.
+ } else if (APR_STATUS_IS_EAGAIN(status)) {
+ // EAGAIN probably indicates that we did a non-blocking read and no data
+ // was available. So, just press on and process the brigade (it should
+ // be empty, but maybe there'll be metadata buckets or something). Most
+ // likely we'll end up returning READ_NO_DATA at the end of this method.
+ } else if (APR_STATUS_IS_TIMEUP(status)) {
+ // TIMEUP tends to occur for blocking reads, if some upstream filter set
+ // a timeout. Just like with EAGAIN, we'll press on and process the
+ // probably-empty brigade, but since these seem to be rare, let's VLOG
+ // here so that we can see when they happen.
+ VLOG(3) << "ap_get_brigade returned TIMEUP";
+ } else {
+ // Otherwise, something has gone wrong and we should consider the
+ // connection closed. If the client merely closed the connection on us,
+ // we'll get an EOF error, which is fine; otherwise, something may be
+ // wrong, so we should log an error.
+ if (APR_STATUS_IS_EOF(status)) {
+ VLOG(2) << "ap_get_brigade returned EOF";
+ } else {
+ LOG(ERROR) << "ap_get_brigade failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+ apr_brigade_cleanup(input_brigade_);
+ return READ_CONNECTION_CLOSED;
+ }
+ }
+
+ bool pushed_any_data = false;
+ while (!APR_BRIGADE_EMPTY(input_brigade_)) {
+ apr_bucket* bucket = APR_BRIGADE_FIRST(input_brigade_);
+
+ if (APR_BUCKET_IS_METADATA(bucket)) {
+ // Metadata bucket. We don't care about EOS or FLUSH buckets here (or
+ // other, unknown metadata buckets), and there's no further filter to
+ // pass it to, so we just ignore it.
+ } else {
+ // Data bucket -- get ready to read.
+ const char* data = NULL;
+ apr_size_t data_length = 0;
+ const apr_status_t status = apr_bucket_read(bucket, &data, &data_length,
+ read_type);
+ if (status != APR_SUCCESS) {
+ // TODO(mdsteele): In what situations might apr_bucket_read fail here?
+ // These buckets are almost certainly coming from mod_ssl, which
+ // seems to only use transient buckets, for which apr_bucket_read
+ // will always succeed. However, in theory there could be another
+ // filter between us and mod_ssl, and in theory it could be sending
+ // us bucket types for which non-blocking reads can fail.
+ LOG(ERROR) << "apr_bucket_read failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+
+ const size_t consumed = framer->ProcessInput(data, data_length);
+ // If the SpdyFramer encountered an error (i.e. the client sent us
+ // malformed data), then we can't recover.
+ if (framer->HasError()) {
+ apr_brigade_cleanup(input_brigade_);
+ return READ_ERROR;
+ }
+ // If there was no error, the framer will have consumed all the data.
+ // TODO(mdsteele): Is that true? I think it's true.
+ DCHECK(consumed == data_length);
+ pushed_any_data |= consumed > 0;
+ }
+
+ // Delete this bucket and move on to the next one.
+ apr_bucket_delete(bucket);
+ }
+
+ // We deleted buckets as we went, so the brigade should be empty now.
+ DCHECK(APR_BRIGADE_EMPTY(input_brigade_));
+
+ return pushed_any_data ? READ_SUCCESS : READ_NO_DATA;
+}
+
+SpdySessionIO::WriteStatus ApacheSpdySessionIO::SendFrameRaw(
+ const net::SpdyFrame& frame) {
+ // Make sure the output brigade we're using is empty.
+ if (!APR_BRIGADE_EMPTY(output_brigade_)) {
+ LOG(DFATAL) << "output_brigade_ should be empty";
+ apr_brigade_cleanup(output_brigade_);
+ }
+
+ // Put the frame data into the output brigade.
+ const base::StringPiece data = FrameData(frame);
+ APR_BRIGADE_INSERT_TAIL(output_brigade_, apr_bucket_transient_create(
+ data.data(), data.size(), output_brigade_->bucket_alloc));
+
+ // Append a flush bucket to the end of the brigade, to make sure that this
+ // frame makes it all the way out to the client.
+ APR_BRIGADE_INSERT_TAIL(output_brigade_, apr_bucket_flush_create(
+ output_brigade_->bucket_alloc));
+
+ // Send the brigade through the connection's output filter chain.
+ const apr_status_t status =
+ ap_pass_brigade(connection_->output_filters, output_brigade_);
+ apr_brigade_cleanup(output_brigade_);
+ DCHECK(APR_BRIGADE_EMPTY(output_brigade_));
+
+ // If we sent the data successfully, great; otherwise, consider the
+ // connection closed.
+ if (status == APR_SUCCESS) {
+ return WRITE_SUCCESS;
+ } else {
+ // ECONNABORTED and EPIPE (broken pipe) are two common symptoms of the
+ // connection having been closed; those are no cause for concern. For any
+ // other non-success status, log an error (for now).
+ if (APR_STATUS_IS_ECONNABORTED(status)) {
+ VLOG(2) << "ap_pass_brigade returned ECONNABORTED";
+ } else if (APR_STATUS_IS_EPIPE(status)) {
+ VLOG(2) << "ap_pass_brigade returned EPIPE";
+ } else {
+ LOG(ERROR) << "ap_pass_brigade failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+ return WRITE_CONNECTION_CLOSED;
+ }
+}
+
+} // namespace mod_spdy
Added: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.h
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.h?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.h (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.h Thu May 1 11:43:36 2014
@@ -0,0 +1,51 @@
+// Copyright 2011 Google Inc.
+//
+// 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.
+
+#ifndef MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
+#define MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
+
+#include "httpd.h"
+
+#include "base/basictypes.h"
+#include "mod_spdy/common/spdy_session_io.h"
+
+namespace net {
+class BufferedSpdyFramer;
+class SpdyFrame;
+} // namespace net
+
+namespace mod_spdy {
+
+class ApacheSpdySessionIO : public SpdySessionIO {
+ public:
+ explicit ApacheSpdySessionIO(conn_rec* connection);
+ ~ApacheSpdySessionIO();
+
+ // SpdySessionIO methods:
+ virtual bool IsConnectionAborted();
+ virtual ReadStatus ProcessAvailableInput(bool block,
+ net::BufferedSpdyFramer* framer);
+ virtual WriteStatus SendFrameRaw(const net::SpdyFrame& frame);
+
+ private:
+ conn_rec* const connection_;
+ apr_bucket_brigade* const input_brigade_;
+ apr_bucket_brigade* const output_brigade_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheSpdySessionIO);
+};
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
Propchange: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_session_io.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.cc (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.cc Thu May 1 11:43:36 2014
@@ -0,0 +1,163 @@
+// Copyright 2011 Google Inc.
+//
+// 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.
+
+#include "mod_spdy/apache/apache_spdy_stream_task_factory.h"
+
+#include "apr_buckets.h"
+#include "apr_network_io.h"
+#include "http_log.h"
+#include "util_filter.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "mod_spdy/apache/config_util.h"
+#include "mod_spdy/apache/filters/http_to_spdy_filter.h"
+#include "mod_spdy/apache/filters/spdy_to_http_filter.h"
+#include "mod_spdy/apache/log_message_handler.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/apache/slave_connection.h"
+#include "mod_spdy/apache/slave_connection_context.h"
+#include "mod_spdy/common/spdy_stream.h"
+#include "net/instaweb/util/public/function.h"
+
+namespace mod_spdy {
+
+namespace {
+
+// These global variables store the filter handles for our filters. Normally,
+// global variables would be very dangerous in a concurrent environment like
+// Apache, but these ones are okay because they are assigned just once, at
+// start-up (during which Apache is running single-threaded; see TAMB 2.2.1),
+// and are read-only thereafter.
+ap_filter_rec_t* gHttpToSpdyFilterHandle = NULL;
+ap_filter_rec_t* gSpdyToHttpFilterHandle = NULL;
+
+// See TAMB 8.4.2
+apr_status_t SpdyToHttpFilterFunc(ap_filter_t* filter,
+ apr_bucket_brigade* brigade,
+ ap_input_mode_t mode,
+ apr_read_type_e block,
+ apr_off_t readbytes) {
+ mod_spdy::SpdyToHttpFilter* spdy_to_http_filter =
+ static_cast<mod_spdy::SpdyToHttpFilter*>(filter->ctx);
+ return spdy_to_http_filter->Read(filter, brigade, mode, block, readbytes);
+}
+
+// See TAMB 8.4.1
+apr_status_t HttpToSpdyFilterFunc(ap_filter_t* filter,
+ apr_bucket_brigade* input_brigade) {
+ mod_spdy::HttpToSpdyFilter* http_to_spdy_filter =
+ static_cast<mod_spdy::HttpToSpdyFilter*>(filter->ctx);
+ return http_to_spdy_filter->Write(filter, input_brigade);
+}
+
+// A task to be returned by ApacheSpdyStreamTaskFactory::NewStreamTask().
+class ApacheStreamTask : public net_instaweb::Function {
+ public:
+ // The task does not take ownership of the arguments.
+ ApacheStreamTask(SlaveConnectionFactory* conn_factory,
+ SpdyStream* stream);
+ virtual ~ApacheStreamTask();
+
+ protected:
+ // net_instaweb::Function methods:
+ virtual void Run();
+ virtual void Cancel();
+
+ private:
+ SpdyStream* const stream_;
+ scoped_ptr<SlaveConnection> slave_connection_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheStreamTask);
+};
+
+ApacheStreamTask::ApacheStreamTask(SlaveConnectionFactory* conn_factory,
+ SpdyStream* stream)
+ : stream_(stream),
+ slave_connection_(conn_factory->Create()) {
+ const SpdyServerConfig* config =
+ GetServerConfig(slave_connection_->apache_connection());
+
+ // SlaveConnectionFactory::Create must have attached a slave context.
+ SlaveConnectionContext* slave_context =
+ slave_connection_->GetSlaveConnectionContext();
+ slave_context->set_slave_stream(stream);
+
+ // Create our filters to hook us up to the slave connection.
+ SpdyToHttpFilter* spdy_to_http_filter = new SpdyToHttpFilter(stream);
+ PoolRegisterDelete(slave_connection_->apache_connection()->pool,
+ spdy_to_http_filter);
+ slave_context->SetInputFilter(gSpdyToHttpFilterHandle, spdy_to_http_filter);
+
+ HttpToSpdyFilter* http_to_spdy_filter = new HttpToSpdyFilter(config, stream);
+ PoolRegisterDelete(slave_connection_->apache_connection()->pool,
+ http_to_spdy_filter);
+ slave_context->SetOutputFilter(gHttpToSpdyFilterHandle, http_to_spdy_filter);
+}
+
+ApacheStreamTask::~ApacheStreamTask() {
+}
+
+void ApacheStreamTask::Run() {
+ ScopedStreamLogHandler log_handler(
+ slave_connection_->apache_connection(), stream_);
+ VLOG(3) << "Starting stream task";
+ if (!stream_->is_aborted()) {
+ slave_connection_->Run();
+ }
+ VLOG(3) << "Finishing stream task";
+}
+
+void ApacheStreamTask::Cancel() {
+ if (VLOG_IS_ON(3)) {
+ ScopedStreamLogHandler log_handler(
+ slave_connection_->apache_connection(), stream_);
+ VLOG(3) << "Cancelling stream task";
+ }
+}
+
+} // namespace
+
+ApacheSpdyStreamTaskFactory::ApacheSpdyStreamTaskFactory(conn_rec* connection)
+ : connection_factory_(connection) {}
+
+ApacheSpdyStreamTaskFactory::~ApacheSpdyStreamTaskFactory() {}
+
+void ApacheSpdyStreamTaskFactory::InitFilters() {
+ // Register our input filter, and store the filter handle into a global
+ // variable so we can use it later to instantiate our filter into a filter
+ // chain. The "filter type" argument below determines where in the filter
+ // chain our filter will be placed. We use AP_FTYPE_NETWORK so that we will
+ // be at the very end of the input chain for slave connections, in place of
+ // the usual core input filter.
+ gSpdyToHttpFilterHandle = ap_register_input_filter(
+ "SPDY_TO_HTTP", // name
+ SpdyToHttpFilterFunc, // filter function
+ NULL, // init function (n/a in our case)
+ AP_FTYPE_NETWORK); // filter type
+
+ // Now register our output filter, analogously to the input filter above.
+ gHttpToSpdyFilterHandle = ap_register_output_filter(
+ "HTTP_TO_SPDY", // name
+ HttpToSpdyFilterFunc, // filter function
+ NULL, // init function (n/a in our case)
+ AP_FTYPE_NETWORK); // filter type
+}
+
+net_instaweb::Function* ApacheSpdyStreamTaskFactory::NewStreamTask(
+ SpdyStream* stream) {
+ return new ApacheStreamTask(&connection_factory_, stream);
+}
+
+} // namespace mod_spdy
Added: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.h
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.h?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.h (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.h Thu May 1 11:43:36 2014
@@ -0,0 +1,50 @@
+// Copyright 2011 Google Inc.
+//
+// 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.
+
+#ifndef MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
+#define MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
+
+#include "httpd.h"
+
+#include "base/basictypes.h"
+#include "mod_spdy/apache/slave_connection.h"
+#include "mod_spdy/common/spdy_stream_task_factory.h"
+
+namespace net_instaweb { class Function; }
+
+namespace mod_spdy {
+
+class SpdyStream;
+
+class ApacheSpdyStreamTaskFactory : public SpdyStreamTaskFactory {
+ public:
+ explicit ApacheSpdyStreamTaskFactory(conn_rec* connection);
+ ~ApacheSpdyStreamTaskFactory();
+
+ // This must be called from hooks registration to create the filters
+ // this class needs to route bytes between Apache & mod_spdy.
+ static void InitFilters();
+
+ // SpdyStreamTaskFactory methods:
+ virtual net_instaweb::Function* NewStreamTask(SpdyStream* stream);
+
+ private:
+ SlaveConnectionFactory connection_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheSpdyStreamTaskFactory);
+};
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
Propchange: httpd/mod_spdy/trunk/mod_spdy/apache/apache_spdy_stream_task_factory.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.cc (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.cc Thu May 1 11:43:36 2014
@@ -0,0 +1,171 @@
+// Copyright 2010 Google Inc.
+//
+// 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.
+
+#include "mod_spdy/apache/config_commands.h"
+
+#include "apr_strings.h"
+
+#include "base/string_number_conversions.h"
+
+#include "mod_spdy/apache/config_util.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/common/spdy_server_config.h"
+#include "mod_spdy/common/protocol_util.h"
+
+namespace mod_spdy {
+
+void* CreateSpdyServerConfig(apr_pool_t* pool, server_rec* server) {
+ SpdyServerConfig* config = new SpdyServerConfig;
+ PoolRegisterDelete(pool, config);
+ return config;
+}
+
+void* MergeSpdyServerConfigs(apr_pool_t* pool, void* base, void* add) {
+ SpdyServerConfig* config = new SpdyServerConfig;
+ PoolRegisterDelete(pool, config);
+ config->MergeFrom(*static_cast<SpdyServerConfig*>(base),
+ *static_cast<SpdyServerConfig*>(add));
+ return config;
+}
+
+namespace {
+
+// A function suitable for for passing to AP_INIT_TAKE1 (and hence to
+// SPDY_CONFIG_COMMAND) for a config option that requires a boolean argument
+// ("on" or "off", case-insensitive; other strings will be rejected). The
+// template argument is a setter method on SpdyServerConfig that takes a bool.
+template <void(SpdyServerConfig::*setter)(bool)>
+const char* SetBoolean(cmd_parms* cmd, void* dir, const char* arg) {
+ if (0 == apr_strnatcasecmp(arg, "on")) {
+ (GetServerConfig(cmd)->*setter)(true);
+ return NULL;
+ } else if (0 == apr_strnatcasecmp(arg, "off")) {
+ (GetServerConfig(cmd)->*setter)(false);
+ return NULL;
+ } else {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name, " on|off", NULL);
+ }
+}
+
+// A function suitable for for passing to AP_INIT_TAKE1 (and hence to
+// SPDY_CONFIG_COMMAND) for a config option that requires a positive integer
+// argument. The template argument is a setter method on SpdyServerConfig that
+// takes an int; the method will only ever be called with a positive argument
+// (if the user gives a non-positive argument, or a string that isn't even an
+// integer, this function will reject it with an error message).
+template <void(SpdyServerConfig::*setter)(int)>
+const char* SetPositiveInt(cmd_parms* cmd, void* dir, const char* arg) {
+ int value;
+ if (!base::StringToInt(arg, &value) || value < 1) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must specify a positive integer", NULL);
+ }
+ (GetServerConfig(cmd)->*setter)(value);
+ return NULL;
+}
+
+// Like SetPositiveInt, but allows any non-negative value, not just positive.
+template <void(SpdyServerConfig::*setter)(int)>
+const char* SetNonNegativeInt(cmd_parms* cmd, void* dir, const char* arg) {
+ int value;
+ if (!base::StringToInt(arg, &value) || value < 0) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must specify a non-negative integer", NULL);
+ }
+ (GetServerConfig(cmd)->*setter)(value);
+ return NULL;
+}
+
+const char* SetUseSpdyForNonSslConnections(cmd_parms* cmd, void* dir,
+ const char* arg) {
+ spdy::SpdyVersion value;
+ if (0 == apr_strnatcasecmp(arg, "off")) {
+ value = spdy::SPDY_VERSION_NONE;
+ } else if (0 == apr_strnatcasecmp(arg, "2")) {
+ value = spdy::SPDY_VERSION_2;
+ } else if (0 == apr_strnatcasecmp(arg, "3")) {
+ value = spdy::SPDY_VERSION_3;
+ } else if (0 == apr_strnatcasecmp(arg, "3.1")) {
+ value = spdy::SPDY_VERSION_3_1;
+ } else {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must be 2, 3, 3.1, or off", NULL);
+ }
+ GetServerConfig(cmd)->set_use_spdy_version_without_ssl(value);
+ return NULL;
+}
+
+// This template can be wrapped around any of the above functions to restrict
+// the directive to being used only at the top level (as opposed to within a
+// <VirtualHost> directive).
+template <const char*(*setter)(cmd_parms*, void*, const char*)>
+const char* GlobalOnly(cmd_parms* cmd, void* dir, const char* arg) {
+ const char* error = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+ return error != NULL ? error : (*setter)(cmd, dir, arg);
+}
+
+} // namespace
+
+// The reinterpret_cast is there because Apache's AP_INIT_TAKE1 macro needs to
+// take an old-style C function type with unspecified arguments. The
+// static_cast, then, is just to enforce that we pass the correct type of
+// function -- it will give a compile-time error if we pass a function with the
+// wrong signature.
+#define SPDY_CONFIG_COMMAND(name, fn, help) \
+ AP_INIT_TAKE1( \
+ name, \
+ reinterpret_cast<const char*(*)()>( \
+ static_cast<const char*(*)(cmd_parms*,void*,const char*)>(fn)), \
+ NULL, RSRC_CONF, help)
+
+const command_rec kSpdyConfigCommands[] = {
+ SPDY_CONFIG_COMMAND(
+ "SpdyEnabled", SetBoolean<&SpdyServerConfig::set_spdy_enabled>,
+ "Enable SPDY support"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxStreamsPerConnection",
+ SetPositiveInt<&SpdyServerConfig::set_max_streams_per_connection>,
+ "Maxiumum number of simultaneous SPDY streams per connection"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMinThreadsPerProcess",
+ GlobalOnly<SetPositiveInt<
+ &SpdyServerConfig::set_min_threads_per_process> >,
+ "Miniumum number of worker threads to spawn per child process"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxThreadsPerProcess",
+ GlobalOnly<SetPositiveInt<
+ &SpdyServerConfig::set_max_threads_per_process> >,
+ "Maximum number of worker threads to spawn per child process"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxServerPushDepth",
+ SetNonNegativeInt<
+ &SpdyServerConfig::set_max_server_push_depth>,
+ "Maximum number of recursive levels to follow X-Associated-Content header. 0 Disables. Defaults to 1."),
+ SPDY_CONFIG_COMMAND(
+ "SpdySendVersionHeader",
+ SetBoolean<&SpdyServerConfig::set_send_version_header>,
+ "Send an x-mod-spdy header with the module version number"),
+ // Debugging commands, which should not be used in production:
+ SPDY_CONFIG_COMMAND(
+ "SpdyDebugLoggingVerbosity",
+ GlobalOnly<SetNonNegativeInt<&SpdyServerConfig::set_vlog_level> >,
+ "Set the verbosity of mod_spdy logging"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyDebugUseSpdyForNonSslConnections",
+ SetUseSpdyForNonSslConnections,
+ "Use SPDY even over non-SSL connections; DO NOT USE IN PRODUCTION"),
+ {NULL}
+};
+
+} // namespace mod_spdy
Added: httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.h
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.h?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.h (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.h Thu May 1 11:43:36 2014
@@ -0,0 +1,37 @@
+// Copyright 2010 Google Inc.
+//
+// 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.
+
+#ifndef MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
+#define MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
+
+#include "httpd.h"
+#include "http_config.h"
+
+namespace mod_spdy {
+
+// An array of configuration command objects, to be placed into an Apache
+// module object. See TAMB 9.4.
+extern const command_rec kSpdyConfigCommands[];
+
+// A function to create new server config objects, with a function signature
+// appropriate to be placed into an Apache module object. See TAMB 9.3.1.
+void* CreateSpdyServerConfig(apr_pool_t* pool, server_rec* server);
+
+// A function to merge existing server config objects, with a signature
+// appropriate to be placed into an Apache module object. See TAMB 9.5.
+void* MergeSpdyServerConfigs(apr_pool_t* pool, void* base, void* add);
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
Propchange: httpd/mod_spdy/trunk/mod_spdy/apache/config_commands.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/mod_spdy/trunk/mod_spdy/apache/config_util.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/config_util.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/config_util.cc (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/config_util.cc Thu May 1 11:43:36 2014
@@ -0,0 +1,139 @@
+// Copyright 2010 Google Inc.
+//
+// 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.
+
+#include "mod_spdy/apache/config_util.h"
+
+#include "httpd.h"
+#include "http_config.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+
+#include "mod_spdy/apache/master_connection_context.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/apache/slave_connection_context.h"
+#include "mod_spdy/common/spdy_server_config.h"
+
+extern "C" {
+ extern module AP_MODULE_DECLARE_DATA spdy_module;
+}
+
+namespace mod_spdy {
+
+namespace {
+
+struct ConnectionContext {
+ // Exactly one of the fields below should be set.
+ scoped_ptr<MasterConnectionContext> master_context;
+ scoped_ptr<SlaveConnectionContext> slave_context;
+};
+
+SpdyServerConfig* GetServerConfigInternal(server_rec* server) {
+ void* ptr = ap_get_module_config(server->module_config, &spdy_module);
+ CHECK(ptr) << "mod_spdy server config pointer is NULL";
+ return static_cast<SpdyServerConfig*>(ptr);
+}
+
+ConnectionContext* GetConnContextInternal(conn_rec* connection) {
+ return static_cast<ConnectionContext*>(
+ ap_get_module_config(connection->conn_config, &spdy_module));
+}
+
+ConnectionContext* SetConnContextInternal(
+ conn_rec* connection,
+ MasterConnectionContext* master_context,
+ SlaveConnectionContext* slave_context) {
+ DCHECK((master_context == NULL) ^ (slave_context == NULL));
+ DCHECK(GetConnContextInternal(connection) == NULL);
+ ConnectionContext* context = new ConnectionContext;
+ PoolRegisterDelete(connection->pool, context);
+ context->master_context.reset(master_context);
+ context->slave_context.reset(slave_context);
+
+ // Place the context object in the connection's configuration vector, so that
+ // other hook functions with access to this connection can get hold of the
+ // context object. See TAMB 4.2 for details.
+ ap_set_module_config(connection->conn_config, // configuration vector
+ &spdy_module, // module with which to associate
+ context); // pointer to store (any void* we want)
+
+ return context;
+}
+
+MasterConnectionContext* GetMasterConnectionContextInternal(
+ conn_rec* connection) {
+ ConnectionContext* context = GetConnContextInternal(connection);
+ return (context != NULL) ? context->master_context.get() : NULL;
+}
+
+SlaveConnectionContext* GetSlaveConnectionContextInternal(
+ conn_rec* connection) {
+ ConnectionContext* context = GetConnContextInternal(connection);
+ return (context != NULL) ? context->slave_context.get() : NULL;
+}
+
+} // namespace
+
+const SpdyServerConfig* GetServerConfig(server_rec* server) {
+ return GetServerConfigInternal(server);
+}
+
+const SpdyServerConfig* GetServerConfig(conn_rec* connection) {
+ return GetServerConfigInternal(connection->base_server);
+}
+
+const SpdyServerConfig* GetServerConfig(request_rec* request) {
+ return GetServerConfigInternal(request->server);
+}
+
+SpdyServerConfig* GetServerConfig(cmd_parms* command) {
+ return GetServerConfigInternal(command->server);
+}
+
+MasterConnectionContext* CreateMasterConnectionContext(conn_rec* connection,
+ bool using_ssl) {
+ ConnectionContext* context = SetConnContextInternal(
+ connection, new MasterConnectionContext(using_ssl), NULL);
+ return context->master_context.get();
+}
+
+SlaveConnectionContext* CreateSlaveConnectionContext(conn_rec* connection) {
+ ConnectionContext* context = SetConnContextInternal(
+ connection, NULL, new SlaveConnectionContext());
+ return context->slave_context.get();
+}
+
+bool HasMasterConnectionContext(conn_rec* connection) {
+ return GetMasterConnectionContextInternal(connection) != NULL;
+}
+
+bool HasSlaveConnectionContext(conn_rec* connection) {
+ return GetSlaveConnectionContextInternal(connection) != NULL;
+}
+
+MasterConnectionContext* GetMasterConnectionContext(conn_rec* connection) {
+ MasterConnectionContext* context =
+ GetMasterConnectionContextInternal(connection);
+ DCHECK(context != NULL);
+ return context;
+}
+
+SlaveConnectionContext* GetSlaveConnectionContext(conn_rec* connection) {
+ SlaveConnectionContext* context =
+ GetSlaveConnectionContextInternal(connection);
+ DCHECK(context != NULL);
+ return context;
+}
+
+} // namespace mod_spdy
Added: httpd/mod_spdy/trunk/mod_spdy/apache/config_util.h
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/apache/config_util.h?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/apache/config_util.h (added)
+++ httpd/mod_spdy/trunk/mod_spdy/apache/config_util.h Thu May 1 11:43:36 2014
@@ -0,0 +1,74 @@
+// Copyright 2010 Google Inc.
+//
+// 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.
+
+#ifndef MOD_SPDY_APACHE_CONFIG_UTIL_H_
+#define MOD_SPDY_APACHE_CONFIG_UTIL_H_
+
+#include "httpd.h"
+#include "http_config.h"
+
+namespace mod_spdy {
+
+class MasterConnectionContext;
+class SlaveConnectionContext;
+class SpdyServerConfig;
+class SpdyStream;
+
+// Get the server configuration associated with the given object. The
+// configuration object is returned const, since by the time these functions
+// are being used, the configuration should be treated as read-only.
+const SpdyServerConfig* GetServerConfig(server_rec* server);
+const SpdyServerConfig* GetServerConfig(conn_rec* connection);
+const SpdyServerConfig* GetServerConfig(request_rec* request);
+
+// Get the server configuration associated with the given configuration command
+// parameters. Since this is for setting the configuration (rather than just
+// reading it), the configuration object is returned non-const.
+SpdyServerConfig* GetServerConfig(cmd_parms* command);
+
+// Allocate a new MasterConnectionContext object for a master connection in the given
+// connection's pool, attach it to the connection's config vector, and return
+// it. Cannot be called on connection which previously was passed to
+// Create[Master|Slave]ConnectionContext.
+MasterConnectionContext* CreateMasterConnectionContext(
+ conn_rec* connection, bool using_ssl);
+
+// Allocate a new ConnectionContext object for a slave connection in the given
+// connection's pool, attach it to the connection's config vector, and return
+// it. Cannot be called on connection which previously was passed to
+// Create[Master|Slave]ConnectionContext.
+SlaveConnectionContext* CreateSlaveConnectionContext(conn_rec* connection);
+
+// Returns true if the connection has had a master connection context set.
+// We expect the result to be true for outgoing connections for which
+// mod_spdy is enabled on the server and which are using SSL, and on which
+// the pre-connection hook has fired.
+bool HasMasterConnectionContext(conn_rec* connection);
+
+// Returns true if the connection has had a slave connection context set.
+bool HasSlaveConnectionContext(conn_rec* connection);
+
+// Get the master connection context that was set on this connection
+// by a call to CreateMasterConnectionContext. Precondition:
+// HasMasterConnectionContext has been called, and returned true.
+MasterConnectionContext* GetMasterConnectionContext(conn_rec* connection);
+
+// Get the slave connection context that was set on this connection
+// by a call to CreateSlaveConnectionContext.
+// Precondition: HasSlaveConnectionContext has been called, and returned true.
+SlaveConnectionContext* GetSlaveConnectionContext(conn_rec* connection);
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_CONFIG_UTIL_H_
Propchange: httpd/mod_spdy/trunk/mod_spdy/apache/config_util.h
------------------------------------------------------------------------------
svn:eol-style = native