diff options
author | Dan Winship <danw@gnome.org> | 2012-10-22 20:15:49 +0200 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-10-22 20:15:49 +0200 |
commit | af44b7b8df5bcb9bb304e36ffad9b65c6ee22594 (patch) | |
tree | 376bf7c52658e37ae70ec2d42937d774666afa74 /tests | |
parent | 07ad1e0728553817e7b9be9b4d192383760c201e (diff) | |
download | libsoup-af44b7b8df5bcb9bb304e36ffad9b65c6ee22594.tar.gz libsoup-af44b7b8df5bcb9bb304e36ffad9b65c6ee22594.tar.bz2 libsoup-af44b7b8df5bcb9bb304e36ffad9b65c6ee22594.zip |
tests: add support for Apache 2.4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 26 | ||||
-rw-r--r-- | tests/httpd.conf.22.in (renamed from tests/httpd.conf.in) | 0 | ||||
-rw-r--r-- | tests/httpd.conf.24.in | 278 | ||||
-rw-r--r-- | tests/range-test.c | 13 |
4 files changed, 310 insertions, 7 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 085a81b3..54ce7bdb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -89,10 +89,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 + soup-tests.gresource: soup-tests.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/soup-tests.gresource.xml) $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $< @@ -138,7 +157,8 @@ RESOURCES = \ EXTRA_DIST = \ htdigest \ htpasswd \ - httpd.conf.in \ + httpd.conf.22.in \ + httpd.conf.24.in \ index.txt \ libsoup.supp \ soup-tests.gresource.xml \ @@ -147,7 +167,7 @@ EXTRA_DIST = \ xmlrpc-server.php \ $(RESOURCES) -DISTCLEANFILES = soup-tests.gresource +DISTCLEANFILES = soup-tests.gresource httpd.conf if MISSING_REGRESSION_TEST_PACKAGES check-local: check-TESTS diff --git a/tests/httpd.conf.in b/tests/httpd.conf.22.in index de0b75fa..de0b75fa 100644 --- a/tests/httpd.conf.in +++ b/tests/httpd.conf.22.in diff --git a/tests/httpd.conf.24.in b/tests/httpd.conf.24.in new file mode 100644 index 00000000..2407ad75 --- /dev/null +++ b/tests/httpd.conf.24.in @@ -0,0 +1,278 @@ +# http.conf used for testing auth-test + +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 +# it close its listening socket right away. But it seems to sometimes +# result in apache never fully exiting. This fixes that. +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 +LoadModule mime_module @APACHE_MODULE_DIR@/mod_mime.so +@IF_HAVE_PHP@LoadModule php5_module @APACHE_PHP_MODULE_DIR@/@APACHE_PHP_MODULE@ +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 +AddType application/x-httpd-php .php +Redirect permanent /redirected /index.txt + +# Proxy #1: unauthenticated +Listen 127.0.0.1:47526 +<VirtualHost 127.0.0.1:47526> + ProxyRequests On + AllowCONNECT 47525 + + # Deny proxying by default + <Proxy *> + Require all denied + </Proxy> + + # Allow local http connections + <Proxy http://127.0.0.1*> + Require all granted + </Proxy> + + # Allow CONNECT to local https port + <Proxy 127.0.0.1:47525> + Require all granted + </Proxy> + + # Deny non-proxy requests + <Directory /> + Require all denied + </Directory> +</VirtualHost> + +# Proxy #2: authenticated +Listen 127.0.0.1:47527 +<VirtualHost 127.0.0.1:47527> + ProxyRequests On + AllowCONNECT 47525 + + # Deny proxying by default + <Proxy *> + Require all denied + </Proxy> + + # Allow local http connections with authentication + <Proxy http://127.0.0.1:47524*> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require valid-user + </Proxy> + + # Allow CONNECT to local https port with authentication + <Proxy 127.0.0.1:47525> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require valid-user + </Proxy> + + # Fail non-proxy requests + <Directory /> + Require all denied + </Directory> +</VirtualHost> + +# Proxy #3: unauthenticatable-to +Listen 127.0.0.1:47528 +<VirtualHost 127.0.0.1:47528> + ProxyRequests On + AllowCONNECT 47525 + + # Deny proxying by default + <Proxy *> + Require all denied + </Proxy> + + # Allow local http connections with authentication + <Proxy http://127.0.0.1:47524*> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require user no-such-user + </Proxy> + + # Allow CONNECT to local https port with authentication + <Proxy 127.0.0.1:47525> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require user no-such-user + </Proxy> + + # Fail non-proxy requests + <Directory /> + Require all denied + </Directory> +</VirtualHost> + + +# SSL setup +<IfModule mod_ssl.c> + Listen 127.0.0.1:47525 + + <VirtualHost 127.0.0.1:47525> + SSLEngine on + + SSLCertificateFile @srcdir@/test-cert.pem + SSLCertificateKeyFile @srcdir@/test-key.pem + + </VirtualHost> +</IfModule> + + +# Basic auth tests +Alias /Basic/realm1/realm2/realm1 @srcdir@ +Alias /Basic/realm1/realm2 @srcdir@ +Alias /Basic/realm1/subdir @srcdir@ +Alias /Basic/realm1/not @srcdir@ +Alias /Basic/realm1 @srcdir@ +Alias /Basic/realm12/subdir @srcdir@ +Alias /Basic/realm12 @srcdir@ +Alias /Basic/realm2 @srcdir@ +Alias /Basic/realm3 @srcdir@ +Alias /Basic @srcdir@ + +<Location /Basic/realm1> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require user user1 +</Location> + +<Location /Basic/realm1/not> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require user user2 +</Location> + +<Location /Basic/realm12> + AuthType Basic + AuthName realm12 + AuthUserFile @srcdir@/htpasswd + Require user user1 user2 +</Location> + +<Location /Basic/realm1/realm2> + AuthType Basic + AuthName realm2 + AuthUserFile @srcdir@/htpasswd + Require user user2 +</Location> + +<Location /Basic/realm1/realm2/realm1> + AuthType Basic + AuthName realm1 + AuthUserFile @srcdir@/htpasswd + Require user user1 +</Location> + +<Location /Basic/realm2> + AuthType Basic + AuthName realm2 + AuthUserFile @srcdir@/htpasswd + Require user user2 +</Location> + +<Location /Basic/realm3> + AuthType Basic + AuthName realm3 + AuthUserFile @srcdir@/htpasswd + Require user user3 +</Location> + +# Digest auth tests +Alias /Digest/realm1/realm2/realm1 @srcdir@ +Alias /Digest/realm1/realm2 @srcdir@ +Alias /Digest/realm1/subdir @srcdir@ +Alias /Digest/realm1/expire @srcdir@ +Alias /Digest/realm1/not @srcdir@ +Alias /Digest/realm1 @srcdir@ +Alias /Digest/realm2 @srcdir@ +Alias /Digest/realm3 @srcdir@ +Alias /Digest @srcdir@ + +<Location /Digest/realm1> + AuthType Digest + AuthName realm1 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm1 /Digest/realm1/realm2/realm1 + Require valid-user +</Location> + +<Location /Digest/realm1/expire> + AuthType Digest + AuthName realm1 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm1 /Digest/realm1/realm2/realm1 + AuthDigestNonceLifetime 2 + Require valid-user +</Location> + +<Location /Digest/realm1/not> + AuthType Digest + AuthName realm1 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm1 /Digest/realm1/realm2/realm1 + Require user user2 +</Location> + +<Location /Digest/realm1/realm2> + AuthType Digest + AuthName realm2 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm2 /Digest/realm1/realm2 + Require valid-user +</Location> + +<Location /Digest/realm1/realm2/realm1> + AuthType Digest + AuthName realm1 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm1 /Digest/realm1/realm2/realm1 + Require valid-user +</Location> + +<Location /Digest/realm2> + AuthType Digest + AuthName realm2 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm2 /Digest/realm1/realm2 + Require valid-user +</Location> + +<Location /Digest/realm3> + AuthType Digest + AuthName realm3 + AuthUserFile @srcdir@/htdigest + AuthDigestDomain /Digest/realm3 + Require valid-user + # test RFC2069-style Digest + AuthDigestQop none +</Location> diff --git a/tests/range-test.c b/tests/range-test.c index 98f56450..09e95f12 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); |