[libsoup/gnome-3-6] tests: add support for Apache 2.4
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/gnome-3-6] tests: add support for Apache 2.4
- Date: Mon, 12 Nov 2012 21:50:57 +0000 (UTC)
commit 1d60cfd4ee5eecd9489160adc9fcd6a7b7ce1859
Author: Dan Winship <danw gnome org>
Date: Mon Oct 22 20:15:49 2012 +0200
tests: add support for Apache 2.4
configure.ac | 27 +++++++++++++-----
tests/Makefile.am | 26 +++++++++++++++++-
tests/{httpd.conf.in => httpd.conf.22.in} | 0
tests/{httpd.conf.in => httpd.conf.24.in} | 41 +++++++++-------------------
tests/range-test.c | 13 ++++++---
5 files changed, 65 insertions(+), 42 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d10d2dc..80f8661 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,11 @@ if test "$APACHE_HTTPD" != "no"; then
case $apache_version in
2.2.*)
AC_MSG_RESULT([$apache_version (ok)])
+ apache_version=2.2
+ ;;
+ 2.4.*)
+ AC_MSG_RESULT([$apache_version (ok)])
+ apache_version=2.4
;;
*)
AC_MSG_RESULT([$apache_version (ignoring)])
@@ -227,7 +232,7 @@ if test "$APACHE_HTTPD" != "no"; then
AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
apache_module_dirs="$withval",
[apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
- mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
+ mpm=`$APACHE_HTTPD -V -C "ServerName localhost" | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
# This only works with bash, but should fail harmlessly in sh
apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
for dir in $apache_module_dirs; do
@@ -256,6 +261,11 @@ fi
if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
+ if test $apache_version = 2.2; then
+ AC_DEFINE(HAVE_APACHE_2_2, 1, [Apache is 2.2.x])
+ else
+ AC_DEFINE(HAVE_APACHE_2_4, 1, [Apache is 2.4.x])
+ fi
have_apache=1
if test -z "$APACHE_PHP_MODULE_DIR"; then
MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
@@ -268,7 +278,9 @@ else
MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
fi
fi
-AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
+AM_CONDITIONAL(HAVE_APACHE, test "$have_apache" = 1)
+AM_CONDITIONAL(HAVE_APACHE_2_2, test "$apache_version" = 2.2)
+AM_CONDITIONAL(HAVE_APACHE_2_4, test "$apache_version" = 2.4)
if test "$have_apache" = 1; then
AC_CHECK_PROGS(PHP, php php5)
@@ -285,19 +297,19 @@ if test "$have_apache" = 1; then
AC_MSG_RESULT($have_php)
if test "$have_php" = yes; then
- AC_MSG_CHECKING([for xmlrpc-epi-php])
+ AC_MSG_CHECKING([for xmlrpc-php])
if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
- have_xmlrpc_epi_php=no
+ have_xmlrpc_php=no
MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
else
- have_xmlrpc_epi_php=yes
+ have_xmlrpc_php=yes
fi
- AC_MSG_RESULT($have_xmlrpc_epi_php)
+ AC_MSG_RESULT($have_xmlrpc_php)
fi
fi
AC_SUBST(IF_HAVE_PHP)
-AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
+AM_CONDITIONAL(HAVE_XMLRPC_PHP, test "$have_xmlrpc_php" = yes)
AC_PATH_PROG(CURL, curl, no)
if test "$CURL" != no; then
@@ -359,7 +371,6 @@ AC_CONFIG_FILES([
po/Makefile.in
po/Makefile
tests/Makefile
- tests/httpd.conf
docs/Makefile
docs/reference/Makefile
])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d2a1cd6..d992634 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -85,10 +85,29 @@ endif
if HAVE_CURL
CURL_TESTS = forms-test server-auth-test
endif
-if HAVE_XMLRPC_EPI_PHP
+if HAVE_XMLRPC_PHP
XMLRPC_TESTS = xmlrpc-test xmlrpc-server-test
endif
+if HAVE_APACHE
+if HAVE_APACHE_2_2
+httpd_conf_in = httpd.conf.22.in
+else
+httpd_conf_in = httpd.conf.24.in
+endif
+httpd.conf: $(httpd_conf_in)
+ $(AM_V_GEN) sed -e 's,[ ]srcdir@,$(srcdir),' \
+ -e 's,[ ]builddir@,$(builddir),' \
+ -e 's,[ ]APACHE_MODULE_DIR@,$(APACHE_MODULE_DIR),' \
+ -e 's,[ ]APACHE_PHP_MODULE_DIR@,$(APACHE_PHP_MODULE_DIR),' \
+ -e 's,[ ]APACHE_PHP_MODULE@,$(APACHE_PHP_MODULE),' \
+ -e 's,[ ]IF_HAVE_PHP@,$(IF_HAVE_PHP),' \
+ -e 's,[ ]APACHE_SSL_MODULE_DIR@,$(APACHE_SSL_MODULE_DIR),' \
+ $< > $@ || rm -f $@
+
+BUILT_SOURCES = httpd.conf
+endif
+
TESTS = \
chunk-test \
coding-test \
@@ -130,7 +149,8 @@ RESOURCES = \
EXTRA_DIST = \
htdigest \
htpasswd \
- httpd.conf.in \
+ httpd.conf.22.in \
+ httpd.conf.24.in \
index.txt \
libsoup.supp \
test-cert.pem \
@@ -138,6 +158,8 @@ EXTRA_DIST = \
xmlrpc-server.php \
$(RESOURCES)
+DISTCLEANFILES = httpd.conf
+
if MISSING_REGRESSION_TEST_PACKAGES
check-local: check-TESTS
@echo ""
diff --git a/tests/httpd.conf.in b/tests/httpd.conf.22.in
similarity index 100%
copy from tests/httpd.conf.in
copy to tests/httpd.conf.22.in
diff --git a/tests/httpd.conf.in b/tests/httpd.conf.24.in
similarity index 92%
rename from tests/httpd.conf.in
rename to tests/httpd.conf.24.in
index de0b75f..2407ad7 100644
--- a/tests/httpd.conf.in
+++ b/tests/httpd.conf.24.in
@@ -4,6 +4,7 @@ ServerName 127.0.0.1
Listen 127.0.0.1:47524
PidFile @builddir@/httpd.pid
+DefaultRuntimeDir @builddir@
DocumentRoot @srcdir@
# The tests shut down apache with "graceful-stop", because that makes
@@ -14,10 +15,13 @@ GracefulShutdownTimeout 1
# Change this to "./error.log" if it's failing and you don't know why
ErrorLog /dev/null
+LoadModule mpm_prefork_module @APACHE_MODULE_DIR@/mod_mpm_prefork.so
LoadModule alias_module @APACHE_MODULE_DIR@/mod_alias.so
LoadModule auth_basic_module @APACHE_MODULE_DIR@/mod_auth_basic.so
LoadModule auth_digest_module @APACHE_MODULE_DIR@/mod_auth_digest.so
+LoadModule authn_core_module @APACHE_MODULE_DIR@/mod_authn_core.so
LoadModule authn_file_module @APACHE_MODULE_DIR@/mod_authn_file.so
+LoadModule authz_core_module @APACHE_MODULE_DIR@/mod_authz_core.so
LoadModule authz_host_module @APACHE_MODULE_DIR@/mod_authz_host.so
LoadModule authz_user_module @APACHE_MODULE_DIR@/mod_authz_user.so
LoadModule dir_module @APACHE_MODULE_DIR@/mod_dir.so
@@ -27,6 +31,7 @@ LoadModule proxy_module @APACHE_MODULE_DIR@/mod_proxy.so
LoadModule proxy_http_module @APACHE_MODULE_DIR@/mod_proxy_http.so
LoadModule proxy_connect_module @APACHE_MODULE_DIR@/mod_proxy_connect.so
LoadModule ssl_module @APACHE_SSL_MODULE_DIR@/mod_ssl.so
+LoadModule unixd_module @APACHE_SSL_MODULE_DIR@/mod_unixd.so
DirectoryIndex index.txt
TypesConfig /dev/null
@@ -41,26 +46,22 @@ Listen 127.0.0.1:47526
# Deny proxying by default
<Proxy *>
- Order Deny,Allow
- Deny from all
+ Require all denied
</Proxy>
# Allow local http connections
<Proxy http://127.0.0.1*>
- Order Allow,Deny
- Allow from all
+ Require all granted
</Proxy>
# Allow CONNECT to local https port
<Proxy 127.0.0.1:47525>
- Order Allow,Deny
- Allow from all
+ Require all granted
</Proxy>
# Deny non-proxy requests
<Directory />
- Order Deny,Allow
- Deny from all
+ Require all denied
</Directory>
</VirtualHost>
@@ -72,15 +73,11 @@ Listen 127.0.0.1:47527
# Deny proxying by default
<Proxy *>
- Order Deny,Allow
- Deny from all
+ Require all denied
</Proxy>
# Allow local http connections with authentication
<Proxy http://127.0.0.1:47524*>
- Order Allow,Deny
- Allow from all
-
AuthType Basic
AuthName realm1
AuthUserFile @srcdir@/htpasswd
@@ -89,9 +86,6 @@ Listen 127.0.0.1:47527
# Allow CONNECT to local https port with authentication
<Proxy 127.0.0.1:47525>
- Order Allow,Deny
- Allow from all
-
AuthType Basic
AuthName realm1
AuthUserFile @srcdir@/htpasswd
@@ -100,8 +94,7 @@ Listen 127.0.0.1:47527
# Fail non-proxy requests
<Directory />
- Order Deny,Allow
- Deny from all
+ Require all denied
</Directory>
</VirtualHost>
@@ -113,15 +106,11 @@ Listen 127.0.0.1:47528
# Deny proxying by default
<Proxy *>
- Order Deny,Allow
- Deny from all
+ Require all denied
</Proxy>
# Allow local http connections with authentication
<Proxy http://127.0.0.1:47524*>
- Order Allow,Deny
- Allow from all
-
AuthType Basic
AuthName realm1
AuthUserFile @srcdir@/htpasswd
@@ -130,9 +119,6 @@ Listen 127.0.0.1:47528
# Allow CONNECT to local https port with authentication
<Proxy 127.0.0.1:47525>
- Order Allow,Deny
- Allow from all
-
AuthType Basic
AuthName realm1
AuthUserFile @srcdir@/htpasswd
@@ -141,8 +127,7 @@ Listen 127.0.0.1:47528
# Fail non-proxy requests
<Directory />
- Order Deny,Allow
- Deny from all
+ Require all denied
</Directory>
</VirtualHost>
diff --git a/tests/range-test.c b/tests/range-test.c
index 98f5645..09e95f1 100644
--- a/tests/range-test.c
+++ b/tests/range-test.c
@@ -229,7 +229,8 @@ request_triple_range (SoupSession *session, const char *uri,
}
static void
-do_range_test (SoupSession *session, const char *uri, gboolean expect_coalesce)
+do_range_test (SoupSession *session, const char *uri,
+ gboolean expect_coalesce, gboolean expect_partial_coalesce)
{
int twelfths = full_response->length / 12;
@@ -309,7 +310,7 @@ do_range_test (SoupSession *session, const char *uri, gboolean expect_coalesce)
9 * twelfths, 10 * twelfths + 5,
4 * twelfths, 5 * twelfths,
10 * twelfths - 5, 11 * twelfths,
- expect_coalesce ? 2 : 3);
+ expect_partial_coalesce ? 2 : 3);
if (memcmp (full_response->data, test_response, full_response->length) != 0) {
debug_printf (1, "\nfull_response and test_response don't match\n");
@@ -346,14 +347,18 @@ main (int argc, char **argv)
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
debug_printf (1, "1. Testing against apache\n");
- do_range_test (session, "http://127.0.0.1:47524/", FALSE);
+#if HAVE_APACHE_2_2
+ do_range_test (session, "http://127.0.0.1:47524/", FALSE, FALSE);
+#else
+ do_range_test (session, "http://127.0.0.1:47524/", TRUE, FALSE);
+#endif
debug_printf (1, "\n2. Testing against SoupServer\n");
server = soup_test_server_new (FALSE);
soup_server_add_handler (server, NULL, server_handler, NULL, NULL);
base_uri = g_strdup_printf ("http://127.0.0.1:%u/",
soup_server_get_port (server));
- do_range_test (session, base_uri, TRUE);
+ do_range_test (session, base_uri, TRUE, TRUE);
g_free (base_uri);
soup_test_server_quit_unref (server);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]