diff options
Diffstat (limited to 'tests')
31 files changed, 3013 insertions, 2266 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 81a72cbc..00000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,110 +0,0 @@ -include $(top_srcdir)/glib-tap.mk - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(GLIB_CFLAGS) - -LIBS = \ - $(top_builddir)/libsoup/libsoup-2.4.la \ - $(GLIB_LIBS) - -test_programs = \ - auth-test \ - cache-test \ - chunk-test \ - chunk-io-test \ - coding-test \ - connection-test \ - context-test \ - continue-test \ - cookies-test \ - date \ - forms-test \ - header-parsing \ - misc-test \ - multipart-test \ - no-ssl-test \ - ntlm-test \ - proxy-test \ - pull-api \ - range-test \ - redirect-test \ - requester-test \ - resource-test \ - session-test \ - server-auth-test \ - server-test \ - sniffing-test \ - socket-test \ - ssl-test \ - streaming-test \ - timeout-test \ - tld-test \ - uri-parsing \ - websocket-test \ - xmlrpc-old-server-test \ - xmlrpc-old-test \ - xmlrpc-server-test \ - xmlrpc-test - -test_extra_programs = \ - ntlm-test-helper \ - $(TESTS) - -test_data = \ - index.txt \ - soup-tests.gresource \ - test-cert.pem \ - test-key.pem \ - xmlrpc-server.php - -noinst_LTLIBRARIES += libtest.la - -libtest_la_SOURCES = \ - test-utils.c \ - test-utils.h - -LDADD = libtest.la - -if HAVE_APACHE -test_data += \ - htdigest \ - htpasswd \ - httpd.conf -endif - -RESOURCES = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/soup-tests.gresource.xml) - -soup-tests.gresource: soup-tests.gresource.xml $(RESOURCES) - $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $< - -EXTRA_DIST += \ - htdigest \ - htpasswd \ - httpd.conf.in \ - index.txt \ - libsoup.supp \ - soup-tests.gresource.xml \ - test-cert.pem \ - test-key.pem \ - xmlrpc-server.php \ - $(RESOURCES) - -DISTCLEANFILES += soup-tests.gresource httpd.conf - -TESTS_ENVIRONMENT += SOUP_TESTS_IN_MAKE_CHECK=1 - -check: start-httpd - -check-local: check-TESTS - @$(MAKE) kill-httpd - -.PHONY: start-httpd kill-httpd - -start-httpd: - @$(APACHE_HTTPD) -d $(abs_srcdir) -c "DefaultRuntimeDir `pwd`" -c "PidFile `pwd`/httpd.pid" -f `pwd`/httpd.conf -k start; - -kill-httpd: - @if [ -f httpd.pid ]; then \ - $(APACHE_HTTPD) -d $(abs_srcdir) -c "DefaultRuntimeDir `pwd`" -c "PidFile `pwd`/httpd.pid" -f `pwd`/httpd.conf -k stop; \ - fi diff --git a/tests/Makefile.in b/tests/Makefile.in deleted file mode 100644 index 91f53720..00000000 --- a/tests/Makefile.in +++ /dev/null @@ -1,2087 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# GLIB - Library of useful C routines - - - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -TESTS = $(am__EXEEXT_1) -installed_test_PROGRAMS = $(am__EXEEXT_6) -noinst_PROGRAMS = $(am__EXEEXT_7) -check_PROGRAMS = $(am__EXEEXT_5) -@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_1 = $(all_test_ltlibs) -@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_2 = $(all_test_programs) -@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_3 = $(all_test_scripts) -@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_4 = $(all_test_data) -@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_5 = $(all_test_ltlibs) -@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_6 = $(all_test_programs) -@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_7 = $(all_test_scripts) -@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__append_8 = $(all_test_data) -@ENABLE_INSTALLED_TESTS_TRUE@am__append_9 = $(test_programs) $(installed_test_programs) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(test_extra_programs) $(installed_test_extra_programs) - -@ENABLE_INSTALLED_TESTS_TRUE@am__append_10 = $(test_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(installed_test_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(test_extra_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(test_installed_extra_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_test_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_test_extra_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_installed_test_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_installed_test_extra_scripts) -@ENABLE_INSTALLED_TESTS_TRUE@am__append_11 = $(test_data) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(installed_test_data) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_test_data) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_installed_test_data) -@ENABLE_INSTALLED_TESTS_TRUE@am__append_12 = $(test_ltlibraries) $(installed_test_ltlibraries) -@ENABLE_INSTALLED_TESTS_TRUE@am__append_13 = $(installed_test_meta_DATA) -@HAVE_APACHE_TRUE@am__append_14 = \ -@HAVE_APACHE_TRUE@ htdigest \ -@HAVE_APACHE_TRUE@ htpasswd \ -@HAVE_APACHE_TRUE@ httpd.conf - -subdir = tests -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ - $(top_srcdir)/m4/glibtests.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/vapigen.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = httpd.conf -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(installed_testdir)" \ - "$(DESTDIR)$(installed_testdir)" \ - "$(DESTDIR)$(installed_testdir)" \ - "$(DESTDIR)$(installed_test_metadir)" \ - "$(DESTDIR)$(installed_testdir)" -LTLIBRARIES = $(installed_test_LTLIBRARIES) $(noinst_LTLIBRARIES) -libtest_la_LIBADD = -am_libtest_la_OBJECTS = test-utils.lo -libtest_la_OBJECTS = $(am_libtest_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -am__EXEEXT_1 = auth-test$(EXEEXT) cache-test$(EXEEXT) \ - chunk-test$(EXEEXT) chunk-io-test$(EXEEXT) \ - coding-test$(EXEEXT) connection-test$(EXEEXT) \ - context-test$(EXEEXT) continue-test$(EXEEXT) \ - cookies-test$(EXEEXT) date$(EXEEXT) forms-test$(EXEEXT) \ - header-parsing$(EXEEXT) misc-test$(EXEEXT) \ - multipart-test$(EXEEXT) no-ssl-test$(EXEEXT) \ - ntlm-test$(EXEEXT) proxy-test$(EXEEXT) pull-api$(EXEEXT) \ - range-test$(EXEEXT) redirect-test$(EXEEXT) \ - requester-test$(EXEEXT) resource-test$(EXEEXT) \ - session-test$(EXEEXT) server-auth-test$(EXEEXT) \ - server-test$(EXEEXT) sniffing-test$(EXEEXT) \ - socket-test$(EXEEXT) ssl-test$(EXEEXT) streaming-test$(EXEEXT) \ - timeout-test$(EXEEXT) tld-test$(EXEEXT) uri-parsing$(EXEEXT) \ - websocket-test$(EXEEXT) xmlrpc-old-server-test$(EXEEXT) \ - xmlrpc-old-test$(EXEEXT) xmlrpc-server-test$(EXEEXT) \ - xmlrpc-test$(EXEEXT) -am__EXEEXT_2 = $(am__EXEEXT_1) -am__EXEEXT_3 = ntlm-test-helper$(EXEEXT) $(am__EXEEXT_2) -am__EXEEXT_4 = $(am__EXEEXT_1) $(am__EXEEXT_3) -@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__EXEEXT_5 = $(am__EXEEXT_4) -@ENABLE_INSTALLED_TESTS_TRUE@am__EXEEXT_6 = $(am__EXEEXT_1) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(am__EXEEXT_3) -@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__EXEEXT_7 = $(am__EXEEXT_4) -PROGRAMS = $(installed_test_PROGRAMS) $(noinst_PROGRAMS) -auth_test_SOURCES = auth-test.c -auth_test_OBJECTS = auth-test.$(OBJEXT) -auth_test_LDADD = $(LDADD) -auth_test_DEPENDENCIES = libtest.la -cache_test_SOURCES = cache-test.c -cache_test_OBJECTS = cache-test.$(OBJEXT) -cache_test_LDADD = $(LDADD) -cache_test_DEPENDENCIES = libtest.la -chunk_io_test_SOURCES = chunk-io-test.c -chunk_io_test_OBJECTS = chunk-io-test.$(OBJEXT) -chunk_io_test_LDADD = $(LDADD) -chunk_io_test_DEPENDENCIES = libtest.la -chunk_test_SOURCES = chunk-test.c -chunk_test_OBJECTS = chunk-test.$(OBJEXT) -chunk_test_LDADD = $(LDADD) -chunk_test_DEPENDENCIES = libtest.la -coding_test_SOURCES = coding-test.c -coding_test_OBJECTS = coding-test.$(OBJEXT) -coding_test_LDADD = $(LDADD) -coding_test_DEPENDENCIES = libtest.la -connection_test_SOURCES = connection-test.c -connection_test_OBJECTS = connection-test.$(OBJEXT) -connection_test_LDADD = $(LDADD) -connection_test_DEPENDENCIES = libtest.la -context_test_SOURCES = context-test.c -context_test_OBJECTS = context-test.$(OBJEXT) -context_test_LDADD = $(LDADD) -context_test_DEPENDENCIES = libtest.la -continue_test_SOURCES = continue-test.c -continue_test_OBJECTS = continue-test.$(OBJEXT) -continue_test_LDADD = $(LDADD) -continue_test_DEPENDENCIES = libtest.la -cookies_test_SOURCES = cookies-test.c -cookies_test_OBJECTS = cookies-test.$(OBJEXT) -cookies_test_LDADD = $(LDADD) -cookies_test_DEPENDENCIES = libtest.la -date_SOURCES = date.c -date_OBJECTS = date.$(OBJEXT) -date_LDADD = $(LDADD) -date_DEPENDENCIES = libtest.la -forms_test_SOURCES = forms-test.c -forms_test_OBJECTS = forms-test.$(OBJEXT) -forms_test_LDADD = $(LDADD) -forms_test_DEPENDENCIES = libtest.la -header_parsing_SOURCES = header-parsing.c -header_parsing_OBJECTS = header-parsing.$(OBJEXT) -header_parsing_LDADD = $(LDADD) -header_parsing_DEPENDENCIES = libtest.la -misc_test_SOURCES = misc-test.c -misc_test_OBJECTS = misc-test.$(OBJEXT) -misc_test_LDADD = $(LDADD) -misc_test_DEPENDENCIES = libtest.la -multipart_test_SOURCES = multipart-test.c -multipart_test_OBJECTS = multipart-test.$(OBJEXT) -multipart_test_LDADD = $(LDADD) -multipart_test_DEPENDENCIES = libtest.la -no_ssl_test_SOURCES = no-ssl-test.c -no_ssl_test_OBJECTS = no-ssl-test.$(OBJEXT) -no_ssl_test_LDADD = $(LDADD) -no_ssl_test_DEPENDENCIES = libtest.la -ntlm_test_SOURCES = ntlm-test.c -ntlm_test_OBJECTS = ntlm-test.$(OBJEXT) -ntlm_test_LDADD = $(LDADD) -ntlm_test_DEPENDENCIES = libtest.la -ntlm_test_helper_SOURCES = ntlm-test-helper.c -ntlm_test_helper_OBJECTS = ntlm-test-helper.$(OBJEXT) -ntlm_test_helper_LDADD = $(LDADD) -ntlm_test_helper_DEPENDENCIES = libtest.la -proxy_test_SOURCES = proxy-test.c -proxy_test_OBJECTS = proxy-test.$(OBJEXT) -proxy_test_LDADD = $(LDADD) -proxy_test_DEPENDENCIES = libtest.la -pull_api_SOURCES = pull-api.c -pull_api_OBJECTS = pull-api.$(OBJEXT) -pull_api_LDADD = $(LDADD) -pull_api_DEPENDENCIES = libtest.la -range_test_SOURCES = range-test.c -range_test_OBJECTS = range-test.$(OBJEXT) -range_test_LDADD = $(LDADD) -range_test_DEPENDENCIES = libtest.la -redirect_test_SOURCES = redirect-test.c -redirect_test_OBJECTS = redirect-test.$(OBJEXT) -redirect_test_LDADD = $(LDADD) -redirect_test_DEPENDENCIES = libtest.la -requester_test_SOURCES = requester-test.c -requester_test_OBJECTS = requester-test.$(OBJEXT) -requester_test_LDADD = $(LDADD) -requester_test_DEPENDENCIES = libtest.la -resource_test_SOURCES = resource-test.c -resource_test_OBJECTS = resource-test.$(OBJEXT) -resource_test_LDADD = $(LDADD) -resource_test_DEPENDENCIES = libtest.la -server_auth_test_SOURCES = server-auth-test.c -server_auth_test_OBJECTS = server-auth-test.$(OBJEXT) -server_auth_test_LDADD = $(LDADD) -server_auth_test_DEPENDENCIES = libtest.la -server_test_SOURCES = server-test.c -server_test_OBJECTS = server-test.$(OBJEXT) -server_test_LDADD = $(LDADD) -server_test_DEPENDENCIES = libtest.la -session_test_SOURCES = session-test.c -session_test_OBJECTS = session-test.$(OBJEXT) -session_test_LDADD = $(LDADD) -session_test_DEPENDENCIES = libtest.la -sniffing_test_SOURCES = sniffing-test.c -sniffing_test_OBJECTS = sniffing-test.$(OBJEXT) -sniffing_test_LDADD = $(LDADD) -sniffing_test_DEPENDENCIES = libtest.la -socket_test_SOURCES = socket-test.c -socket_test_OBJECTS = socket-test.$(OBJEXT) -socket_test_LDADD = $(LDADD) -socket_test_DEPENDENCIES = libtest.la -ssl_test_SOURCES = ssl-test.c -ssl_test_OBJECTS = ssl-test.$(OBJEXT) -ssl_test_LDADD = $(LDADD) -ssl_test_DEPENDENCIES = libtest.la -streaming_test_SOURCES = streaming-test.c -streaming_test_OBJECTS = streaming-test.$(OBJEXT) -streaming_test_LDADD = $(LDADD) -streaming_test_DEPENDENCIES = libtest.la -timeout_test_SOURCES = timeout-test.c -timeout_test_OBJECTS = timeout-test.$(OBJEXT) -timeout_test_LDADD = $(LDADD) -timeout_test_DEPENDENCIES = libtest.la -tld_test_SOURCES = tld-test.c -tld_test_OBJECTS = tld-test.$(OBJEXT) -tld_test_LDADD = $(LDADD) -tld_test_DEPENDENCIES = libtest.la -uri_parsing_SOURCES = uri-parsing.c -uri_parsing_OBJECTS = uri-parsing.$(OBJEXT) -uri_parsing_LDADD = $(LDADD) -uri_parsing_DEPENDENCIES = libtest.la -websocket_test_SOURCES = websocket-test.c -websocket_test_OBJECTS = websocket-test.$(OBJEXT) -websocket_test_LDADD = $(LDADD) -websocket_test_DEPENDENCIES = libtest.la -xmlrpc_old_server_test_SOURCES = xmlrpc-old-server-test.c -xmlrpc_old_server_test_OBJECTS = xmlrpc-old-server-test.$(OBJEXT) -xmlrpc_old_server_test_LDADD = $(LDADD) -xmlrpc_old_server_test_DEPENDENCIES = libtest.la -xmlrpc_old_test_SOURCES = xmlrpc-old-test.c -xmlrpc_old_test_OBJECTS = xmlrpc-old-test.$(OBJEXT) -xmlrpc_old_test_LDADD = $(LDADD) -xmlrpc_old_test_DEPENDENCIES = libtest.la -xmlrpc_server_test_SOURCES = xmlrpc-server-test.c -xmlrpc_server_test_OBJECTS = xmlrpc-server-test.$(OBJEXT) -xmlrpc_server_test_LDADD = $(LDADD) -xmlrpc_server_test_DEPENDENCIES = libtest.la -xmlrpc_test_SOURCES = xmlrpc-test.c -xmlrpc_test_OBJECTS = xmlrpc-test.$(OBJEXT) -xmlrpc_test_LDADD = $(LDADD) -xmlrpc_test_DEPENDENCIES = libtest.la -SCRIPTS = $(installed_test_SCRIPTS) $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libtest_la_SOURCES) auth-test.c cache-test.c \ - chunk-io-test.c chunk-test.c coding-test.c connection-test.c \ - context-test.c continue-test.c cookies-test.c date.c \ - forms-test.c header-parsing.c misc-test.c multipart-test.c \ - no-ssl-test.c ntlm-test.c ntlm-test-helper.c proxy-test.c \ - pull-api.c range-test.c redirect-test.c requester-test.c \ - resource-test.c server-auth-test.c server-test.c \ - session-test.c sniffing-test.c socket-test.c ssl-test.c \ - streaming-test.c timeout-test.c tld-test.c uri-parsing.c \ - websocket-test.c xmlrpc-old-server-test.c xmlrpc-old-test.c \ - xmlrpc-server-test.c xmlrpc-test.c -DIST_SOURCES = $(libtest_la_SOURCES) auth-test.c cache-test.c \ - chunk-io-test.c chunk-test.c coding-test.c connection-test.c \ - context-test.c continue-test.c cookies-test.c date.c \ - forms-test.c header-parsing.c misc-test.c multipart-test.c \ - no-ssl-test.c ntlm-test.c ntlm-test-helper.c proxy-test.c \ - pull-api.c range-test.c redirect-test.c requester-test.c \ - resource-test.c server-auth-test.c server-test.c \ - session-test.c sniffing-test.c socket-test.c ssl-test.c \ - streaming-test.c timeout-test.c tld-test.c uri-parsing.c \ - websocket-test.c xmlrpc-old-server-test.c xmlrpc-old-test.c \ - xmlrpc-server-test.c xmlrpc-test.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(installed_test_meta_DATA) $(nobase_installed_test_DATA) \ - $(noinst_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red='[0;31m'; \ - grn='[0;32m'; \ - lgn='[1;32m'; \ - blu='[1;34m'; \ - mgn='[0;35m'; \ - brg='[1m'; \ - std='[m'; \ - fi; \ -} -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/httpd.conf.in \ - $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/build-aux/test-driver $(top_srcdir)/glib-tap.mk -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -APACHE_HTTPD = @APACHE_HTTPD@ -APACHE_MODULE_DIR = @APACHE_MODULE_DIR@ -APACHE_PHP_MODULE_DIR = @APACHE_PHP_MODULE_DIR@ -APACHE_SSL_MODULE_DIR = @APACHE_SSL_MODULE_DIR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CURL = @CURL@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -HAVE_GNOME = @HAVE_GNOME@ -HTML_DIR = @HTML_DIR@ -IF_HAVE_MOD_UNIXD = @IF_HAVE_MOD_UNIXD@ -IF_HAVE_PHP = @IF_HAVE_PHP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -KRB5_CFLAGS = @KRB5_CFLAGS@ -KRB5_CONFIG = @KRB5_CONFIG@ -KRB5_LIBS = @KRB5_LIBS@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = \ - $(top_builddir)/libsoup/libsoup-2.4.la \ - $(GLIB_LIBS) - -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PHP = @PHP@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SOUP_AGE = @SOUP_AGE@ -SOUP_API_VERSION = @SOUP_API_VERSION@ -SOUP_CURRENT = @SOUP_CURRENT@ -SOUP_DEBUG_FLAGS = @SOUP_DEBUG_FLAGS@ -SOUP_HIDDEN_VISIBILITY_CFLAGS = @SOUP_HIDDEN_VISIBILITY_CFLAGS@ -SOUP_MAJOR_VERSION = @SOUP_MAJOR_VERSION@ -SOUP_MICRO_VERSION = @SOUP_MICRO_VERSION@ -SOUP_MINOR_VERSION = @SOUP_MINOR_VERSION@ -SOUP_REVISION = @SOUP_REVISION@ -SQLITE_CFLAGS = @SQLITE_CFLAGS@ -SQLITE_LIBS = @SQLITE_LIBS@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VALAC = @VALAC@ -VAPIDIR = @VAPIDIR@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XML_CFLAGS = @XML_CFLAGS@ -XML_LIBS = @XML_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -installed_test_metadir = @installed_test_metadir@ -installed_testdir = @installed_testdir@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -ntlm_auth = @ntlm_auth@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -TESTS_ENVIRONMENT = G_TEST_SRCDIR="$(abs_srcdir)" \ - G_TEST_BUILDDIR="$(abs_builddir)" G_DEBUG=gc-friendly \ - MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \ - SOUP_TESTS_IN_MAKE_CHECK=1 -LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh -LOG_COMPILER = $(top_srcdir)/tap-test -NULL = - -# initialize variables for unconditional += appending -BUILT_SOURCES = -BUILT_EXTRA_DIST = -CLEANFILES = *.log *.trs $(am__append_13) -DISTCLEANFILES = soup-tests.gresource httpd.conf -MAINTAINERCLEANFILES = -EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) htdigest \ - htpasswd httpd.conf.in index.txt libsoup.supp \ - soup-tests.gresource.xml test-cert.pem test-key.pem \ - xmlrpc-server.php $(RESOURCES) -installed_test_LTLIBRARIES = $(am__append_12) -installed_test_SCRIPTS = $(am__append_10) -nobase_installed_test_DATA = $(am__append_11) -noinst_LTLIBRARIES = $(am__append_1) libtest.la -noinst_SCRIPTS = $(am__append_3) -noinst_DATA = $(am__append_4) -check_LTLIBRARIES = $(am__append_5) -check_SCRIPTS = $(am__append_7) -check_DATA = $(am__append_8) - -# Note: build even the installed-only targets during 'make check' to ensure that they still work. -# We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to -# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were -# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'. -all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \ - $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs) - -all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) \ - $(installed_test_scripts) $(test_extra_scripts) \ - $(uninstalled_test_extra_scripts) \ - $(installed_test_extra_scripts) $(all_dist_test_scripts) -all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \ - $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts) - -all_test_data = $(test_data) $(uninstalled_test_data) \ - $(installed_test_data) $(all_dist_test_data) -all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data) -all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries) -@ENABLE_INSTALLED_TESTS_TRUE@installed_testcases = $(test_programs) $(installed_test_programs) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(test_scripts) $(installed_test_scripts) \ -@ENABLE_INSTALLED_TESTS_TRUE@ $(dist_test_scripts) $(dist_installed_test_scripts) - -@ENABLE_INSTALLED_TESTS_TRUE@installed_test_meta_DATA = $(installed_testcases:=.test) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(GLIB_CFLAGS) - -test_programs = \ - auth-test \ - cache-test \ - chunk-test \ - chunk-io-test \ - coding-test \ - connection-test \ - context-test \ - continue-test \ - cookies-test \ - date \ - forms-test \ - header-parsing \ - misc-test \ - multipart-test \ - no-ssl-test \ - ntlm-test \ - proxy-test \ - pull-api \ - range-test \ - redirect-test \ - requester-test \ - resource-test \ - session-test \ - server-auth-test \ - server-test \ - sniffing-test \ - socket-test \ - ssl-test \ - streaming-test \ - timeout-test \ - tld-test \ - uri-parsing \ - websocket-test \ - xmlrpc-old-server-test \ - xmlrpc-old-test \ - xmlrpc-server-test \ - xmlrpc-test - -test_extra_programs = \ - ntlm-test-helper \ - $(TESTS) - -test_data = index.txt soup-tests.gresource test-cert.pem test-key.pem \ - xmlrpc-server.php $(am__append_14) -libtest_la_SOURCES = \ - test-utils.c \ - test-utils.h - -LDADD = libtest.la -RESOURCES = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/soup-tests.gresource.xml) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/glib-tap.mk $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign tests/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(top_srcdir)/glib-tap.mk $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -httpd.conf: $(top_builddir)/config.status $(srcdir)/httpd.conf.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -clean-checkLTLIBRARIES: - -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) - @list='$(check_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-installed_testLTLIBRARIES: $(installed_test_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(installed_test_LTLIBRARIES)'; test -n "$(installed_testdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(installed_testdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(installed_testdir)"; \ - } - -uninstall-installed_testLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(installed_test_LTLIBRARIES)'; test -n "$(installed_testdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(installed_testdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(installed_testdir)/$$f"; \ - done - -clean-installed_testLTLIBRARIES: - -test -z "$(installed_test_LTLIBRARIES)" || rm -f $(installed_test_LTLIBRARIES) - @list='$(installed_test_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libtest.la: $(libtest_la_OBJECTS) $(libtest_la_DEPENDENCIES) $(EXTRA_libtest_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libtest_la_OBJECTS) $(libtest_la_LIBADD) $(LIBS) - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -install-installed_testPROGRAMS: $(installed_test_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(installed_test_PROGRAMS)'; test -n "$(installed_testdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-installed_testPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(installed_test_PROGRAMS)'; test -n "$(installed_testdir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(installed_testdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(installed_testdir)" && rm -f $$files - -clean-installed_testPROGRAMS: - @list='$(installed_test_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -auth-test$(EXEEXT): $(auth_test_OBJECTS) $(auth_test_DEPENDENCIES) $(EXTRA_auth_test_DEPENDENCIES) - @rm -f auth-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(auth_test_OBJECTS) $(auth_test_LDADD) $(LIBS) - -cache-test$(EXEEXT): $(cache_test_OBJECTS) $(cache_test_DEPENDENCIES) $(EXTRA_cache_test_DEPENDENCIES) - @rm -f cache-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(cache_test_OBJECTS) $(cache_test_LDADD) $(LIBS) - -chunk-io-test$(EXEEXT): $(chunk_io_test_OBJECTS) $(chunk_io_test_DEPENDENCIES) $(EXTRA_chunk_io_test_DEPENDENCIES) - @rm -f chunk-io-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(chunk_io_test_OBJECTS) $(chunk_io_test_LDADD) $(LIBS) - -chunk-test$(EXEEXT): $(chunk_test_OBJECTS) $(chunk_test_DEPENDENCIES) $(EXTRA_chunk_test_DEPENDENCIES) - @rm -f chunk-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(chunk_test_OBJECTS) $(chunk_test_LDADD) $(LIBS) - -coding-test$(EXEEXT): $(coding_test_OBJECTS) $(coding_test_DEPENDENCIES) $(EXTRA_coding_test_DEPENDENCIES) - @rm -f coding-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(coding_test_OBJECTS) $(coding_test_LDADD) $(LIBS) - -connection-test$(EXEEXT): $(connection_test_OBJECTS) $(connection_test_DEPENDENCIES) $(EXTRA_connection_test_DEPENDENCIES) - @rm -f connection-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(connection_test_OBJECTS) $(connection_test_LDADD) $(LIBS) - -context-test$(EXEEXT): $(context_test_OBJECTS) $(context_test_DEPENDENCIES) $(EXTRA_context_test_DEPENDENCIES) - @rm -f context-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(context_test_OBJECTS) $(context_test_LDADD) $(LIBS) - -continue-test$(EXEEXT): $(continue_test_OBJECTS) $(continue_test_DEPENDENCIES) $(EXTRA_continue_test_DEPENDENCIES) - @rm -f continue-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(continue_test_OBJECTS) $(continue_test_LDADD) $(LIBS) - -cookies-test$(EXEEXT): $(cookies_test_OBJECTS) $(cookies_test_DEPENDENCIES) $(EXTRA_cookies_test_DEPENDENCIES) - @rm -f cookies-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(cookies_test_OBJECTS) $(cookies_test_LDADD) $(LIBS) - -date$(EXEEXT): $(date_OBJECTS) $(date_DEPENDENCIES) $(EXTRA_date_DEPENDENCIES) - @rm -f date$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(date_OBJECTS) $(date_LDADD) $(LIBS) - -forms-test$(EXEEXT): $(forms_test_OBJECTS) $(forms_test_DEPENDENCIES) $(EXTRA_forms_test_DEPENDENCIES) - @rm -f forms-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(forms_test_OBJECTS) $(forms_test_LDADD) $(LIBS) - -header-parsing$(EXEEXT): $(header_parsing_OBJECTS) $(header_parsing_DEPENDENCIES) $(EXTRA_header_parsing_DEPENDENCIES) - @rm -f header-parsing$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(header_parsing_OBJECTS) $(header_parsing_LDADD) $(LIBS) - -misc-test$(EXEEXT): $(misc_test_OBJECTS) $(misc_test_DEPENDENCIES) $(EXTRA_misc_test_DEPENDENCIES) - @rm -f misc-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(misc_test_OBJECTS) $(misc_test_LDADD) $(LIBS) - -multipart-test$(EXEEXT): $(multipart_test_OBJECTS) $(multipart_test_DEPENDENCIES) $(EXTRA_multipart_test_DEPENDENCIES) - @rm -f multipart-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(multipart_test_OBJECTS) $(multipart_test_LDADD) $(LIBS) - -no-ssl-test$(EXEEXT): $(no_ssl_test_OBJECTS) $(no_ssl_test_DEPENDENCIES) $(EXTRA_no_ssl_test_DEPENDENCIES) - @rm -f no-ssl-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(no_ssl_test_OBJECTS) $(no_ssl_test_LDADD) $(LIBS) - -ntlm-test$(EXEEXT): $(ntlm_test_OBJECTS) $(ntlm_test_DEPENDENCIES) $(EXTRA_ntlm_test_DEPENDENCIES) - @rm -f ntlm-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(ntlm_test_OBJECTS) $(ntlm_test_LDADD) $(LIBS) - -ntlm-test-helper$(EXEEXT): $(ntlm_test_helper_OBJECTS) $(ntlm_test_helper_DEPENDENCIES) $(EXTRA_ntlm_test_helper_DEPENDENCIES) - @rm -f ntlm-test-helper$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(ntlm_test_helper_OBJECTS) $(ntlm_test_helper_LDADD) $(LIBS) - -proxy-test$(EXEEXT): $(proxy_test_OBJECTS) $(proxy_test_DEPENDENCIES) $(EXTRA_proxy_test_DEPENDENCIES) - @rm -f proxy-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(proxy_test_OBJECTS) $(proxy_test_LDADD) $(LIBS) - -pull-api$(EXEEXT): $(pull_api_OBJECTS) $(pull_api_DEPENDENCIES) $(EXTRA_pull_api_DEPENDENCIES) - @rm -f pull-api$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(pull_api_OBJECTS) $(pull_api_LDADD) $(LIBS) - -range-test$(EXEEXT): $(range_test_OBJECTS) $(range_test_DEPENDENCIES) $(EXTRA_range_test_DEPENDENCIES) - @rm -f range-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(range_test_OBJECTS) $(range_test_LDADD) $(LIBS) - -redirect-test$(EXEEXT): $(redirect_test_OBJECTS) $(redirect_test_DEPENDENCIES) $(EXTRA_redirect_test_DEPENDENCIES) - @rm -f redirect-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(redirect_test_OBJECTS) $(redirect_test_LDADD) $(LIBS) - -requester-test$(EXEEXT): $(requester_test_OBJECTS) $(requester_test_DEPENDENCIES) $(EXTRA_requester_test_DEPENDENCIES) - @rm -f requester-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(requester_test_OBJECTS) $(requester_test_LDADD) $(LIBS) - -resource-test$(EXEEXT): $(resource_test_OBJECTS) $(resource_test_DEPENDENCIES) $(EXTRA_resource_test_DEPENDENCIES) - @rm -f resource-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(resource_test_OBJECTS) $(resource_test_LDADD) $(LIBS) - -server-auth-test$(EXEEXT): $(server_auth_test_OBJECTS) $(server_auth_test_DEPENDENCIES) $(EXTRA_server_auth_test_DEPENDENCIES) - @rm -f server-auth-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(server_auth_test_OBJECTS) $(server_auth_test_LDADD) $(LIBS) - -server-test$(EXEEXT): $(server_test_OBJECTS) $(server_test_DEPENDENCIES) $(EXTRA_server_test_DEPENDENCIES) - @rm -f server-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(server_test_OBJECTS) $(server_test_LDADD) $(LIBS) - -session-test$(EXEEXT): $(session_test_OBJECTS) $(session_test_DEPENDENCIES) $(EXTRA_session_test_DEPENDENCIES) - @rm -f session-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(session_test_OBJECTS) $(session_test_LDADD) $(LIBS) - -sniffing-test$(EXEEXT): $(sniffing_test_OBJECTS) $(sniffing_test_DEPENDENCIES) $(EXTRA_sniffing_test_DEPENDENCIES) - @rm -f sniffing-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sniffing_test_OBJECTS) $(sniffing_test_LDADD) $(LIBS) - -socket-test$(EXEEXT): $(socket_test_OBJECTS) $(socket_test_DEPENDENCIES) $(EXTRA_socket_test_DEPENDENCIES) - @rm -f socket-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(socket_test_OBJECTS) $(socket_test_LDADD) $(LIBS) - -ssl-test$(EXEEXT): $(ssl_test_OBJECTS) $(ssl_test_DEPENDENCIES) $(EXTRA_ssl_test_DEPENDENCIES) - @rm -f ssl-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(ssl_test_OBJECTS) $(ssl_test_LDADD) $(LIBS) - -streaming-test$(EXEEXT): $(streaming_test_OBJECTS) $(streaming_test_DEPENDENCIES) $(EXTRA_streaming_test_DEPENDENCIES) - @rm -f streaming-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(streaming_test_OBJECTS) $(streaming_test_LDADD) $(LIBS) - -timeout-test$(EXEEXT): $(timeout_test_OBJECTS) $(timeout_test_DEPENDENCIES) $(EXTRA_timeout_test_DEPENDENCIES) - @rm -f timeout-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(timeout_test_OBJECTS) $(timeout_test_LDADD) $(LIBS) - -tld-test$(EXEEXT): $(tld_test_OBJECTS) $(tld_test_DEPENDENCIES) $(EXTRA_tld_test_DEPENDENCIES) - @rm -f tld-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tld_test_OBJECTS) $(tld_test_LDADD) $(LIBS) - -uri-parsing$(EXEEXT): $(uri_parsing_OBJECTS) $(uri_parsing_DEPENDENCIES) $(EXTRA_uri_parsing_DEPENDENCIES) - @rm -f uri-parsing$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(uri_parsing_OBJECTS) $(uri_parsing_LDADD) $(LIBS) - -websocket-test$(EXEEXT): $(websocket_test_OBJECTS) $(websocket_test_DEPENDENCIES) $(EXTRA_websocket_test_DEPENDENCIES) - @rm -f websocket-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(websocket_test_OBJECTS) $(websocket_test_LDADD) $(LIBS) - -xmlrpc-old-server-test$(EXEEXT): $(xmlrpc_old_server_test_OBJECTS) $(xmlrpc_old_server_test_DEPENDENCIES) $(EXTRA_xmlrpc_old_server_test_DEPENDENCIES) - @rm -f xmlrpc-old-server-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(xmlrpc_old_server_test_OBJECTS) $(xmlrpc_old_server_test_LDADD) $(LIBS) - -xmlrpc-old-test$(EXEEXT): $(xmlrpc_old_test_OBJECTS) $(xmlrpc_old_test_DEPENDENCIES) $(EXTRA_xmlrpc_old_test_DEPENDENCIES) - @rm -f xmlrpc-old-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(xmlrpc_old_test_OBJECTS) $(xmlrpc_old_test_LDADD) $(LIBS) - -xmlrpc-server-test$(EXEEXT): $(xmlrpc_server_test_OBJECTS) $(xmlrpc_server_test_DEPENDENCIES) $(EXTRA_xmlrpc_server_test_DEPENDENCIES) - @rm -f xmlrpc-server-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(xmlrpc_server_test_OBJECTS) $(xmlrpc_server_test_LDADD) $(LIBS) - -xmlrpc-test$(EXEEXT): $(xmlrpc_test_OBJECTS) $(xmlrpc_test_DEPENDENCIES) $(EXTRA_xmlrpc_test_DEPENDENCIES) - @rm -f xmlrpc-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(xmlrpc_test_OBJECTS) $(xmlrpc_test_LDADD) $(LIBS) -install-installed_testSCRIPTS: $(installed_test_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(installed_test_SCRIPTS)'; test -n "$(installed_testdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(installed_testdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(installed_testdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-installed_testSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(installed_test_SCRIPTS)'; test -n "$(installed_testdir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(installed_testdir)'; $(am__uninstall_files_from_dir) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk-io-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coding-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/continue-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cookies-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/date.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/forms-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header-parsing.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multipart-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no-ssl-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntlm-test-helper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntlm-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pull-api.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/range-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redirect-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/requester-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server-auth-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sniffing-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/streaming-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tld-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri-parsing.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/websocket-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-old-server-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-old-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-server-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-test.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-installed_test_metaDATA: $(installed_test_meta_DATA) - @$(NORMAL_INSTALL) - @list='$(installed_test_meta_DATA)'; test -n "$(installed_test_metadir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_test_metadir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_test_metadir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(installed_test_metadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(installed_test_metadir)" || exit $$?; \ - done - -uninstall-installed_test_metaDATA: - @$(NORMAL_UNINSTALL) - @list='$(installed_test_meta_DATA)'; test -n "$(installed_test_metadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(installed_test_metadir)'; $(am__uninstall_files_from_dir) -install-nobase_installed_testDATA: $(nobase_installed_test_DATA) - @$(NORMAL_INSTALL) - @list='$(nobase_installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_testdir)" || exit 1; \ - fi; \ - $(am__nobase_list) | while read dir files; do \ - xfiles=; for file in $$files; do \ - if test -f "$$file"; then xfiles="$$xfiles $$file"; \ - else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ - test -z "$$xfiles" || { \ - test "x$$dir" = x. || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(installed_testdir)/$$dir'"; \ - $(MKDIR_P) "$(DESTDIR)$(installed_testdir)/$$dir"; }; \ - echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(installed_testdir)/$$dir'"; \ - $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(installed_testdir)/$$dir" || exit $$?; }; \ - done - -uninstall-nobase_installed_testDATA: - @$(NORMAL_UNINSTALL) - @list='$(nobase_installed_test_DATA)'; test -n "$(installed_testdir)" || list=; \ - $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ - dir='$(DESTDIR)$(installed_testdir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) $(check_SCRIPTS) $(check_DATA) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -auth-test.log: auth-test$(EXEEXT) - @p='auth-test$(EXEEXT)'; \ - b='auth-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -cache-test.log: cache-test$(EXEEXT) - @p='cache-test$(EXEEXT)'; \ - b='cache-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -chunk-test.log: chunk-test$(EXEEXT) - @p='chunk-test$(EXEEXT)'; \ - b='chunk-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -chunk-io-test.log: chunk-io-test$(EXEEXT) - @p='chunk-io-test$(EXEEXT)'; \ - b='chunk-io-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -coding-test.log: coding-test$(EXEEXT) - @p='coding-test$(EXEEXT)'; \ - b='coding-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -connection-test.log: connection-test$(EXEEXT) - @p='connection-test$(EXEEXT)'; \ - b='connection-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -context-test.log: context-test$(EXEEXT) - @p='context-test$(EXEEXT)'; \ - b='context-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -continue-test.log: continue-test$(EXEEXT) - @p='continue-test$(EXEEXT)'; \ - b='continue-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -cookies-test.log: cookies-test$(EXEEXT) - @p='cookies-test$(EXEEXT)'; \ - b='cookies-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -date.log: date$(EXEEXT) - @p='date$(EXEEXT)'; \ - b='date'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -forms-test.log: forms-test$(EXEEXT) - @p='forms-test$(EXEEXT)'; \ - b='forms-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -header-parsing.log: header-parsing$(EXEEXT) - @p='header-parsing$(EXEEXT)'; \ - b='header-parsing'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -misc-test.log: misc-test$(EXEEXT) - @p='misc-test$(EXEEXT)'; \ - b='misc-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -multipart-test.log: multipart-test$(EXEEXT) - @p='multipart-test$(EXEEXT)'; \ - b='multipart-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -no-ssl-test.log: no-ssl-test$(EXEEXT) - @p='no-ssl-test$(EXEEXT)'; \ - b='no-ssl-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -ntlm-test.log: ntlm-test$(EXEEXT) - @p='ntlm-test$(EXEEXT)'; \ - b='ntlm-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -proxy-test.log: proxy-test$(EXEEXT) - @p='proxy-test$(EXEEXT)'; \ - b='proxy-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -pull-api.log: pull-api$(EXEEXT) - @p='pull-api$(EXEEXT)'; \ - b='pull-api'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -range-test.log: range-test$(EXEEXT) - @p='range-test$(EXEEXT)'; \ - b='range-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -redirect-test.log: redirect-test$(EXEEXT) - @p='redirect-test$(EXEEXT)'; \ - b='redirect-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -requester-test.log: requester-test$(EXEEXT) - @p='requester-test$(EXEEXT)'; \ - b='requester-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -resource-test.log: resource-test$(EXEEXT) - @p='resource-test$(EXEEXT)'; \ - b='resource-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -session-test.log: session-test$(EXEEXT) - @p='session-test$(EXEEXT)'; \ - b='session-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -server-auth-test.log: server-auth-test$(EXEEXT) - @p='server-auth-test$(EXEEXT)'; \ - b='server-auth-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -server-test.log: server-test$(EXEEXT) - @p='server-test$(EXEEXT)'; \ - b='server-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -sniffing-test.log: sniffing-test$(EXEEXT) - @p='sniffing-test$(EXEEXT)'; \ - b='sniffing-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -socket-test.log: socket-test$(EXEEXT) - @p='socket-test$(EXEEXT)'; \ - b='socket-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -ssl-test.log: ssl-test$(EXEEXT) - @p='ssl-test$(EXEEXT)'; \ - b='ssl-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -streaming-test.log: streaming-test$(EXEEXT) - @p='streaming-test$(EXEEXT)'; \ - b='streaming-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -timeout-test.log: timeout-test$(EXEEXT) - @p='timeout-test$(EXEEXT)'; \ - b='timeout-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -tld-test.log: tld-test$(EXEEXT) - @p='tld-test$(EXEEXT)'; \ - b='tld-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -uri-parsing.log: uri-parsing$(EXEEXT) - @p='uri-parsing$(EXEEXT)'; \ - b='uri-parsing'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -websocket-test.log: websocket-test$(EXEEXT) - @p='websocket-test$(EXEEXT)'; \ - b='websocket-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -xmlrpc-old-server-test.log: xmlrpc-old-server-test$(EXEEXT) - @p='xmlrpc-old-server-test$(EXEEXT)'; \ - b='xmlrpc-old-server-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -xmlrpc-old-test.log: xmlrpc-old-test$(EXEEXT) - @p='xmlrpc-old-test$(EXEEXT)'; \ - b='xmlrpc-old-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -xmlrpc-server-test.log: xmlrpc-server-test$(EXEEXT) - @p='xmlrpc-server-test$(EXEEXT)'; \ - b='xmlrpc-server-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -xmlrpc-test.log: xmlrpc-test$(EXEEXT) - @p='xmlrpc-test$(EXEEXT)'; \ - b='xmlrpc-test'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) \ - $(check_SCRIPTS) $(check_DATA) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) -installdirs: - for dir in "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_testdir)" "$(DESTDIR)$(installed_test_metadir)" "$(DESTDIR)$(installed_testdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \ - clean-installed_testLTLIBRARIES clean-installed_testPROGRAMS \ - clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-installed_testLTLIBRARIES \ - install-installed_testPROGRAMS install-installed_testSCRIPTS \ - install-installed_test_metaDATA \ - install-nobase_installed_testDATA - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-installed_testLTLIBRARIES \ - uninstall-installed_testPROGRAMS \ - uninstall-installed_testSCRIPTS \ - uninstall-installed_test_metaDATA \ - uninstall-nobase_installed_testDATA - -.MAKE: all check check-am install install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am \ - check-local clean clean-checkLTLIBRARIES clean-checkPROGRAMS \ - clean-generic clean-installed_testLTLIBRARIES \ - clean-installed_testPROGRAMS clean-libtool \ - clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-installed_testLTLIBRARIES \ - install-installed_testPROGRAMS install-installed_testSCRIPTS \ - install-installed_test_metaDATA install-man \ - install-nobase_installed_testDATA install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - recheck tags tags-am uninstall uninstall-am \ - uninstall-installed_testLTLIBRARIES \ - uninstall-installed_testPROGRAMS \ - uninstall-installed_testSCRIPTS \ - uninstall-installed_test_metaDATA \ - uninstall-nobase_installed_testDATA - -.PRECIOUS: Makefile - - -@ENABLE_INSTALLED_TESTS_TRUE@%.test: %$(EXEEXT) Makefile -@ENABLE_INSTALLED_TESTS_TRUE@ $(AM_V_GEN) (echo '[Test]' > $@.tmp; \ -@ENABLE_INSTALLED_TESTS_TRUE@ echo 'Type=session' >> $@.tmp; \ -@ENABLE_INSTALLED_TESTS_TRUE@ echo 'Exec=$(installed_testdir)/$<' >> $@.tmp; \ -@ENABLE_INSTALLED_TESTS_TRUE@ mv $@.tmp $@) - -soup-tests.gresource: soup-tests.gresource.xml $(RESOURCES) - $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $< - -check: start-httpd - -check-local: check-TESTS - @$(MAKE) kill-httpd - -.PHONY: start-httpd kill-httpd - -start-httpd: - @$(APACHE_HTTPD) -d $(abs_srcdir) -c "DefaultRuntimeDir `pwd`" -c "PidFile `pwd`/httpd.pid" -f `pwd`/httpd.conf -k start; - -kill-httpd: - @if [ -f httpd.pid ]; then \ - $(APACHE_HTTPD) -d $(abs_srcdir) -c "DefaultRuntimeDir `pwd`" -c "PidFile `pwd`/httpd.pid" -f `pwd`/httpd.conf -k stop; \ - fi - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tests/auth-test.c b/tests/auth-test.c index 1144decf..95de60c2 100644 --- a/tests/auth-test.c +++ b/tests/auth-test.c @@ -464,12 +464,12 @@ do_digest_expiration_test (void) uri = g_strconcat (base_uri, "Digest/realm1/", NULL); do_digest_nonce_test (session, "First", uri, TRUE, TRUE, TRUE); g_free (uri); - sleep (2); + g_usleep (2 * G_USEC_PER_SEC); uri = g_strconcat (base_uri, "Digest/realm1/expire/", NULL); do_digest_nonce_test (session, "Second", uri, TRUE, TRUE, FALSE); - sleep (1); + g_usleep (1 * G_USEC_PER_SEC); do_digest_nonce_test (session, "Third", uri, TRUE, FALSE, FALSE); - sleep (1); + g_usleep (1 * G_USEC_PER_SEC); do_digest_nonce_test (session, "Fourth", uri, TRUE, FALSE, FALSE); g_free (uri); diff --git a/tests/brotli-data/compressed.br b/tests/brotli-data/compressed.br Binary files differnew file mode 100644 index 00000000..affb5ff7 --- /dev/null +++ b/tests/brotli-data/compressed.br diff --git a/tests/brotli-data/corrupt.br b/tests/brotli-data/corrupt.br Binary files differnew file mode 100644 index 00000000..2bbbeba5 --- /dev/null +++ b/tests/brotli-data/corrupt.br diff --git a/tests/brotli-data/uncompressed.txt b/tests/brotli-data/uncompressed.txt new file mode 100644 index 00000000..cd141c03 --- /dev/null +++ b/tests/brotli-data/uncompressed.txt @@ -0,0 +1,9 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam facilisis imperdiet arcu, cursus feugiat velit ultricies vel. Sed consequat velit id purus finibus, ut semper felis tincidunt. Phasellus non lobortis justo. Duis et fermentum dui, id pharetra tellus. Aenean egestas est diam. Etiam lacinia eu diam et fringilla. Integer fringilla, neque non rhoncus venenatis, mauris leo lobortis dolor, id porta dui mi a nibh. Quisque libero orci, eleifend id ornare ut, tristique quis tellus. Nullam urna sem, sollicitudin sit amet urna id, elementum ornare lectus. Curabitur at luctus arcu, nec viverra odio. Donec luctus, ante ac imperdiet dictum, purus diam fringilla tortor, in posuere nisl nibh et ante. Mauris dapibus, est sed condimentum eleifend, sapien ante rhoncus dui, id porta ante libero at leo. + +Vivamus in ligula a mi mollis pellentesque eget sed nisl. Cras viverra semper diam. Donec consectetur placerat dignissim. Donec et porttitor urna. Pellentesque placerat at mi a blandit. Sed nec tellus ac sem semper mattis. Mauris mollis libero quam, vitae tincidunt nisi ullamcorper vel. Proin sapien purus, commodo at urna nec, viverra volutpat neque. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + +Duis consectetur, justo a consequat condimentum, lectus tortor ultricies justo, nec tincidunt turpis erat vitae nisi. Praesent at volutpat lacus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cras sodales libero vitae ultricies dictum. Integer sollicitudin eu arcu non hendrerit. Etiam vel maximus odio. Quisque ex diam, porta sit amet scelerisque vel, tempor nec purus. In fermentum lectus at risus ullamcorper rhoncus. Vestibulum nulla arcu, commodo a vestibulum vel, porttitor et metus. Phasellus facilisis justo vitae quam maximus, interdum fermentum risus dignissim. + +Phasellus tristique sollicitudin orci ac scelerisque. Integer vulputate laoreet rutrum. Nullam mauris elit, lobortis et elementum at, vestibulum at magna. Curabitur accumsan leo ut nisi scelerisque maximus. Cras risus metus, suscipit non volutpat eget, lobortis eu erat. Vestibulum sed dolor egestas, ornare est nec, molestie nisi. Integer laoreet, ipsum non finibus rhoncus, erat nisi lacinia dui, vulputate imperdiet odio nulla eget ipsum. Nam sed cursus metus. Quisque lacinia consectetur erat, et dictum mi interdum sit amet. Praesent eleifend luctus odio in faucibus. + +Donec in diam rhoncus, vehicula tortor at, molestie erat. Nulla tempor in justo ut gravida. Praesent ornare laoreet ante non faucibus. Donec cursus mi sit amet fringilla bibendum. Ut tincidunt, libero nec scelerisque lobortis, nisi nunc laoreet velit, vitae sodales est purus vehicula urna. Phasellus fringilla mi tellus, in convallis diam maximus et. Praesent iaculis id sem sit amet posuere. Integer ullamcorper, eros ultrices placerat finibus, turpis sem commodo augue, ac ornare massa ante nec nulla. diff --git a/tests/brotli-decompressor-test.c b/tests/brotli-decompressor-test.c new file mode 100644 index 00000000..9b9b2f37 --- /dev/null +++ b/tests/brotli-decompressor-test.c @@ -0,0 +1,159 @@ +/* brotli-decompressor-test.c + * + * Copyright 2019 Igalia S.L. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: LGPL-2.0-or-later + */ + +#include "test-utils.h" +#include "libsoup/soup-brotli-decompressor.h" + +static void +test_brotli (void) +{ + SoupBrotliDecompressor *dec = soup_brotli_decompressor_new (); + char *compressed_filename = g_build_filename (g_test_get_dir (G_TEST_DIST), "brotli-data", "compressed.br", NULL); + char *uncompressed_filename = g_build_filename (g_test_get_dir (G_TEST_DIST), "brotli-data", "uncompressed.txt", NULL); + char *contents; + gsize length; + GByteArray *out_bytes = g_byte_array_new (); + char *in_buf; + GConverterResult result; + + g_assert_true (g_file_get_contents (compressed_filename, &contents, &length, NULL)); + in_buf = contents; + + do { + GError *error = NULL; + guint8 out_buf[16]; /* This is stupidly small just to simulate common usage of converting in chunks */ + gsize bytes_read, bytes_written; + result = g_converter_convert (G_CONVERTER (dec), in_buf, length, out_buf, sizeof out_buf, 0, + &bytes_read, &bytes_written, &error); + + g_assert_no_error (error); + g_assert_cmpint (result, !=, G_CONVERTER_ERROR); + + g_byte_array_append (out_bytes, out_buf, bytes_written); + in_buf += bytes_read; + length -= bytes_read; + + } while (result == G_CONVERTER_CONVERTED); + + g_assert_cmpint (result, ==, G_CONVERTER_FINISHED); + + g_free (contents); + g_assert_true (g_file_get_contents (uncompressed_filename, &contents, &length, NULL)); + g_assert_cmpstr ((char*)out_bytes->data, ==, contents); + + g_byte_array_free (out_bytes, TRUE); + g_object_unref (dec); + g_free (compressed_filename); + g_free (uncompressed_filename); + g_free (contents); +} + +static void +test_brotli_corrupt (void) +{ + SoupBrotliDecompressor *dec = soup_brotli_decompressor_new (); + char *compressed_filename = g_build_filename (g_test_get_dir (G_TEST_DIST), "brotli-data", "corrupt.br", NULL); + GError *error = NULL; + char *contents; + gsize length; + char *in_buf; + GConverterResult result; + + g_assert_true (g_file_get_contents (compressed_filename, &contents, &length, NULL)); + in_buf = contents; + + do { + guint8 out_buf[4096]; + gsize bytes_read, bytes_written; + result = g_converter_convert (G_CONVERTER (dec), in_buf, length, out_buf, sizeof out_buf, 0, + &bytes_read, &bytes_written, &error); + + in_buf += bytes_read; + length -= bytes_read; + } while (result == G_CONVERTER_CONVERTED); + + g_assert_cmpint (result, ==, G_CONVERTER_ERROR); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED); + + g_object_unref (dec); + g_free (compressed_filename); + g_free (contents); + g_error_free (error); +} + +static void +test_brotli_reset (void) +{ + SoupBrotliDecompressor *dec = soup_brotli_decompressor_new (); + char *compressed_filename = g_build_filename (g_test_get_dir (G_TEST_DIST), "brotli-data", "compressed.br", NULL); + char *contents; + gsize length, in_len; + char *in_buf; + GConverterResult result; + int iterations = 0; + + g_assert_true (g_file_get_contents (compressed_filename, &contents, &length, NULL)); + in_buf = contents; + in_len = length; + + do { + GError *error = NULL; + guint8 out_buf[16]; + gsize bytes_read, bytes_written; + result = g_converter_convert (G_CONVERTER (dec), in_buf, in_len, out_buf, sizeof out_buf, 0, + &bytes_read, &bytes_written, &error); + + /* Just randomly reset in the middle and ensure everything keeps working */ + if (iterations == 6) { + g_converter_reset (G_CONVERTER (dec)); + in_buf = contents; + in_len = length; + } + + g_assert_no_error (error); + g_assert_cmpint (result, !=, G_CONVERTER_ERROR); + in_buf += bytes_read; + in_len -= bytes_read; + ++iterations; + } while (result == G_CONVERTER_CONVERTED); + + g_assert_cmpint (result, ==, G_CONVERTER_FINISHED); + + g_object_unref (dec); + g_free (compressed_filename); + g_free (contents); +} + +int +main (int argc, char **argv) +{ + + int ret; + + test_init (argc, argv, NULL); + + g_test_add_func ("/brotli/basic", test_brotli); + g_test_add_func ("/brotli/corrupt", test_brotli_corrupt); + g_test_add_func ("/brotli/reset", test_brotli_reset); + + ret = g_test_run (); + test_cleanup (); + return ret; +} diff --git a/tests/connection-test.c b/tests/connection-test.c index ec54daea..7e430801 100644 --- a/tests/connection-test.c +++ b/tests/connection-test.c @@ -400,6 +400,97 @@ do_persistent_connection_timeout_test (void) soup_test_session_abort_unref (session); } +static void +cancel_cancellable_handler (SoupSession *session, SoupMessage *msg, + SoupSocket *socket, gpointer user_data) +{ + g_cancellable_cancel (user_data); +} + +static void +do_persistent_connection_timeout_test_with_cancellation (void) +{ + SoupSession *session; + SoupMessage *msg; + SoupSocket *sockets[4] = { NULL, NULL, NULL, NULL }; + SoupURI *timeout_uri; + GCancellable *cancellable; + GInputStream *response; + int i; + char buf[8192]; + + session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL); + + g_signal_connect (session, "request-started", + G_CALLBACK (request_started_socket_collector), + &sockets); + + debug_printf (1, " First message\n"); + timeout_uri = soup_uri_new_with_base (base_uri, "/timeout-persistent"); + msg = soup_message_new_from_uri ("GET", timeout_uri); + cancellable = g_cancellable_new (); + soup_uri_free (timeout_uri); + response = soup_session_send (session, msg, cancellable, NULL); + soup_test_assert_message_status (msg, SOUP_STATUS_OK); + + if (sockets[1]) { + soup_test_assert (sockets[1] == NULL, "Message was retried"); + sockets[1] = sockets[2] = sockets[3] = NULL; + } + g_object_unref (msg); + + soup_test_assert (response, "No response received"); + + while (g_input_stream_read (response, buf, sizeof (buf), NULL, NULL)) + debug_printf (1, "Reading response\n"); + + soup_test_assert (!g_cancellable_is_cancelled (cancellable), + "User-supplied cancellable was cancelled"); + + g_object_unref (response); + + /* The server will grab server_mutex before returning the response, + * and release it when it's ready for us to send the second request. + */ + g_mutex_lock (&server_mutex); + g_mutex_unlock (&server_mutex); + + debug_printf (1, " Second message\n"); + msg = soup_message_new_from_uri ("GET", base_uri); + + /* Cancel the cancellable in the signal handler, and then check that it + * was not reset below */ + g_signal_connect (session, "request-started", + G_CALLBACK (cancel_cancellable_handler), + cancellable); + + response = soup_session_send (session, msg, cancellable, NULL); + + soup_test_assert (response == NULL, "Unexpected response"); + + soup_test_assert_message_status (msg, SOUP_STATUS_NONE); + + soup_test_assert (sockets[1] == sockets[0], + "Message was not retried on existing connection"); + soup_test_assert (sockets[2] != sockets[1], + "Message was retried on closed connection"); + soup_test_assert (sockets[3] == NULL, + "Message was retried again"); + g_object_unref (msg); + + /* cancellable should not have been reset, it should still be in the + * cancelled state */ + soup_test_assert (g_cancellable_is_cancelled (cancellable), + "User-supplied cancellable was reset"); + + for (i = 0; sockets[i]; i++) + g_object_unref (sockets[i]); + + g_object_unref (cancellable); + + soup_test_session_abort_unref (session); +} + static GMainLoop *max_conns_loop; static int msgs_done; static guint quit_loop_timeout; @@ -984,9 +1075,11 @@ do_one_connection_connect_fail_test (SoupSession *session, SoupURI *uri, GQuark (GAsyncReadyCallback)connect_finished, &data); g_main_loop_run (data.loop); + g_main_loop_unref (data.loop); g_assert (!data.stream); g_assert_error (data.error, domain, code); + g_clear_error (&data.error); while (*data.events) { soup_test_assert (!*data.events, @@ -1108,6 +1201,8 @@ main (int argc, char **argv) g_test_add_func ("/connection/content-length-framing", do_content_length_framing_test); g_test_add_func ("/connection/persistent-connection-timeout", do_persistent_connection_timeout_test); + g_test_add_func ("/connection/persistent-connection-timeout-with-cancellable", + do_persistent_connection_timeout_test_with_cancellation); g_test_add_func ("/connection/max-conns", do_max_conns_test); g_test_add_func ("/connection/non-persistent", do_non_persistent_connection_test); g_test_add_func ("/connection/non-idempotent", do_non_idempotent_connection_test); diff --git a/tests/cookies-test.c b/tests/cookies-test.c index 8735964c..d25da0e9 100644 --- a/tests/cookies-test.c +++ b/tests/cookies-test.c @@ -101,6 +101,7 @@ do_cookies_subdomain_policy_test (void) GSList *cookies; SoupURI *uri1; SoupURI *uri2; + SoupURI *uri3; g_test_bug ("792130"); @@ -109,6 +110,7 @@ do_cookies_subdomain_policy_test (void) */ uri1 = soup_uri_new ("https://www.gnome.org"); uri2 = soup_uri_new ("https://foundation.gnome.org"); + uri3 = soup_uri_new ("https://www.gnome.org."); /* We can't check subdomains with a test server running on * localhost, so we'll just check the cookie jar API itself. @@ -136,16 +138,117 @@ do_cookies_subdomain_policy_test (void) g_assert_cmpint (g_slist_length (cookies), ==, 2); g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); - /* A leading dot in the domain property should not affect things. - * This cookie should be accepted. Three cookies in the jar. + /* Now some Domain attribute tests.*/ + soup_cookie_jar_set_accept_policy (jar, SOUP_COOKIE_JAR_ACCEPT_ALWAYS); + + /* The cookie must be rejected if the Domain is not an appropriate + * match for the URI. Still two cookies in the jar. */ - soup_cookie_jar_set_cookie_with_first_party (jar, uri1, uri1, "4=foo; Domain=.www.gnome.org"); + soup_cookie_jar_set_cookie (jar, uri1, "4=foo; Domain=gitlab.gnome.org"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 2); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* Now the Domain is an appropriate match. Three cookies in the jar. */ + soup_cookie_jar_set_cookie (jar, uri1, "5=foo; Domain=gnome.org"); cookies = soup_cookie_jar_all_cookies (jar); g_assert_cmpint (g_slist_length (cookies), ==, 3); g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + /* A leading dot in the domain property should not affect things. + * This cookie should be accepted. Four cookies in the jar. + */ + soup_cookie_jar_set_cookie (jar, uri1, "6=foo; Domain=.www.gnome.org"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 4); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* The cookie must be rejected if the Domain ends in a trailing dot + * but the uri doesn't. + */ + soup_cookie_jar_set_cookie (jar, uri1, "7=foo; Domain=www.gnome.org."); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 4); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* The cookie should be accepted if both Domain and URI end with a trailing + * dot and they are a match. Five cookies in the jar. + */ + soup_cookie_jar_set_cookie (jar, uri3, "8=foo; Domain=gnome.org."); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 5); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* The cookie should be rejected if URI has trailing dot but Domain doesn't. + * Five cookies in the jar. + */ + soup_cookie_jar_set_cookie (jar, uri3, "9=foo; Domain=gnome.org"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 5); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* It should not be possible to set a cookie for a TLD. Still five + * cookies in the jar. + */ + soup_cookie_jar_set_cookie (jar, uri1, "10=foo; Domain=.org"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 5); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* It should still not be possible to set a cookie for a TLD, even if + * we are tricksy and have a trailing dot. Still only five cookies. + */ + soup_cookie_jar_set_cookie (jar, uri3, "11=foo; Domain=.org."); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 5); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + soup_uri_free (uri1); soup_uri_free (uri2); + soup_uri_free (uri3); + g_object_unref (jar); +} + +static void +do_cookies_strict_secure_test (void) +{ + SoupCookieJar *jar; + GSList *cookies; + SoupURI *insecure_uri; + SoupURI *secure_uri; + + insecure_uri = soup_uri_new ("http://gnome.org"); + secure_uri = soup_uri_new ("https://gnome.org"); + jar = soup_cookie_jar_new (); + + /* Set a cookie from secure origin */ + soup_cookie_jar_set_cookie (jar, secure_uri, "1=foo; secure"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 1); + g_assert_cmpstr (soup_cookie_get_value(cookies->data), ==, "foo"); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* Do not allow an insecure origin to overwrite a secure cookie */ + soup_cookie_jar_set_cookie (jar, insecure_uri, "1=bar"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 1); + g_assert_cmpstr (soup_cookie_get_value(cookies->data), ==, "foo"); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* Secure can only be set by from secure origin */ + soup_cookie_jar_set_cookie (jar, insecure_uri, "2=foo; secure"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 1); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* But we can make one for another path */ + soup_cookie_jar_set_cookie (jar, insecure_uri, "1=foo; path=/foo"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 2); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + soup_uri_free (insecure_uri); + soup_uri_free (secure_uri); g_object_unref (jar); } @@ -175,13 +278,13 @@ do_cookies_parsing_test (void) msg = soup_message_new_from_uri ("GET", first_party_uri); soup_message_headers_append (msg->request_headers, "Echo-Set-Cookie", - "two=2; HttpOnly; max-age=100"); + "two=2; HttpOnly; max-age=100; SameSite=Invalid"); soup_session_send_message (session, msg); g_object_unref (msg); msg = soup_message_new_from_uri ("GET", first_party_uri); soup_message_headers_append (msg->request_headers, "Echo-Set-Cookie", - "three=3; httpONLY=Wednesday; max-age=100"); + "three=3; httpONLY=Wednesday; max-age=100; SameSite=Lax"); soup_session_send_message (session, msg); g_object_unref (msg); @@ -199,10 +302,12 @@ do_cookies_parsing_test (void) got2 = TRUE; g_assert_true (soup_cookie_get_http_only (cookie)); g_assert_true (soup_cookie_get_expires (cookie) != NULL); + g_assert_cmpint (soup_cookie_get_same_site_policy (cookie), ==, SOUP_SAME_SITE_POLICY_NONE); } else if (!strcmp (soup_cookie_get_name (cookie), "three")) { got3 = TRUE; g_assert_true (soup_cookie_get_http_only (cookie)); g_assert_true (soup_cookie_get_expires (cookie) != NULL); + g_assert_cmpint (soup_cookie_get_same_site_policy (cookie), ==, SOUP_SAME_SITE_POLICY_LAX); } else { soup_test_assert (FALSE, "got unexpected cookie '%s'", soup_cookie_get_name (cookie)); @@ -219,6 +324,66 @@ do_cookies_parsing_test (void) soup_test_session_abort_unref (session); } +static void +do_cookies_parsing_nopath_nullorigin (void) +{ + SoupCookie *cookie = soup_cookie_parse ("NAME=Value", NULL); + g_assert_nonnull (cookie); + g_assert_cmpstr ("/", ==, soup_cookie_get_path (cookie)); + soup_cookie_free (cookie); +} + +static void +do_get_cookies_empty_host_test (void) +{ + SoupCookieJar *jar; + SoupURI *uri; + char *cookies; + + jar = soup_cookie_jar_new (); + uri = soup_uri_new ("file:///whatever.html"); + + cookies = soup_cookie_jar_get_cookies (jar, uri, FALSE); + + g_assert_null (cookies); + + g_object_unref (jar); + soup_uri_free (uri); +} + +static void +send_callback (GObject *source_object, + GAsyncResult *res, + GMainLoop *loop) +{ + g_main_loop_quit (loop); +} + +static void +do_remove_feature_test (void) +{ + SoupSession *session; + SoupMessage *msg; + SoupURI *uri; + GMainLoop *loop; + + session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); + soup_session_add_feature_by_type (session, SOUP_TYPE_COOKIE_JAR); + uri = soup_uri_new_with_base (first_party_uri, "/index.html"); + msg = soup_message_new_from_uri ("GET", uri); + soup_message_set_first_party (msg, first_party_uri); + + loop = g_main_loop_new (NULL, TRUE); + soup_session_send_async (session, msg, NULL, (GAsyncReadyCallback)send_callback, loop); + soup_session_remove_feature_by_type (session, SOUP_TYPE_COOKIE_JAR); + + g_main_loop_run(loop); + + g_main_loop_unref (loop); + g_object_unref (msg); + soup_uri_free (uri); +} + int main (int argc, char **argv) { @@ -239,6 +404,10 @@ main (int argc, char **argv) g_test_add_func ("/cookies/accept-policy", do_cookies_accept_policy_test); g_test_add_func ("/cookies/accept-policy-subdomains", do_cookies_subdomain_policy_test); g_test_add_func ("/cookies/parsing", do_cookies_parsing_test); + g_test_add_func ("/cookies/parsing/no-path-null-origin", do_cookies_parsing_nopath_nullorigin); + g_test_add_func ("/cookies/get-cookies/empty-host", do_get_cookies_empty_host_test); + g_test_add_func ("/cookies/remove-feature", do_remove_feature_test); + g_test_add_func ("/cookies/secure-cookies", do_cookies_strict_secure_test); ret = g_test_run (); diff --git a/tests/date.c b/tests/date-test.c index f623061b..97ae221f 100644 --- a/tests/date.c +++ b/tests/date-test.c @@ -171,6 +171,8 @@ check_ok_time_t (void) g_assert_cmpint (date->minute, ==, 9); g_assert_cmpint (date->second, ==, 7); + g_assert_cmpuint (TIME_T, ==, soup_date_to_time_t (date)); + soup_date_free (date); } diff --git a/tests/header-parsing.c b/tests/header-parsing-test.c index 9cf06cee..31edfd02 100644 --- a/tests/header-parsing.c +++ b/tests/header-parsing-test.c @@ -794,6 +794,46 @@ static struct QValueTest { }; static const int num_qvaluetests = G_N_ELEMENTS (qvaluetests); +static struct ParamListTest { + gboolean strict; + const char *header_value; + struct ParamListResult { + const char * param; + const char * value; + } results[3]; +} paramlisttests[] = { + { TRUE, + "UserID=JohnDoe; Max-Age=3600; Version=1", + { { "UserID", "JohnDoe" }, + { "Max-Age", "3600" }, + { "Version", "1" }, + } + }, + + { TRUE, + "form-data; name=\"fieldName\"; filename=\"filename.jpg\"", + { { "form-data", NULL }, + { "name", "fieldName" }, + { "filename", "filename.jpg" }, + }, + }, + + { FALSE, + "form-data; form-data; filename=\"filename.jpg\"", + { { "form-data", NULL }, + { "filename", "filename.jpg" }, + }, + }, + + { FALSE, + "attachment; filename*=UTF-8''t%C3%A9st.txt; filename=\"test.txt\"", + { { "attachment", NULL }, + { "filename", "t\xC3\xA9st.txt" }, + }, + }, +}; +static const int num_paramlisttests = G_N_ELEMENTS (paramlisttests); + static void check_headers (Header *headers, SoupMessageHeaders *hdrs) { @@ -949,6 +989,41 @@ do_qvalue_tests (void) } } +static void +do_param_list_tests (void) +{ + int i, j, n_params; + GHashTable* params; + + for (i = 0; i < num_paramlisttests; i++) { + params = soup_header_parse_semi_param_list (paramlisttests[i].header_value); + g_assert_nonnull (params); + n_params = paramlisttests[i].strict ? 3 : 2; + g_assert_cmpuint (g_hash_table_size (params), ==, n_params); + for (j = 0; j < n_params; j++) { + g_assert_cmpstr (g_hash_table_lookup (params, paramlisttests[i].results[j].param), + ==, paramlisttests[i].results[j].value); + } + soup_header_free_param_list (params); + } + + for (i = 0; i < num_paramlisttests; i++) { + params = soup_header_parse_semi_param_list_strict (paramlisttests[i].header_value); + if (paramlisttests[i].strict) { + g_assert_nonnull (params); + n_params = 3; + g_assert_cmpuint (g_hash_table_size (params), ==, n_params); + for (j = 0; j < n_params; j++) { + g_assert_cmpstr (g_hash_table_lookup (params, paramlisttests[i].results[j].param), + ==, paramlisttests[i].results[j].value); + } + soup_header_free_param_list (params); + } else { + g_assert_null (params); + } + } +} + #define RFC5987_TEST_FILENAME "t\xC3\xA9st.txt" #define RFC5987_TEST_FALLBACK_FILENAME "test.txt" @@ -1175,6 +1250,7 @@ main (int argc, char **argv) g_test_add_func ("/header-parsing/request", do_request_tests); g_test_add_func ("/header-parsing/response", do_response_tests); g_test_add_func ("/header-parsing/qvalue", do_qvalue_tests); + g_test_add_func ("/header-parsing/param-list", do_param_list_tests); g_test_add_func ("/header-parsing/content-disposition", do_content_disposition_tests); g_test_add_func ("/header-parsing/content-type", do_content_type_tests); g_test_add_func ("/header-parsing/append-param", do_append_param_tests); diff --git a/tests/hsts-db-test.c b/tests/hsts-db-test.c new file mode 100644 index 00000000..9f007fa8 --- /dev/null +++ b/tests/hsts-db-test.c @@ -0,0 +1,198 @@ +#include <glib.h> +#include <glib/gstdio.h> + +#include <stdio.h> +#include "test-utils.h" + +#define DB_FILE "hsts-db.sqlite" + +SoupURI *http_uri; +SoupURI *https_uri; + +/* This server pseudo-implements the HSTS spec in order to allow us to + test the Soup HSTS feature. + */ +static void +server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *context, gpointer data) +{ + const char *server_protocol = data; + + if (strcmp (server_protocol, "http") == 0) { + char *uri_string; + SoupURI *uri = soup_uri_new ("https://localhost"); + soup_uri_set_path (uri, path); + uri_string = soup_uri_to_string (uri, FALSE); + fprintf (stderr, "server is redirecting to HTTPS\n"); + soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY, uri_string); + soup_uri_free (uri); + g_free (uri_string); + } else if (strcmp (server_protocol, "https") == 0) { + soup_message_set_status (msg, SOUP_STATUS_OK); + if (strcmp (path, "/long-lasting") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000"); + } else if (strcmp (path, "/two-seconds") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=2"); + } else if (strcmp (path, "/delete") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=0"); + } else if (strcmp (path, "/subdomains") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000; includeSubDomains"); + } + else if (strcmp (path, "/very-long-lasting") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=631138519"); + } + } +} + +static void +session_get_uri (SoupSession *session, const char *uri, SoupStatus expected_status) +{ + SoupMessage *msg; + + msg = soup_message_new ("GET", uri); + soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, expected_status); + g_object_unref (msg); +} + +/* The HSTS specification does not handle custom ports, so we need to + * rewrite the URI in the request and add the port where the server is + * listening before it is sent, to be able to connect to the localhost + * port where the server is actually running. + */ +static void +rewrite_message_uri (SoupMessage *msg) +{ + if (soup_uri_get_scheme (soup_message_get_uri (msg)) == SOUP_URI_SCHEME_HTTP) + soup_uri_set_port (soup_message_get_uri (msg), soup_uri_get_port (http_uri)); + else if (soup_uri_get_scheme (soup_message_get_uri (msg)) == SOUP_URI_SCHEME_HTTPS) + soup_uri_set_port (soup_message_get_uri (msg), soup_uri_get_port (https_uri)); + else + g_assert_not_reached(); +} + +static void +on_message_restarted (SoupMessage *msg, + gpointer data) +{ + rewrite_message_uri (msg); +} + +static void +on_request_queued (SoupSession *session, + SoupMessage *msg, + gpointer data) +{ + g_signal_connect (msg, "restarted", G_CALLBACK (on_message_restarted), NULL); + + rewrite_message_uri (msg); +} + +static SoupSession * +hsts_db_session_new (void) +{ + SoupHSTSEnforcer *hsts_db = soup_hsts_enforcer_db_new (DB_FILE); + + SoupSession *session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, + SOUP_SESSION_ADD_FEATURE, hsts_db, + NULL); + g_signal_connect (session, "request-queued", G_CALLBACK (on_request_queued), NULL); + g_object_unref (hsts_db); + + return session; +} + + +static void +do_hsts_db_persistency_test (void) +{ + SoupSession *session = hsts_db_session_new (); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + session = hsts_db_session_new (); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + g_remove (DB_FILE); +} + +static void +do_hsts_db_subdomains_test (void) +{ + SoupSession *session = hsts_db_session_new (); + session_get_uri (session, "https://localhost/subdomains", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + session = hsts_db_session_new (); + session_get_uri (session, "http://subdomain.localhost", SOUP_STATUS_SSL_FAILED); + soup_test_session_abort_unref (session); + + g_remove (DB_FILE); +} + +static void +do_hsts_db_large_max_age_test (void) +{ + SoupSession *session = hsts_db_session_new (); + session_get_uri (session, "https://localhost/very-long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + session = hsts_db_session_new (); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + g_remove (DB_FILE); +} + +int +main (int argc, char **argv) +{ + int ret; + SoupServer *server; + SoupServer *https_server = NULL; + + test_init (argc, argv, NULL); + + server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + soup_server_add_handler (server, NULL, server_callback, "http", NULL); + http_uri = soup_test_server_get_uri (server, "http", NULL); + + if (tls_available) { + https_server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + soup_server_add_handler (https_server, NULL, server_callback, "https", NULL); + https_uri = soup_test_server_get_uri (https_server, "https", NULL); + } + + g_test_add_func ("/hsts-db/basic", do_hsts_db_persistency_test); + g_test_add_func ("/hsts-db/subdomains", do_hsts_db_subdomains_test); + g_test_add_func ("/hsts-db/large-max-age", do_hsts_db_large_max_age_test); + + ret = g_test_run (); + + soup_uri_free (http_uri); + soup_test_server_quit_unref (server); + + if (tls_available) { + soup_uri_free (https_uri); + soup_test_server_quit_unref (https_server); + } + + test_cleanup (); + return ret; +} diff --git a/tests/hsts-test.c b/tests/hsts-test.c new file mode 100644 index 00000000..b01e1f37 --- /dev/null +++ b/tests/hsts-test.c @@ -0,0 +1,616 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2018 Igalia S.L. + * Copyright (C) 2018 Metrological Group B.V. + */ + +#include "test-utils.h" + +SoupURI *http_uri; +SoupURI *https_uri; + +/* This server pseudo-implements the HSTS spec in order to allow us to + test the Soup HSTS feature. + */ +static void +server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *context, gpointer data) +{ + const char *server_protocol = data; + + if (strcmp (server_protocol, "http") == 0) { + if (strcmp (path, "/insecure") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000"); + soup_message_set_status (msg, SOUP_STATUS_OK); + } else { + char *uri_string; + SoupURI *uri = soup_uri_new ("https://localhost"); + soup_uri_set_path (uri, path); + uri_string = soup_uri_to_string (uri, FALSE); + soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY, uri_string); + soup_uri_free (uri); + g_free (uri_string); + } + } else if (strcmp (server_protocol, "https") == 0) { + soup_message_set_status (msg, SOUP_STATUS_OK); + if (strcmp (path, "/long-lasting") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000"); + } else if (strcmp (path, "/two-seconds") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=2"); + } else if (strcmp (path, "/three-seconds") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=3"); + } else if (strcmp (path, "/delete") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=0"); + } else if (strcmp (path, "/subdomains") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000; includeSubDomains"); + } else if (strcmp (path, "/no-sts-header") == 0) { + /* Do not add anything */ + } else if (strcmp (path, "/multiple-headers") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=31536000; includeSubDomains"); + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=1; includeSubDomains"); + } else if (strcmp (path, "/missing-values") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + ""); + } else if (strcmp (path, "/invalid-values") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=foo"); + } else if (strcmp (path, "/extra-values-0") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=3600; foo"); + } else if (strcmp (path, "/extra-values-1") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + " max-age=3600; includeDomains; foo"); + } else if (strcmp (path, "/duplicated-directives") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=3600; includeDomains; includeDomains"); + } else if (strcmp (path, "/case-insensitive-header") == 0) { + soup_message_headers_append (msg->response_headers, + "STRICT-TRANSPORT-SECURITY", + "max-age=3600"); + } else if (strcmp (path, "/case-insensitive-directives") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "MAX-AGE=3600; includesubdomains"); + } else if (strcmp (path, "/optional-quotations") == 0) { + soup_message_headers_append (msg->response_headers, + "Strict-Transport-Security", + "max-age=\"31536000\""); + } + } +} + +static void +session_get_uri (SoupSession *session, const char *uri, SoupStatus expected_status) +{ + SoupMessage *msg; + + msg = soup_message_new ("GET", uri); + soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, expected_status); + g_object_unref (msg); +} + +/* The HSTS specification does not handle custom ports, so we need to + * rewrite the URI in the request and add the port where the server is + * listening before it is sent, to be able to connect to the localhost + * port where the server is actually running. + */ +static void +rewrite_message_uri (SoupMessage *msg) +{ + if (soup_uri_get_scheme (soup_message_get_uri (msg)) == SOUP_URI_SCHEME_HTTP) + soup_uri_set_port (soup_message_get_uri (msg), soup_uri_get_port (http_uri)); + else if (soup_uri_get_scheme (soup_message_get_uri (msg)) == SOUP_URI_SCHEME_HTTPS) + soup_uri_set_port (soup_message_get_uri (msg), soup_uri_get_port (https_uri)); + else + g_assert_not_reached(); +} + +static void +on_message_restarted (SoupMessage *msg, + gpointer data) +{ + rewrite_message_uri (msg); +} + +static void +on_request_queued (SoupSession *session, + SoupMessage *msg, + gpointer data) +{ + g_signal_connect (msg, "restarted", G_CALLBACK (on_message_restarted), NULL); + + rewrite_message_uri (msg); +} + +static SoupSession * +hsts_session_new (SoupHSTSEnforcer *enforcer) +{ + SoupSession *session; + + if (enforcer) + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, + SOUP_SESSION_ADD_FEATURE, enforcer, + NULL); + else + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, + SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_HSTS_ENFORCER, + NULL); + + g_signal_connect (session, "request-queued", G_CALLBACK (on_request_queued), NULL); + + return session; +} + + +static void +do_hsts_basic_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + + /* The HSTS headers in the url above doesn't include + subdomains, so the request should ask for the unchanged + HTTP address below, to which the server will respond with a + moved permanently status. */ + session_get_uri (session, "http://subdomain.localhost", SOUP_STATUS_MOVED_PERMANENTLY); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_expire_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + + session_get_uri (session, "https://localhost/two-seconds", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + /* Wait for the policy to expire. */ + g_usleep (3 * G_USEC_PER_SEC); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_delete_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + session_get_uri (session, "https://localhost/delete", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_replace_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + session_get_uri (session, "https://localhost/two-seconds", SOUP_STATUS_OK); + /* Wait for the policy to expire. */ + g_usleep (3 * G_USEC_PER_SEC); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_update_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/three-seconds", SOUP_STATUS_OK); + g_usleep (2 * G_USEC_PER_SEC); + session_get_uri (session, "https://localhost/three-seconds", SOUP_STATUS_OK); + g_usleep (2 * G_USEC_PER_SEC); + + /* At this point, 4 seconds have elapsed since setting the 3 seconds HSTS + rule for the first time, and it should have expired by now, but since it + was updated, it should still be valid. */ + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_set_and_delete_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + session_get_uri (session, "https://localhost/delete", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_no_hsts_header_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + session_get_uri (session, "https://localhost/no-sts-header", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_persistency_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + + session = hsts_session_new (NULL); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_subdomains_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/subdomains", SOUP_STATUS_OK); + /* The enforcer should cause the request to ask for an HTTPS + uri, which will fail with an SSL error as there's no server + in subdomain.localhost. */ + session_get_uri (session, "http://subdomain.localhost", SOUP_STATUS_SSL_FAILED); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_superdomain_test (void) +{ + SoupHSTSEnforcer *enforcer = soup_hsts_enforcer_new (); + SoupHSTSPolicy *policy; + + SoupSession *session = hsts_session_new (enforcer); + /* This adds a long-lasting policy for localhost. */ + session_get_uri (session, "https://localhost/long-lasting", SOUP_STATUS_OK); + + /* We want to set a policy with age = 0 for a subdomain, to test that the + superdomain's policy is not removed. We cannot test this with a + server, so we just create one by hand and add it to the enforcer. */ + policy = soup_hsts_policy_new ("subdomain.localhost", 0, TRUE); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + /* This should work, as we have a long-lasting policy in place. If it fails, + the subdomain policy has modified the superdomain's policy, which is wrong. */ + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + g_object_unref (enforcer); +} + +static void +do_hsts_multiple_headers_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/multiple-headers", SOUP_STATUS_OK); + g_usleep(2 * G_USEC_PER_SEC); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_insecure_sts_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "http://localhost/insecure", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_missing_values_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/missing-values", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_invalid_values_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/invalid-values", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_extra_values_test (void) +{ + int i; + for (i = 0; i < 2; i++) { + SoupSession *session = hsts_session_new (NULL); + char *uri = g_strdup_printf ("https://localhost/extra-values-%i", i); + session_get_uri (session, uri, SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); + g_free (uri); + } +} + +static void +do_hsts_duplicated_directives_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/duplicated-directives", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_case_insensitive_header_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/case-insensitive-header", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_case_insensitive_directives_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/case-insensitive-directives", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_optional_quotations_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + + session_get_uri (session, "https://localhost/optional-quotations", SOUP_STATUS_OK); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + + soup_test_session_abort_unref (session); +} + +static void +do_hsts_ip_address_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://127.0.0.1/basic", SOUP_STATUS_OK); + session_get_uri (session, "http://127.0.0.1/", SOUP_STATUS_MOVED_PERMANENTLY); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_utf8_address_test (void) +{ + SoupSession *session = hsts_session_new (NULL); + session_get_uri (session, "https://localhost/subdomains", SOUP_STATUS_OK); + /* The enforcer should cause the request to ask for an HTTPS + uri, which will fail with an SSL error as there's no server + in 食狮.ä¸å›½.localhost. */ + session_get_uri (session, "http://食狮.ä¸å›½.localhost", SOUP_STATUS_SSL_FAILED); + soup_test_session_abort_unref (session); +} + +static void +do_hsts_session_policy_test (void) +{ + SoupHSTSEnforcer *enforcer = soup_hsts_enforcer_new (); + SoupSession *session = hsts_session_new (enforcer); + + session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY); + soup_hsts_enforcer_set_session_policy (enforcer, "localhost", FALSE); + session_get_uri (session, "http://localhost", SOUP_STATUS_OK); + + soup_test_session_abort_unref (session); + g_object_unref (enforcer); +} + +static void +on_idna_test_enforcer_changed (SoupHSTSEnforcer *enforcer, SoupHSTSPolicy *old, SoupHSTSPolicy *new, gpointer data) +{ + /* If NULL, then instead of replacing we're adding a new + * policy and somewhere we're failing to canonicalize a hostname. */ + g_assert_nonnull (old); + g_assert_cmpstr (old->domain, ==, new->domain); + /* Domains should not have punycoded segments at this point. */ + g_assert_false (g_hostname_is_ascii_encoded (old->domain)); +} + +static void +do_hsts_idna_addresses_test (void) +{ + SoupHSTSEnforcer *enforcer = soup_hsts_enforcer_new (); + + soup_hsts_enforcer_set_session_policy (enforcer, "áéÃ.com", FALSE); + soup_hsts_enforcer_set_session_policy (enforcer, "xn--6scagyk0fc4c.in", FALSE); + + g_assert_true (soup_hsts_enforcer_has_valid_policy (enforcer, "xn--1caqm.com")); + + g_signal_connect (enforcer, "changed", G_CALLBACK (on_idna_test_enforcer_changed), NULL); + + soup_hsts_enforcer_set_session_policy (enforcer, "xn--1caqm.com", TRUE); + soup_hsts_enforcer_set_session_policy (enforcer, "ನೆನಪಿರಲಿ.in", TRUE); + + g_object_unref (enforcer); +} + +static void +do_hsts_get_domains_test (void) +{ + SoupHSTSEnforcer *enforcer = soup_hsts_enforcer_new (); + SoupHSTSPolicy *policy; + GList* domains; + + g_assert_null (soup_hsts_enforcer_get_domains (enforcer, TRUE)); + g_assert_null (soup_hsts_enforcer_get_domains (enforcer, FALSE)); + + policy = soup_hsts_policy_new ("gnome.org", 3600, FALSE); + g_assert_nonnull (policy); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + policy = soup_hsts_policy_new_session_policy ("freedesktop.org", FALSE); + g_assert_nonnull (policy); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + domains = soup_hsts_enforcer_get_domains (enforcer, TRUE); + g_assert_nonnull (domains); + g_assert_cmpint (g_list_length (domains), ==, 2); + g_list_free_full (domains, (GDestroyNotify)g_free); + + domains = soup_hsts_enforcer_get_domains (enforcer, FALSE); + g_assert_nonnull (domains); + g_assert_cmpint (g_list_length (domains), ==, 1); + g_assert_cmpstr ((char*)domains->data, ==, "gnome.org"); + g_list_free_full (domains, (GDestroyNotify)g_free); + + policy = soup_hsts_policy_new ("gnome.org", SOUP_HSTS_POLICY_MAX_AGE_PAST, FALSE); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + domains = soup_hsts_enforcer_get_domains (enforcer, TRUE); + g_assert_cmpint (g_list_length (domains), ==, 1); + g_assert_cmpstr ((char*)domains->data, ==, "freedesktop.org"); + g_list_free_full (domains, g_free); + g_object_unref (enforcer); +} + +static void +do_hsts_get_policies_test (void) +{ + SoupHSTSEnforcer *enforcer = soup_hsts_enforcer_new (); + SoupHSTSPolicy *policy; + GList* policies; + + g_assert_null (soup_hsts_enforcer_get_policies (enforcer, TRUE)); + g_assert_null (soup_hsts_enforcer_get_policies (enforcer, FALSE)); + + policy = soup_hsts_policy_new ("gnome.org", 3600, FALSE); + g_assert_nonnull (policy); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + policy = soup_hsts_policy_new_session_policy ("freedesktop.org", FALSE); + g_assert_nonnull (policy); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + policies = soup_hsts_enforcer_get_policies (enforcer, TRUE); + g_assert_nonnull (policies); + g_assert_cmpint (g_list_length (policies), ==, 2); + g_list_free_full (policies, (GDestroyNotify)soup_hsts_policy_free); + + policies = soup_hsts_enforcer_get_policies (enforcer, FALSE); + g_assert_nonnull (policies); + g_assert_cmpint (g_list_length (policies), ==, 1); + policy = (SoupHSTSPolicy*)policies->data; + g_assert_cmpstr (policy->domain, ==, "gnome.org"); + g_list_free_full (policies, (GDestroyNotify)soup_hsts_policy_free); + + policy = soup_hsts_policy_new ("gnome.org", SOUP_HSTS_POLICY_MAX_AGE_PAST, FALSE); + soup_hsts_enforcer_set_policy (enforcer, policy); + soup_hsts_policy_free (policy); + + policies = soup_hsts_enforcer_get_policies (enforcer, TRUE); + g_assert_cmpint (g_list_length (policies), ==, 1); + policy = (SoupHSTSPolicy*)policies->data; + g_assert_cmpstr (policy->domain, ==, "freedesktop.org"); + g_list_free_full (policies, (GDestroyNotify)soup_hsts_policy_free); + g_object_unref(enforcer); +} + +int +main (int argc, char **argv) +{ + int ret; + SoupServer *server; + SoupServer *https_server = NULL; + + test_init (argc, argv, NULL); + + server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + soup_server_add_handler (server, NULL, server_callback, "http", NULL); + http_uri = soup_test_server_get_uri (server, "http", NULL); + + if (tls_available) { + https_server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + soup_server_add_handler (https_server, NULL, server_callback, "https", NULL); + https_uri = soup_test_server_get_uri (https_server, "https", NULL); + } + + /* The case sensitivity test is run first because soup_message_headers_append() + interns the header name and further uses of the name use the interned version. + if we ran this test later, then the casing that this tests uses wouldn't be used. */ + g_test_add_func ("/hsts/case-insensitive-header", do_hsts_case_insensitive_header_test); + g_test_add_func ("/hsts/basic", do_hsts_basic_test); + g_test_add_func ("/hsts/expire", do_hsts_expire_test); + g_test_add_func ("/hsts/delete", do_hsts_delete_test); + g_test_add_func ("/hsts/replace", do_hsts_replace_test); + g_test_add_func ("/hsts/update", do_hsts_update_test); + g_test_add_func ("/hsts/set_and_delete", do_hsts_set_and_delete_test); + g_test_add_func ("/hsts/no_hsts_header", do_hsts_no_hsts_header_test); + g_test_add_func ("/hsts/persistency", do_hsts_persistency_test); + g_test_add_func ("/hsts/subdomains", do_hsts_subdomains_test); + g_test_add_func ("/hsts/superdomain", do_hsts_superdomain_test); + g_test_add_func ("/hsts/multiple-headers", do_hsts_multiple_headers_test); + g_test_add_func ("/hsts/insecure-sts", do_hsts_insecure_sts_test); + g_test_add_func ("/hsts/missing-values", do_hsts_missing_values_test); + g_test_add_func ("/hsts/invalid-values", do_hsts_invalid_values_test); + g_test_add_func ("/hsts/extra-values", do_hsts_extra_values_test); + g_test_add_func ("/hsts/duplicated-directives", do_hsts_duplicated_directives_test); + g_test_add_func ("/hsts/case-insensitive-directives", do_hsts_case_insensitive_directives_test); + g_test_add_func ("/hsts/optional-quotations", do_hsts_optional_quotations_test); + g_test_add_func ("/hsts/ip-address", do_hsts_ip_address_test); + g_test_add_func ("/hsts/utf8-address", do_hsts_utf8_address_test); + g_test_add_func ("/hsts/session-policy", do_hsts_session_policy_test); + g_test_add_func ("/hsts/idna-addresses", do_hsts_idna_addresses_test); + g_test_add_func ("/hsts/get-domains", do_hsts_get_domains_test); + g_test_add_func ("/hsts/get-policies", do_hsts_get_policies_test); + + ret = g_test_run (); + + soup_uri_free (http_uri); + soup_test_server_quit_unref (server); + + if (tls_available) { + soup_uri_free (https_uri); + soup_test_server_quit_unref (https_server); + } + + test_cleanup (); + return ret; +} diff --git a/tests/httpd.conf.in b/tests/httpd.conf.in index b818c12d..93fb7ff4 100644 --- a/tests/httpd.conf.in +++ b/tests/httpd.conf.in @@ -24,13 +24,15 @@ 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 php7_module @APACHE_PHP_MODULE_DIR@/libphp7.so +@IF_HAVE_PHP@LoadModule php7_module @APACHE_PHP_MODULE_FILE@ 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 @IF_HAVE_MOD_UNIXD@LoadModule unixd_module @APACHE_SSL_MODULE_DIR@/mod_unixd.so +@IF_HAVE_PHP@PHPIniDir . + DirectoryIndex index.txt TypesConfig /dev/null AddType application/x-httpd-php .php diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..119bf166 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,195 @@ +test_utils_name = 'test-utils' +installed_tests_metadir = join_paths(get_option('datadir'), 'installed-tests', libsoup_api_name) +installed_tests_execdir = join_paths(get_option('libexecdir'), 'installed-tests', libsoup_api_name) +installed_tests_enabled = get_option('installed_tests') +installed_tests_template_tap = files('template-tap.test.in') +abs_installed_tests_execdir = join_paths(prefix, installed_tests_execdir) + +if cc.get_id() == 'msvc' + test_utils = static_library(test_utils_name, test_utils_name + '.c', + dependencies : libsoup_dep) +else + test_utils = library(test_utils_name, test_utils_name + '.c', + dependencies : libsoup_dep, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, + ) +endif + +test_resources = gnome.compile_resources('soup-tests', + 'soup-tests.gresource.xml', + gresource_bundle : true, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, +) + +# ['name', is_parallel, extra_deps] +tests = [ + ['cache', true, []], + ['chunk', true, []], + ['chunk-io', true, []], + ['coding', true, []], + ['context', true, []], + ['continue', true, []], + ['cookies', true, []], + ['date', true, []], + ['forms', true, []], + ['header-parsing', true, []], + ['hsts', true, []], + ['hsts-db', true, []], + ['misc', true, []], + ['multipart', true, []], + ['no-ssl', true, []], + ['ntlm', true, []], + ['redirect', true, []], + ['requester', true, []], + ['resource', true, []], + ['samesite', true, []], + ['session', true, []], + ['server-auth', true, []], + ['server', true, []], + ['sniffing', true, []], + ['socket', true, []], + ['ssl', true, []], + ['streaming', true, []], + ['timeout', true, []], + ['tld', true, []], + ['uri-parsing', true, []], + ['websocket', true, [libz_dep]] +] + +if brotlidec_dep.found() + tests += [ + ['brotli-decompressor', true, []], + ] + + if installed_tests_enabled + install_data( + 'brotli-data/compressed.br', + 'brotli-data/corrupt.br', + 'brotli-data/uncompressed.txt', + install_dir : join_paths(installed_tests_execdir, 'brotli-data'), + ) + endif +endif + +if have_apache + tests += [ + ['auth', false, []], + ['connection', false, []], + ['range', false, []], + ['proxy', false, []], + ['pull-api', false, []], + ] + + configure_file(output : 'httpd.conf', + input : 'httpd.conf.in', + configuration : cdata, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, + ) + + configure_file(input : 'htdigest', + output : 'htdigest', + copy : true) + configure_file(input : 'htpasswd', + output : 'htpasswd', + copy : true) + configure_file(input : 'index.txt', + output : 'index.txt', + copy : true) + configure_file(input : 'test-cert.pem', + output : 'test-cert.pem', + copy : true) + configure_file(input : 'test-key.pem', + output : 'test-key.pem', + copy : true) + + if installed_tests_enabled + install_data( + 'index.txt', + 'test-cert.pem', + 'test-key.pem', + 'htdigest', + 'htpasswd', + install_dir : installed_tests_execdir, + ) + endif +endif + +if have_php + configure_file(output : 'php.ini', + input : 'php.ini.in', + configuration : cdata, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, + ) +endif + +if have_php_xmlrpc + tests += [ + ['xmlrpc-old-server', true, []], + ['xmlrpc-old', false, []], + ['xmlrpc-server', true, []], + ['xmlrpc', false, []] + ] + + configure_file(input : 'xmlrpc-server.php', + output : 'xmlrpc-server.php', + copy : true) + + if installed_tests_enabled + install_data( + 'xmlrpc-server.php', + install_dir : installed_tests_execdir, + ) + endif +endif + +env = environment() +env.set('G_TEST_SRCDIR', meson.current_source_dir()) +env.set('G_TEST_BUILDDIR', meson.current_build_dir()) +env.set('G_DEBUG', 'gc-friendly') +# See https://github.com/mesonbuild/meson/issues/1383 for the workaround below +env.prepend('LD_LIBRARY_PATH', meson.build_root() + '/libsoup') +env.set('MALLOC_CHECK_', '2') +# This is set by Meson if empty +env.set('MALLOC_PERTURB_', '') + +foreach test: tests + test_name = '@0@-test'.format(test[0]) + + if installed_tests_enabled + test_conf = configuration_data() + test_conf.set('installed_tests_dir', abs_installed_tests_execdir) + test_conf.set('program', test_name) + test_conf.set('env', '') + test_conf.set('type', test[1] ? 'session' : 'session-exclusive') + configure_file( + input : installed_tests_template_tap, + output : test_name + '.test', + install_dir : installed_tests_metadir, + configuration : test_conf, + ) + endif + + test_deps = [ libsoup_dep ] + test[2] + test_target = executable(test_name, + sources : [ test_name + '.c', test_resources ], + link_with : test_utils, + dependencies : test_deps, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, + install_rpath : abs_installed_tests_execdir, + ) + # Increase the timeout as on some architectures the tests could be slower + # than the default 30 seconds. + test(test_name, test_target, env : env, is_parallel : test[1], timeout : 60) +endforeach + +executable('ntlm-test-helper', 'ntlm-test-helper.c', + dependencies : libsoup_dep, + install : installed_tests_enabled, + install_dir : installed_tests_execdir, + install_rpath : abs_installed_tests_execdir, +) diff --git a/tests/multipart-test.c b/tests/multipart-test.c index 488865ae..64a5ebff 100644 --- a/tests/multipart-test.c +++ b/tests/multipart-test.c @@ -6,10 +6,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> #include "test-utils.h" +#ifndef G_OS_WIN32 +#include <unistd.h> +#endif + #define READ_BUFFER_SIZE 8192 typedef enum { diff --git a/tests/ntlm-test.c b/tests/ntlm-test.c index 0cc41a7b..dcacd74e 100644 --- a/tests/ntlm-test.c +++ b/tests/ntlm-test.c @@ -26,8 +26,17 @@ static const char *state_name[] = { #define NTLM_REQUEST_START "TlRMTVNTUAABAAAA" #define NTLM_RESPONSE_START "TlRMTVNTUAADAAAA" -#define NTLM_CHALLENGE "TlRMTVNTUAACAAAADAAMADAAAAABAoEAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=" -#define NTLMSSP_CHALLENGE "TlRMTVNTUAACAAAADAAMADAAAAABAokAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=" +/* + * NTLMV1_CHALLENGE - does not have "Negotiate Target Info" nor "Negotiate NTLM2 Key flags" + * NTLMV2_CHALLENGE - "Negotiate Target Info" flag is set + * NTLMSSP_CHALLENGE - "Negotiate NTLM2 Key" flag is set + */ +#define NTLMV1_CHALLENGE "TlRMTVNTUAACAAAADAAMADAAAAABAgEAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=" +#define NTLMV2_CHALLENGE "TlRMTVNTUAACAAAADAAMADAAAAABAoEAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=" +#define NTLMSSP_CHALLENGE "TlRMTVNTUAACAAAADAAMADAAAAABAgkAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=" + +#define NTLM_RESPONSE_FLAGS_OFFSET 60 +#define NTLM_FLAGS_REQUEST_TARGET 0x00000004 #define NTLM_RESPONSE_USER(response) ((response)[86] == 'E' ? NTLM_AUTHENTICATED_ALICE : ((response)[86] == 'I' ? NTLM_AUTHENTICATED_BOB : NTLM_UNAUTHENTICATED)) @@ -36,6 +45,7 @@ typedef struct { GHashTable *connections; SoupURI *uri; gboolean ntlmssp; + gboolean ntlmv2; } TestServer; static void @@ -127,7 +137,7 @@ server_callback (SoupServer *server, SoupMessage *msg, if (ntlm_allowed && state == NTLM_RECEIVED_REQUEST) { soup_message_headers_append (msg->response_headers, "WWW-Authenticate", - ts->ntlmssp ? ("NTLM " NTLMSSP_CHALLENGE) : ("NTLM " NTLM_CHALLENGE)); + ts->ntlmssp ? ("NTLM " NTLMSSP_CHALLENGE) : ts->ntlmv2 ? ("NTLM " NTLMV2_CHALLENGE) : ("NTLM " NTLMV1_CHALLENGE)); state = NTLM_SENT_CHALLENGE; } else if (ntlm_allowed) { soup_message_headers_append (msg->response_headers, @@ -158,6 +168,7 @@ setup_server (TestServer *ts, ts->server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); ts->connections = g_hash_table_new (NULL, NULL); ts->ntlmssp = FALSE; + ts->ntlmv2 = FALSE; soup_server_add_handler (ts->server, NULL, server_callback, ts, NULL); ts->uri = soup_test_server_get_uri (ts->server, "http", NULL); @@ -172,6 +183,14 @@ setup_ntlmssp_server (TestServer *ts, } static void +setup_ntlmv2_server (TestServer *ts, + gconstpointer test_data) +{ + setup_server (ts, test_data); + ts->ntlmv2 = TRUE; +} + +static void teardown_server (TestServer *ts, gconstpointer test_data) { @@ -213,8 +232,9 @@ prompt_check (SoupMessage *msg, gpointer user_data) if (header && strstr (header, "Basic ")) state->got_basic_prompt = TRUE; if (header && strstr (header, "NTLM") && - (!strstr (header, NTLM_CHALLENGE) && - !strstr (header, NTLMSSP_CHALLENGE))) { + (!strstr (header, NTLMV1_CHALLENGE) && + !strstr (header, NTLMSSP_CHALLENGE) && + !strstr (header, NTLMV2_CHALLENGE))) { state->got_ntlm_prompt = TRUE; } } @@ -249,12 +269,37 @@ response_check (SoupMessage *msg, gpointer user_data) { NTLMState *state = user_data; const char *header; + guchar *ntlm_data; + gsize ntlm_data_sz; + gboolean request_target; + guint32 flags; + int nt_resp_sz; header = soup_message_headers_get_one (msg->request_headers, "Authorization"); if (header && !strncmp (header, "NTLM " NTLM_RESPONSE_START, strlen ("NTLM " NTLM_RESPONSE_START))) - state->sent_ntlm_response = TRUE; + { + ntlm_data = g_base64_decode (header + 5, &ntlm_data_sz); + + memcpy (&flags, ntlm_data + NTLM_RESPONSE_FLAGS_OFFSET, sizeof(flags)); + flags = GUINT_FROM_LE (flags); + request_target = (flags & NTLM_FLAGS_REQUEST_TARGET) ? TRUE : FALSE; + nt_resp_sz = ntlm_data[22] | ntlm_data[23] << 8; + + /* + * If the "Request Target" flag is not set in response, it should return NTLMv1 or NTLM2 Session Response, + * they both should return exactly 24-byte NT response. + * If the "Request Target" flag is set, it should return NTLMv2 reponse, + * which has NT response always over 24 bytes. + */ + if ((!request_target && nt_resp_sz == 24) || (request_target && nt_resp_sz > 24)) + { + state->sent_ntlm_response = TRUE; + } + + g_free (ntlm_data); + } if (header && !strncmp (header, "Basic ", 6)) state->sent_basic_response = TRUE; } @@ -505,6 +550,13 @@ static const NtlmTest ntlmssp_tests[] = { { "/ntlm/ssp/basic", "alice", FALSE, BUILTIN } }; +static const NtlmTest ntlmv2_tests[] = { + { "/ntlm/v2/none", NULL, FALSE, BUILTIN }, + { "/ntlm/v2/alice", "alice", TRUE, BUILTIN }, + { "/ntlm/v2/bob", "bob", TRUE, BUILTIN }, + { "/ntlm/v2/basic", "alice", FALSE, BUILTIN } +}; + static void do_ntlm_test (TestServer *ts, gconstpointer data) @@ -648,6 +700,10 @@ main (int argc, char **argv) g_test_add (ntlmssp_tests[i].name, TestServer, &ntlmssp_tests[i], setup_ntlmssp_server, do_ntlm_test, teardown_server); } + for (i = 0; i < G_N_ELEMENTS (ntlmv2_tests); i++) { + g_test_add (ntlmv2_tests[i].name, TestServer, &ntlmv2_tests[i], + setup_ntlmv2_server, do_ntlm_test, teardown_server); + } g_test_add ("/ntlm/retry", TestServer, NULL, setup_server, do_retrying_test, teardown_server); diff --git a/tests/php.ini.in b/tests/php.ini.in new file mode 100644 index 00000000..0f49c94d --- /dev/null +++ b/tests/php.ini.in @@ -0,0 +1 @@ +@IF_HAVE_PHP_XMLRPC@extension=xmlrpc diff --git a/tests/pull-api.c b/tests/pull-api-test.c index 2915b9e4..55503786 100644 --- a/tests/pull-api.c +++ b/tests/pull-api-test.c @@ -12,7 +12,7 @@ authenticate (SoupSession *session, SoupMessage *msg, soup_auth_authenticate (auth, "user2", "realm2"); } -#if HAVE_APACHE +#ifdef HAVE_APACHE static void get_correct_response (const char *uri) { @@ -514,7 +514,7 @@ main (int argc, char **argv) apache_init (); base_uri = "http://127.0.0.1:47524/"; -#if HAVE_APACHE +#ifdef HAVE_APACHE get_correct_response (base_uri); #endif @@ -524,7 +524,7 @@ main (int argc, char **argv) ret = g_test_run (); -#if HAVE_APACHE +#ifdef HAVE_APACHE soup_buffer_free (correct_response); #endif diff --git a/tests/samesite-test.c b/tests/samesite-test.c new file mode 100644 index 00000000..0b081b2b --- /dev/null +++ b/tests/samesite-test.c @@ -0,0 +1,132 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +#include "test-utils.h" + +typedef struct { + SoupURI *origin_uri; + SoupURI *cross_uri; + SoupCookieJar *jar; + GSList *cookies; +} SameSiteFixture; + +static void +same_site_setup (SameSiteFixture *fixture, + gconstpointer data) +{ + SoupCookie *cookie_none, *cookie_lax, *cookie_strict; + + fixture->origin_uri = soup_uri_new ("http://127.0.0.1"); + fixture->cross_uri = soup_uri_new ("http://localhost"); + fixture->jar = soup_cookie_jar_new (); + + cookie_none = soup_cookie_new ("none", "1", "127.0.0.1", "/", 1000); + cookie_lax = soup_cookie_new ("lax", "1", "127.0.0.1", "/", 1000); + soup_cookie_set_same_site_policy (cookie_lax, SOUP_SAME_SITE_POLICY_LAX); + cookie_strict = soup_cookie_new ("strict", "1", "127.0.0.1", "/", 1000); + soup_cookie_set_same_site_policy (cookie_strict, SOUP_SAME_SITE_POLICY_STRICT); + + soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_none); + soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_lax); + soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_strict); +} + +static void +same_site_teardown (SameSiteFixture *fixture, + gconstpointer data) +{ + g_object_unref (fixture->jar); + soup_uri_free (fixture->origin_uri); + soup_uri_free (fixture->cross_uri); + g_slist_free_full (fixture->cookies, (GDestroyNotify) soup_cookie_free); +} + +static void +assert_highest_policy_visible (GSList *cookies, SoupSameSitePolicy policy) +{ + GSList *l; + size_t size = 0, expected_count; + for (l = cookies; l; l = l->next) { + g_assert_cmpint (soup_cookie_get_same_site_policy (l->data), <=, policy); + ++size; + } + + switch (policy) { + case SOUP_SAME_SITE_POLICY_STRICT: + expected_count = 3; + break; + case SOUP_SAME_SITE_POLICY_LAX: + expected_count = 2; + break; + case SOUP_SAME_SITE_POLICY_NONE: + expected_count = 1; + break; + } + + g_assert_cmpuint (size, ==, expected_count); +} + +typedef struct { + const char *name; + gboolean cross_origin; + gboolean cookie_uri_is_origin; + gboolean top_level_nav; + gboolean javascript; + gboolean unsafe_method; + SoupSameSitePolicy visible_policy; +} SameSiteTest; + +static void +same_site_test (SameSiteFixture *fixture, gconstpointer user_data) +{ + const SameSiteTest *test = user_data; + fixture->cookies = soup_cookie_jar_get_cookie_list_with_same_site_info (fixture->jar, fixture->origin_uri, + test->cross_origin ? fixture->cross_uri : fixture->origin_uri, + test->cookie_uri_is_origin ? fixture->origin_uri : NULL, + test->javascript ? FALSE : TRUE, + !test->unsafe_method, + test->top_level_nav); + assert_highest_policy_visible (fixture->cookies, test->visible_policy); +} + +int +main (int argc, char **argv) +{ + int ret, i; + SameSiteTest same_site_tests[] = { + /* This does not necessarily cover all combinations since some make no sense in real use */ + + /* Situations where Strict are passed: */ + { .name="/same-site/basic", .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/basic-js", .javascript=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/top-level-to-same-site", .top_level_nav=TRUE, .cookie_uri_is_origin=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/top-level-to-same-site-js", .top_level_nav=TRUE, .cookie_uri_is_origin=TRUE, .javascript=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/unsafe-method", .unsafe_method=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/unsafe-method-js", .unsafe_method=TRUE, .javascript=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/cross-top-level-to-same-site", .cross_origin=TRUE, .top_level_nav=TRUE, .cookie_uri_is_origin=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + { .name="/same-site/cross-top-level-to-same-site-js", .cross_origin=TRUE, .javascript=TRUE, .top_level_nav=TRUE, .cookie_uri_is_origin=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_STRICT }, + + /* Situations where Lax are passed: */ + { .name="/same-site/top-level", .top_level_nav=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_LAX }, + { .name="/same-site/top-level-js", .top_level_nav=TRUE, .javascript=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_LAX }, + { .name="/same-site/cross-top-level", .cross_origin=TRUE, .top_level_nav=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_LAX }, + { .name="/same-site/cross-top-level-js", .cross_origin=TRUE, .javascript=TRUE, .top_level_nav=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_LAX }, + { .name="/same-site/cross-unsafe-method-top-level-js", .cross_origin=TRUE, .javascript=TRUE, .unsafe_method=TRUE, .top_level_nav=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_LAX }, + + /* All same-site blocked: */ + { .name="/same-site/cross-basic", .cross_origin=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_NONE }, + { .name="/same-site/cross-basic-js", .cross_origin=TRUE, .javascript=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_NONE }, + { .name="/same-site/cross-unsafe-method", .cross_origin=TRUE, .unsafe_method=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_NONE }, + { .name="/same-site/cross-unsafe-method-js", .cross_origin=TRUE, .javascript=TRUE, .unsafe_method=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_NONE }, + { .name="/same-site/cross-unsafe-method-top-level", .cross_origin=TRUE, .unsafe_method=TRUE, .top_level_nav=TRUE, .visible_policy=SOUP_SAME_SITE_POLICY_NONE }, + }; + + test_init (argc, argv, NULL); + + for (i = 0; i < G_N_ELEMENTS (same_site_tests); ++i) + g_test_add (same_site_tests[i].name, SameSiteFixture, &same_site_tests[i], + same_site_setup, same_site_test, same_site_teardown); + + ret = g_test_run (); + test_cleanup (); + return ret; +} diff --git a/tests/server-test.c b/tests/server-test.c index cf132b33..8976103e 100644 --- a/tests/server-test.c +++ b/tests/server-test.c @@ -275,6 +275,72 @@ do_dot_dot_test (ServerData *sd, gconstpointer test_data) soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); g_object_unref (msg); + uri = soup_uri_new_with_base (sd->base_uri, "/%2e%2e%2ftest"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + +#ifdef G_OS_WIN32 + uri = soup_uri_new_with_base (sd->base_uri, "\\..%5Ctest"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "\\../test"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "%5C..%2ftest"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "/..\\test"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "%2f..%5Ctest"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "\\%2e%2e%5ctest"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); + + uri = soup_uri_new_with_base (sd->base_uri, "\\..%%35%63..%%35%63test"); + msg = soup_message_new_from_uri ("GET", uri); + soup_uri_free (uri); + + soup_session_send_message (session, msg); + soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST); + g_object_unref (msg); +#endif + soup_test_session_abort_unref (session); } diff --git a/tests/socket-test.c b/tests/socket-test.c index 5b2b390e..10229ffc 100644 --- a/tests/socket-test.c +++ b/tests/socket-test.c @@ -10,6 +10,10 @@ #include <fcntl.h> #include <gio/gnetworking.h> +#ifdef G_OS_WIN32 +#include <io.h> +#endif + static void do_unconnected_socket_test (void) { diff --git a/tests/template-tap.test.in b/tests/template-tap.test.in new file mode 100644 index 00000000..b84de717 --- /dev/null +++ b/tests/template-tap.test.in @@ -0,0 +1,4 @@ +[Test] +Type=@type@ +Exec=@env@@installed_tests_dir@/@program@ --tap +Output=TAP diff --git a/tests/test-utils.c b/tests/test-utils.c index 9c742060..bd1bab05 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -239,9 +239,13 @@ soup_test_session_new (GType type, ...) va_end (args); if (tls_available) { + char *abs_cafile; + cafile = g_test_build_filename (G_TEST_DIST, "test-cert.pem", NULL); - tlsdb = g_tls_file_database_new (cafile, &error); + abs_cafile = g_canonicalize_filename (cafile, NULL); g_free (cafile); + tlsdb = g_tls_file_database_new (abs_cafile, &error); + g_free (abs_cafile); if (error) { if (g_strcmp0 (g_getenv ("GIO_USE_TLS"), "dummy") == 0) g_clear_error (&error); @@ -676,9 +680,11 @@ soup_test_request_read_all (SoupRequest *req, if (!SOUP_IS_SESSION_SYNC (soup_request_get_session (req))) data.loop = g_main_loop_new (g_main_context_get_thread_default (), FALSE); + else + data.loop = NULL; do { - if (SOUP_IS_SESSION_SYNC (soup_request_get_session (req))) { + if (!data.loop) { nread = g_input_stream_read (stream, buf, sizeof (buf), cancellable, error); } else { @@ -691,7 +697,7 @@ soup_test_request_read_all (SoupRequest *req, } } while (nread > 0); - if (!SOUP_IS_SESSION_SYNC (soup_request_get_session (req))) + if (data.loop) g_main_loop_unref (data.loop); return nread == 0; diff --git a/tests/tld-test.c b/tests/tld-test.c index 31cbb4b8..93b9481c 100644 --- a/tests/tld-test.c +++ b/tests/tld-test.c @@ -22,6 +22,9 @@ static struct { { ".example", NULL, SOUP_TLD_ERROR_INVALID_HOSTNAME }, { ".example.com", NULL, SOUP_TLD_ERROR_INVALID_HOSTNAME }, { ".example.example", NULL, SOUP_TLD_ERROR_INVALID_HOSTNAME }, + /* Trailing dot. */ + { ".com.", NULL, SOUP_TLD_ERROR_INVALID_HOSTNAME }, + { "domain.biz.", "domain.biz.", -1 }, /* TLD with only 1 rule. */ { "biz", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, { "domain.biz", "domain.biz", -1 }, @@ -38,10 +41,10 @@ static struct { { "a.b.example.uk.com", "example.uk.com", -1 }, { "test.ac", "test.ac", -1 }, /* TLD with only 1 (wildcard) rule. */ - { "bn", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, - { "c.bn", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, - { "b.c.bn", "b.c.bn", -1 }, - { "a.b.c.bn", "b.c.bn", -1 }, + { "bd", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, + { "c.bd", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, + { "b.c.bd", "b.c.bd", -1 }, + { "a.b.c.bd", "b.c.bd", -1 }, /* More complex TLD. */ { "jp", NULL, SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS }, { "test.jp", "test.jp", -1 }, diff --git a/tests/uri-parsing.c b/tests/uri-parsing-test.c index 85f09b9e..85f09b9e 100644 --- a/tests/uri-parsing.c +++ b/tests/uri-parsing-test.c diff --git a/tests/websocket-test.c b/tests/websocket-test.c index 722ccbdf..5e40cf36 100644 --- a/tests/websocket-test.c +++ b/tests/websocket-test.c @@ -20,6 +20,8 @@ #include "test-utils.h" +#include <zlib.h> + typedef struct { GSocket *listener; gushort port; @@ -35,6 +37,11 @@ typedef struct { gboolean no_server; GIOStream *raw_server; + gboolean enable_extensions; + gboolean disable_deflate_in_message; + + GList *initial_cookies; + GMutex mutex; } Test; @@ -100,15 +107,26 @@ direct_connection_complete (GObject *object, GSocketConnection *conn; SoupURI *uri; GError *error = NULL; + GList *extensions = NULL; conn = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (object), result, &error); g_assert_no_error (error); uri = soup_uri_new ("http://127.0.0.1/"); - test->client = soup_websocket_connection_new (G_IO_STREAM (conn), uri, - SOUP_WEBSOCKET_CONNECTION_CLIENT, - NULL, NULL); + if (test->enable_extensions) { + SoupWebsocketExtension *extension; + + extension = g_object_new (SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE, NULL); + g_assert_true (soup_websocket_extension_configure (extension, + SOUP_WEBSOCKET_CONNECTION_CLIENT, + NULL, NULL)); + extensions = g_list_prepend (extensions, extension); + } + test->client = soup_websocket_connection_new_with_extensions (G_IO_STREAM (conn), uri, + SOUP_WEBSOCKET_CONNECTION_CLIENT, + NULL, NULL, + extensions); soup_uri_free (uri); g_object_unref (conn); } @@ -122,6 +140,7 @@ got_connection (GSocket *listener, GSocket *sock; GSocketConnection *conn; SoupURI *uri; + GList *extensions = NULL; GError *error = NULL; sock = g_socket_accept (listener, NULL, &error); @@ -135,9 +154,19 @@ got_connection (GSocket *listener, test->raw_server = G_IO_STREAM (conn); else { uri = soup_uri_new ("http://127.0.0.1/"); - test->server = soup_websocket_connection_new (G_IO_STREAM (conn), uri, - SOUP_WEBSOCKET_CONNECTION_SERVER, - NULL, NULL); + if (test->enable_extensions) { + SoupWebsocketExtension *extension; + + extension = g_object_new (SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE, NULL); + g_assert_true (soup_websocket_extension_configure (extension, + SOUP_WEBSOCKET_CONNECTION_SERVER, + NULL, NULL)); + extensions = g_list_prepend (extensions, extension); + } + test->server = soup_websocket_connection_new_with_extensions (G_IO_STREAM (conn), uri, + SOUP_WEBSOCKET_CONNECTION_SERVER, + NULL, NULL, + extensions); soup_uri_free (uri); g_object_unref (conn); } @@ -171,6 +200,14 @@ setup_direct_connection (Test *test, } static void +setup_direct_connection_with_extensions (Test *test, + gconstpointer data) +{ + test->enable_extensions = TRUE; + setup_direct_connection (test, data); +} + +static void setup_half_direct_connection (Test *test, gconstpointer data) { @@ -179,6 +216,14 @@ setup_half_direct_connection (Test *test, } static void +setup_half_direct_connection_with_extensions (Test *test, + gconstpointer data) +{ + test->no_server = TRUE; + setup_direct_connection_with_extensions (test, data); +} + +static void teardown_direct_connection (Test *test, gconstpointer data) { @@ -200,6 +245,8 @@ setup_soup_server (Test *test, setup_listener (test); test->soup_server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + if (!test->enable_extensions) + soup_server_remove_websocket_extension (test->soup_server, SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE); soup_server_listen_socket (test->soup_server, test->listener, 0, &error); g_assert_no_error (error); @@ -216,12 +263,25 @@ client_connect (Test *test, gpointer user_data) { char *url; + SoupCookieJar *jar; + GList *l; + + test->session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); + if (test->enable_extensions) + soup_session_add_feature_by_type (test->session, SOUP_TYPE_WEBSOCKET_EXTENSION_MANAGER); - if (!test->session) - test->session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); + jar = soup_cookie_jar_new (); + soup_cookie_jar_set_accept_policy (jar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); + soup_session_add_feature (test->session, SOUP_SESSION_FEATURE (jar)); + for (l = test->initial_cookies; l; l = g_list_next (l)) + soup_cookie_jar_add_cookie (jar, (SoupCookie *)l->data); + g_clear_pointer (&test->initial_cookies, g_list_free); + g_object_unref (jar); url = g_strdup_printf ("ws://127.0.0.1:%u/unix", test->port); test->msg = soup_message_new ("GET", url); + if (test->disable_deflate_in_message) + soup_message_disable_feature (test->msg, SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE); g_free (url); soup_session_websocket_connect_async (test->session, test->msg, @@ -264,6 +324,14 @@ setup_soup_connection (Test *test, } static void +setup_soup_connection_with_extensions (Test *test, + gconstpointer data) +{ + test->enable_extensions = TRUE; + setup_soup_connection (test, data); +} + +static void teardown_soup_connection (Test *test, gconstpointer data) { @@ -292,6 +360,21 @@ on_text_message (SoupWebsocketConnection *ws, } static void +on_binary_message (SoupWebsocketConnection *ws, + SoupWebsocketDataType type, + GBytes *message, + gpointer user_data) +{ + GBytes **receive = user_data; + + g_assert_cmpint (type, ==, SOUP_WEBSOCKET_DATA_BINARY); + g_assert (*receive == NULL); + g_assert (message != NULL); + + *receive = g_bytes_ref (message); +} + +static void on_close_set_flag (SoupWebsocketConnection *ws, gpointer user_data) { @@ -308,15 +391,86 @@ test_handshake (Test *test, gconstpointer data) { g_assert_cmpint (soup_websocket_connection_get_state (test->client), ==, SOUP_WEBSOCKET_STATE_OPEN); + if (test->enable_extensions) { + GList *extensions = soup_websocket_connection_get_extensions (test->client); + + g_assert_nonnull (extensions); + g_assert_cmpuint (g_list_length (extensions), ==, 1); + g_assert (SOUP_IS_WEBSOCKET_EXTENSION_DEFLATE (extensions->data)); + } else { + g_assert_null (soup_websocket_connection_get_extensions (test->client)); + } + g_assert_cmpint (soup_websocket_connection_get_state (test->server), ==, SOUP_WEBSOCKET_STATE_OPEN); + if (test->enable_extensions) { + GList *extensions = soup_websocket_connection_get_extensions (test->server); + + g_assert_nonnull (extensions); + g_assert_cmpuint (g_list_length (extensions), ==, 1); + g_assert (SOUP_IS_WEBSOCKET_EXTENSION_DEFLATE (extensions->data)); + } else { + g_assert_null (soup_websocket_connection_get_extensions (test->server)); + } + +} + +static void +websocket_server_request_started (SoupServer *server, SoupMessage *msg, + SoupClientContext *client, gpointer user_data) +{ + soup_message_headers_append (msg->response_headers, "Sec-WebSocket-Extensions", "x-foo"); +} + +static void +request_unqueued (SoupSession *session, + SoupMessage *msg, + gpointer data) +{ + Test *test = data; + + if (test->msg == msg) + g_clear_object (&test->msg); +} + + +static void +test_handshake_unsupported_extension (Test *test, + gconstpointer data) +{ + char *url; + + setup_listener (test); + test->soup_server = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD); + soup_server_listen_socket (test->soup_server, test->listener, 0, NULL); + g_signal_connect (test->soup_server, "request-started", + G_CALLBACK (websocket_server_request_started), + NULL); + soup_server_add_websocket_handler (test->soup_server, "/unix", NULL, NULL, + got_server_connection, test, NULL); + + test->session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); + g_signal_connect (test->session, "request-unqueued", + G_CALLBACK (request_unqueued), + test); + url = g_strdup_printf ("ws://127.0.0.1:%u/unix", test->port); + test->msg = soup_message_new ("GET", url); + g_free (url); + + soup_session_websocket_connect_async (test->session, test->msg, NULL, NULL, NULL, + got_client_connection, test); + WAIT_UNTIL (test->server != NULL); + WAIT_UNTIL (test->msg == NULL); + g_assert_error (test->client_error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE); } #define TEST_STRING "this is a test" +#define TEST_STRING_WITH_NULL "this is\0 a test" static void test_send_client_to_server (Test *test, gconstpointer data) { + GBytes *sent; GBytes *received = NULL; const char *contents; gsize len; @@ -331,14 +485,23 @@ test_send_client_to_server (Test *test, contents = g_bytes_get_data (received, &len); g_assert_cmpstr (contents, ==, TEST_STRING); g_assert_cmpint (len, ==, strlen (TEST_STRING)); + g_clear_pointer (&received, g_bytes_unref); - g_bytes_unref (received); + sent = g_bytes_new_static (TEST_STRING_WITH_NULL, sizeof (TEST_STRING_WITH_NULL)); + soup_websocket_connection_send_message (test->client, SOUP_WEBSOCKET_DATA_TEXT, sent); + + WAIT_UNTIL (received != NULL); + + g_assert (g_bytes_equal (sent, received)); + g_clear_pointer (&sent, g_bytes_unref); + g_clear_pointer (&received, g_bytes_unref); } static void test_send_server_to_client (Test *test, gconstpointer data) { + GBytes *sent; GBytes *received = NULL; const char *contents; gsize len; @@ -353,8 +516,16 @@ test_send_server_to_client (Test *test, contents = g_bytes_get_data (received, &len); g_assert_cmpstr (contents, ==, TEST_STRING); g_assert_cmpint (len, ==, strlen (TEST_STRING)); + g_clear_pointer (&received, g_bytes_unref); - g_bytes_unref (received); + sent = g_bytes_new_static (TEST_STRING_WITH_NULL, sizeof (TEST_STRING_WITH_NULL)); + soup_websocket_connection_send_message (test->server, SOUP_WEBSOCKET_DATA_TEXT, sent); + + WAIT_UNTIL (received != NULL); + + g_assert (g_bytes_equal (sent, received)); + g_clear_pointer (&sent, g_bytes_unref); + g_clear_pointer (&received, g_bytes_unref); } static void @@ -396,6 +567,37 @@ test_send_big_packets (Test *test, } static void +test_send_empty_packets (Test *test, + gconstpointer data) +{ + GBytes *received = NULL; + gulong id; + + id = g_signal_connect (test->client, "message", G_CALLBACK (on_text_message), &received); + + soup_websocket_connection_send_text (test->server, "\0"); + WAIT_UNTIL (received != NULL); + g_assert_nonnull (g_bytes_get_data (received, NULL)); + g_assert_cmpuint (((char *) g_bytes_get_data (received, NULL))[0], ==, '\0'); + g_assert_cmpuint (g_bytes_get_size (received), ==, 0); + g_bytes_unref (received); + received = NULL; + g_signal_handler_disconnect (test->client, id); + + id = g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); + + soup_websocket_connection_send_binary (test->server, NULL, 0); + WAIT_UNTIL (received != NULL); + /* We always include at least a null character */ + g_assert_nonnull (g_bytes_get_data (received, NULL)); + g_assert_cmpuint (((char *) g_bytes_get_data (received, NULL))[0], ==, '\0'); + g_assert_cmpuint (g_bytes_get_size (received), ==, 0); + g_bytes_unref (received); + received = NULL; + g_signal_handler_disconnect (test->client, id); +} + +static void test_send_bad_data (Test *test, gconstpointer unused) { @@ -403,24 +605,27 @@ test_send_bad_data (Test *test, GIOStream *io; gsize written; const char *frame; + gboolean close_event = FALSE; g_signal_handlers_disconnect_by_func (test->server, on_error_not_reached, NULL); g_signal_connect (test->server, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event); io = soup_websocket_connection_get_io_stream (test->client); /* Bad UTF-8 frame */ - frame = "\x81\x04\xEE\xEE\xEE\xEE"; + frame = "\x81\x84\x00\x00\x00\x00\xEE\xEE\xEE\xEE"; if (!g_output_stream_write_all (g_io_stream_get_output_stream (io), - frame, 6, &written, NULL, NULL)) + frame, 10, &written, NULL, NULL)) g_assert_not_reached (); - g_assert_cmpuint (written, ==, 6); + g_assert_cmpuint (written, ==, 10); WAIT_UNTIL (error != NULL); g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_BAD_DATA); g_clear_error (&error); WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); + g_assert (close_event); g_assert_cmpuint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_BAD_DATA); } @@ -616,9 +821,28 @@ test_protocol_client_any_soup (Test *test, g_assert_cmpstr (soup_message_headers_get_one (test->msg->response_headers, "Sec-WebSocket-Protocol"), ==, NULL); } +static const struct { + gushort code; + const char *reason; + gushort expected_sender_code; + const char *expected_sender_reason; + gushort expected_receiver_code; + const char *expected_receiver_reason; +} close_clean_tests[] = { + { SOUP_WEBSOCKET_CLOSE_NORMAL, "NORMAL", SOUP_WEBSOCKET_CLOSE_NORMAL, "NORMAL", SOUP_WEBSOCKET_CLOSE_NORMAL, "NORMAL" }, + { SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "GOING_AWAY", SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "GOING_AWAY", SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "GOING_AWAY" }, + { SOUP_WEBSOCKET_CLOSE_NORMAL, NULL, SOUP_WEBSOCKET_CLOSE_NORMAL, NULL, SOUP_WEBSOCKET_CLOSE_NORMAL, NULL }, + { SOUP_WEBSOCKET_CLOSE_NO_STATUS, NULL, SOUP_WEBSOCKET_CLOSE_NORMAL, NULL, SOUP_WEBSOCKET_CLOSE_NO_STATUS, NULL }, +}; + static void -test_close_clean_client (Test *test, - gconstpointer data) +do_close_clean_client (Test *test, + gushort code, + const char *reason, + gushort expected_sender_code, + const char *expected_sender_reason, + gushort expected_receiver_code, + const char *expected_receiver_reason) { gboolean close_event_client = FALSE; gboolean close_event_server = FALSE; @@ -626,7 +850,7 @@ test_close_clean_client (Test *test, g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event_client); g_signal_connect (test->server, "closed", G_CALLBACK (on_close_set_flag), &close_event_server); - soup_websocket_connection_close (test->client, SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "give me a reason"); + soup_websocket_connection_close (test->client, code, reason); g_assert_cmpint (soup_websocket_connection_get_state (test->client), ==, SOUP_WEBSOCKET_STATE_CLOSING); WAIT_UNTIL (soup_websocket_connection_get_state (test->server) == SOUP_WEBSOCKET_STATE_CLOSED); @@ -635,14 +859,62 @@ test_close_clean_client (Test *test, g_assert (close_event_client); g_assert (close_event_server); - g_assert_cmpint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_GOING_AWAY); - g_assert_cmpint (soup_websocket_connection_get_close_code (test->server), ==, SOUP_WEBSOCKET_CLOSE_GOING_AWAY); - g_assert_cmpstr (soup_websocket_connection_get_close_data (test->server), ==, "give me a reason"); + g_assert_cmpint (soup_websocket_connection_get_close_code (test->client), ==, expected_sender_code); + g_assert_cmpstr (soup_websocket_connection_get_close_data (test->client), ==, expected_sender_reason); + g_assert_cmpint (soup_websocket_connection_get_close_code (test->server), ==, expected_receiver_code); + g_assert_cmpstr (soup_websocket_connection_get_close_data (test->server), ==, expected_receiver_reason); } static void -test_close_clean_server (Test *test, - gconstpointer data) +test_close_clean_client_soup (Test *test, + gconstpointer data) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (close_clean_tests); i++) { + setup_soup_connection (test, data); + + do_close_clean_client (test, + close_clean_tests[i].code, + close_clean_tests[i].reason, + close_clean_tests[i].expected_sender_code, + close_clean_tests[i].expected_sender_reason, + close_clean_tests[i].expected_receiver_code, + close_clean_tests[i].expected_receiver_reason); + + teardown_soup_connection (test, data); + } +} + +static void +test_close_clean_client_direct (Test *test, + gconstpointer data) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (close_clean_tests); i++) { + setup_direct_connection (test, data); + + do_close_clean_client (test, + close_clean_tests[i].code, + close_clean_tests[i].reason, + close_clean_tests[i].expected_sender_code, + close_clean_tests[i].expected_sender_reason, + close_clean_tests[i].expected_receiver_code, + close_clean_tests[i].expected_receiver_reason); + + teardown_direct_connection (test, data); + } +} + +static void +do_close_clean_server (Test *test, + gushort code, + const char *reason, + gushort expected_sender_code, + const char *expected_sender_reason, + gushort expected_receiver_code, + const char *expected_receiver_reason) { gboolean close_event_client = FALSE; gboolean close_event_server = FALSE; @@ -650,7 +922,7 @@ test_close_clean_server (Test *test, g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event_client); g_signal_connect (test->server, "closed", G_CALLBACK (on_close_set_flag), &close_event_server); - soup_websocket_connection_close (test->server, SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "another reason"); + soup_websocket_connection_close (test->server, code, reason); g_assert_cmpint (soup_websocket_connection_get_state (test->server), ==, SOUP_WEBSOCKET_STATE_CLOSING); WAIT_UNTIL (soup_websocket_connection_get_state (test->server) == SOUP_WEBSOCKET_STATE_CLOSED); @@ -659,9 +931,52 @@ test_close_clean_server (Test *test, g_assert (close_event_client); g_assert (close_event_server); - g_assert_cmpint (soup_websocket_connection_get_close_code (test->server), ==, SOUP_WEBSOCKET_CLOSE_GOING_AWAY); - g_assert_cmpint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_GOING_AWAY); - g_assert_cmpstr (soup_websocket_connection_get_close_data (test->client), ==, "another reason"); + g_assert_cmpint (soup_websocket_connection_get_close_code (test->server), ==, expected_sender_code); + g_assert_cmpstr (soup_websocket_connection_get_close_data (test->server), ==, expected_sender_reason); + g_assert_cmpint (soup_websocket_connection_get_close_code (test->client), ==, expected_receiver_code); + g_assert_cmpstr (soup_websocket_connection_get_close_data (test->client), ==, expected_receiver_reason); +} + +static void +test_close_clean_server_soup (Test *test, + gconstpointer data) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (close_clean_tests); i++) { + setup_direct_connection (test, data); + + do_close_clean_server (test, + close_clean_tests[i].code, + close_clean_tests[i].reason, + close_clean_tests[i].expected_sender_code, + close_clean_tests[i].expected_sender_reason, + close_clean_tests[i].expected_receiver_code, + close_clean_tests[i].expected_receiver_reason); + + teardown_direct_connection (test, data); + } +} + +static void +test_close_clean_server_direct (Test *test, + gconstpointer data) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (close_clean_tests); i++) { + setup_direct_connection (test, data); + + do_close_clean_server (test, + close_clean_tests[i].code, + close_clean_tests[i].reason, + close_clean_tests[i].expected_sender_code, + close_clean_tests[i].expected_sender_reason, + close_clean_tests[i].expected_receiver_code, + close_clean_tests[i].expected_receiver_reason); + + teardown_direct_connection (test, data); + } } static gboolean @@ -707,6 +1022,80 @@ test_message_after_closing (Test *test, } static gpointer +close_after_close_server_thread (gpointer user_data) +{ + Test *test = user_data; + gsize written; + const char frames[] = + "\x88\x09\x03\xe8""reason1" + "\x88\x09\x03\xe8""reason2"; + GSocket *socket; + GError *error = NULL; + + g_mutex_lock (&test->mutex); + g_mutex_unlock (&test->mutex); + + g_output_stream_write_all (g_io_stream_get_output_stream (test->raw_server), + frames, sizeof (frames) -1, &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, sizeof (frames) - 1); + socket = g_socket_connection_get_socket (G_SOCKET_CONNECTION (test->raw_server)); + g_socket_shutdown (socket, FALSE, TRUE, &error); + g_assert_no_error (error); + + return NULL; +} + +static void +test_close_after_close (Test *test, + gconstpointer data) +{ + GThread *thread; + + g_mutex_lock (&test->mutex); + + thread = g_thread_new ("close-after-close-thread", close_after_close_server_thread, test); + + soup_websocket_connection_close (test->client, SOUP_WEBSOCKET_CLOSE_NORMAL, "reason1"); + g_mutex_unlock (&test->mutex); + + g_thread_join (thread); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); + g_assert_cmpuint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_NORMAL); + g_assert_cmpstr (soup_websocket_connection_get_close_data (test->client), ==, "reason1"); + g_io_stream_close (test->raw_server, NULL, NULL); +} + +static gboolean +on_close_unref_connection (SoupWebsocketConnection *ws, + gpointer user_data) +{ + Test *test = user_data; + + g_assert_true (test->server == ws); + g_clear_object (&test->server); + return TRUE; +} + +static void +test_server_unref_connection_on_close (Test *test, + gconstpointer data) +{ + gboolean close_event_client = FALSE; + + g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event_client); + g_signal_connect (test->server, "closed", G_CALLBACK (on_close_unref_connection), test); + soup_websocket_connection_close (test->client, SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "client closed"); + g_assert_cmpint (soup_websocket_connection_get_state (test->client), ==, SOUP_WEBSOCKET_STATE_CLOSING); + + WAIT_UNTIL (test->server == NULL); + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); + + g_assert_true (close_event_client); +} + +static gpointer timeout_server_thread (gpointer user_data) { Test *test = user_data; @@ -771,6 +1160,79 @@ send_fragments_server_thread (gpointer user_data) } static void +do_deflate (z_stream *zstream, + const char *str, + guint8 *buffer, + gsize *length) +{ + zstream->next_in = (void *)str; + zstream->avail_in = strlen (str); + zstream->next_out = buffer; + zstream->avail_out = 512; + + g_assert_cmpint (deflate(zstream, Z_NO_FLUSH), ==, Z_OK); + g_assert_cmpint (zstream->avail_in, ==, 0); + g_assert_cmpint (deflate(zstream, Z_SYNC_FLUSH), ==, Z_OK); + g_assert_cmpint (deflate(zstream, Z_SYNC_FLUSH), ==, Z_BUF_ERROR); + + *length = 512 - zstream->avail_out; + g_assert_cmpuint (*length, <, 126); +} + +static gpointer +send_compressed_fragments_server_thread (gpointer user_data) +{ + Test *test = user_data; + gsize written; + z_stream zstream; + GByteArray *data; + guint8 byte; + guint8 buffer[512]; + gsize buffer_length; + GError *error = NULL; + + memset (&zstream, 0, sizeof(z_stream)); + g_assert (deflateInit2 (&zstream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) == Z_OK); + + data = g_byte_array_new (); + + do_deflate (&zstream, "one ", buffer, &buffer_length); + byte = 0x00 | 0x01 | 0x40; /* !fin | opcode | compressed */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + do_deflate (&zstream, "two ", buffer, &buffer_length); + byte = 0x00; /* !fin | no opcode */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + do_deflate (&zstream, "three", buffer, &buffer_length); + g_assert_cmpuint (buffer_length, >=, 4); + buffer_length -= 4; + byte = 0x80; /* fin | no opcode */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + g_output_stream_write_all (g_io_stream_get_output_stream (test->raw_server), + data->data, data->len, &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, data->len); + g_io_stream_close (test->raw_server, NULL, &error); + g_assert_no_error (error); + + deflateEnd (&zstream); + g_byte_array_free (data, TRUE); + + return NULL; +} + +static void test_receive_fragmented (Test *test, gconstpointer data) { @@ -778,7 +1240,11 @@ test_receive_fragmented (Test *test, GBytes *received = NULL; GBytes *expect; - thread = g_thread_new ("fragment-thread", send_fragments_server_thread, test); + thread = g_thread_new ("fragment-thread", + test->enable_extensions ? + send_compressed_fragments_server_thread : + send_fragments_server_thread, + test); g_signal_connect (test->client, "error", G_CALLBACK (on_error_not_reached), NULL); g_signal_connect (test->client, "message", G_CALLBACK (on_text_message), &received); @@ -794,6 +1260,175 @@ test_receive_fragmented (Test *test, WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); } +typedef struct { + Test *test; + const char *header; + GString *payload; +} InvalidEncodeLengthTest; + +static gpointer +send_invalid_encode_length_server_thread (gpointer user_data) +{ + InvalidEncodeLengthTest *test = user_data; + gsize header_size; + gsize written; + GError *error = NULL; + + header_size = test->payload->len == 125 ? 6 : 10; + g_output_stream_write_all (g_io_stream_get_output_stream (test->test->raw_server), + test->header, header_size, &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, header_size); + + g_output_stream_write_all (g_io_stream_get_output_stream (test->test->raw_server), + test->payload->str, test->payload->len, &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, test->payload->len); + + g_io_stream_close (test->test->raw_server, NULL, &error); + g_assert_no_error (error); + + return NULL; +} + +static void +test_receive_invalid_encode_length_16 (Test *test, + gconstpointer data) +{ + GThread *thread; + GBytes *received = NULL; + GError *error = NULL; + InvalidEncodeLengthTest context = { test, NULL }; + guint i; + + g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); + + /* We use 126(~) as payload length with 125 extended length */ + context.header = "\x82~\x00}"; + context.payload = g_string_new (NULL); + for (i = 0; i < 125; i++) + g_string_append (context.payload, "X"); + thread = g_thread_new ("invalid-encode-length-thread", send_invalid_encode_length_server_thread, &context); + + WAIT_UNTIL (error != NULL || received != NULL); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + g_clear_error (&error); + g_assert_null (received); + + g_thread_join (thread); + g_string_free (context.payload, TRUE); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); +} + +static void +test_receive_invalid_encode_length_64 (Test *test, + gconstpointer data) +{ + GThread *thread; + GBytes *received = NULL; + GError *error = NULL; + InvalidEncodeLengthTest context = { test, NULL }; + guint i; + + g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); + + /* We use 127(\x7f) as payload length with 65535 extended length */ + context.header = "\x82\x7f\x00\x00\x00\x00\x00\x00\xff\xff"; + context.payload = g_string_new (NULL); + for (i = 0; i < 65535; i++) + g_string_append (context.payload, "X"); + thread = g_thread_new ("invalid-encode-length-thread", send_invalid_encode_length_server_thread, &context); + + WAIT_UNTIL (error != NULL || received != NULL); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + g_clear_error (&error); + g_assert_null (received); + + g_thread_join (thread); + g_string_free (context.payload, TRUE); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); +} + +static gpointer +send_masked_frame_server_thread (gpointer user_data) +{ + Test *test = user_data; + const char frame[] = "\x82\x8e\x9a"; + gsize written; + GError *error = NULL; + + g_output_stream_write_all (g_io_stream_get_output_stream (test->raw_server), + frame, sizeof (frame), &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, sizeof (frame)); + + g_io_stream_close (test->raw_server, NULL, &error); + g_assert_no_error (error); + + return NULL; +} + +static void +test_client_receive_masked_frame (Test *test, + gconstpointer data) +{ + GThread *thread; + GBytes *received = NULL; + GError *error = NULL; + + g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received); + + thread = g_thread_new ("send-masked-frame-thread", send_masked_frame_server_thread, test); + + WAIT_UNTIL (error != NULL || received != NULL); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + g_clear_error (&error); + g_assert_null (received); + + g_thread_join (thread); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); +} + +static void +test_server_receive_unmasked_frame (Test *test, + gconstpointer data) +{ + GError *error = NULL; + GIOStream *io; + gsize written; + const char *frame; + gboolean close_event = FALSE; + + g_signal_handlers_disconnect_by_func (test->server, on_error_not_reached, NULL); + g_signal_connect (test->server, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event); + + io = soup_websocket_connection_get_io_stream (test->client); + + /* Unmasked frame */ + frame = "\x81\x0bHello World"; + if (!g_output_stream_write_all (g_io_stream_get_output_stream (io), + frame, 13, &written, NULL, NULL)) + g_assert_not_reached (); + g_assert_cmpuint (written, ==, 13); + + WAIT_UNTIL (error != NULL); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + g_clear_error (&error); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); + g_assert (close_event); + + g_assert_cmpuint (soup_websocket_connection_get_close_code (test->client), ==, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + +} + static void test_client_context_got_server_connection (SoupServer *server, SoupWebsocketConnection *connection, @@ -842,6 +1477,390 @@ test_client_context (Test *test, g_assert_no_error (test->client_error); } +static struct { + const char *client_extension; + gboolean expected_prepare_result; + gboolean server_supports_extensions; + gboolean expected_check_result; + gboolean expected_accepted_extension; + gboolean expected_verify_result; + const char *server_extension; +} deflate_negotiate_tests[] = { + { "permessage-deflate", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate" + }, + { "permessage-deflate", + /* prepare supported check accepted verify */ + TRUE, FALSE, TRUE, FALSE, TRUE, + "permessage-deflate" + }, + { "permessage-deflate; server_no_context_takeover", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; server_no_context_takeover" + }, + { "permessage-deflate; client_no_context_takeover", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; client_no_context_takeover" + }, + { "permessage-deflate; server_max_window_bits=8", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; server_max_window_bits=8" + }, + { "permessage-deflate; client_max_window_bits", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; client_max_window_bits=15" + }, + { "permessage-deflate; client_max_window_bits=10", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; client_max_window_bits=10" + }, + { "permessage-deflate; client_no_context_takeover; server_max_window_bits=10", + /* prepare supported check accepted verify */ + TRUE, TRUE, TRUE, TRUE, TRUE, + "permessage-deflate; client_no_context_takeover; server_max_window_bits=10" + }, + { "permessage-deflate; unknown_parameter", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_no_context_takeover; client_no_context_takeover", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits=10; server_max_window_bits=15", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_no_context_takeover=15", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_no_context_takeover=15", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits=7", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits=16", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_max_window_bits=7", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_max_window_bits=16", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_max_window_bits=foo", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits=bar", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; client_max_window_bits=15foo", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, + { "permessage-deflate; server_max_window_bits=10bar", + /* prepare supported check accepted verify */ + TRUE, TRUE, FALSE, FALSE, FALSE, + NULL + }, +}; + +static void +test_deflate_negotiate_direct (Test *test, + gconstpointer unused) +{ + GPtrArray *supported_extensions; + guint i; + + supported_extensions = g_ptr_array_new_full (1, g_type_class_unref); + g_ptr_array_add (supported_extensions, g_type_class_ref (SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE)); + + for (i = 0; i < G_N_ELEMENTS (deflate_negotiate_tests); i++) { + SoupMessage *msg; + gboolean result; + GList *accepted_extensions = NULL; + GError *error = NULL; + + msg = soup_message_new ("GET", "http://127.0.0.1"); + + soup_websocket_client_prepare_handshake (msg, NULL, NULL); + soup_message_headers_append (msg->request_headers, "Sec-WebSocket-Extensions", deflate_negotiate_tests[i].client_extension); + result = soup_websocket_server_check_handshake_with_extensions (msg, NULL, NULL, + deflate_negotiate_tests[i].server_supports_extensions ? + supported_extensions : NULL, + &error); + g_assert (result == deflate_negotiate_tests[i].expected_check_result); + if (result) { + g_assert_no_error (error); + } else { + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE); + g_clear_error (&error); + } + + result = soup_websocket_server_process_handshake_with_extensions (msg, NULL, NULL, + deflate_negotiate_tests[i].server_supports_extensions ? + supported_extensions : NULL, + &accepted_extensions); + g_assert (result == deflate_negotiate_tests[i].expected_check_result); + if (deflate_negotiate_tests[i].expected_accepted_extension) { + const char *extension; + + extension = soup_message_headers_get_one (msg->response_headers, "Sec-WebSocket-Extensions"); + g_assert_cmpstr (extension, ==, deflate_negotiate_tests[i].server_extension); + g_assert_nonnull (accepted_extensions); + g_assert_cmpuint (g_list_length (accepted_extensions), ==, 1); + g_assert (SOUP_IS_WEBSOCKET_EXTENSION_DEFLATE (accepted_extensions->data)); + g_list_free_full (accepted_extensions, g_object_unref); + accepted_extensions = NULL; + } else { + g_assert_null (accepted_extensions); + } + + result = soup_websocket_client_verify_handshake_with_extensions (msg, supported_extensions, &accepted_extensions, &error); + g_assert (result == deflate_negotiate_tests[i].expected_verify_result); + if (result) { + g_assert_no_error (error); + } else { + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE); + g_clear_error (&error); + } + if (deflate_negotiate_tests[i].expected_accepted_extension) { + g_assert_nonnull (accepted_extensions); + g_assert_cmpuint (g_list_length (accepted_extensions), ==, 1); + g_assert (SOUP_IS_WEBSOCKET_EXTENSION_DEFLATE (accepted_extensions->data)); + g_list_free_full (accepted_extensions, g_object_unref); + accepted_extensions = NULL; + } else { + g_assert_null (accepted_extensions); + } + + g_object_unref (msg); + } + + g_ptr_array_unref (supported_extensions); +} + +static void +test_deflate_disabled_in_message_direct (Test *test, + gconstpointer unused) +{ + SoupMessage *msg; + GPtrArray *supported_extensions; + GList *accepted_extensions = NULL; + GError *error = NULL; + + supported_extensions = g_ptr_array_new_full (1, g_type_class_unref); + g_ptr_array_add (supported_extensions, g_type_class_ref (SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE)); + + msg = soup_message_new ("GET", "http://127.0.0.1"); + soup_message_disable_feature (msg, SOUP_TYPE_WEBSOCKET_EXTENSION_DEFLATE); + soup_websocket_client_prepare_handshake_with_extensions (msg, NULL, NULL, supported_extensions); + g_assert_cmpstr (soup_message_headers_get_one (msg->request_headers, "Sec-WebSocket-Extensions"), ==, NULL); + + g_assert_true (soup_websocket_server_check_handshake_with_extensions (msg, NULL, NULL, supported_extensions, &error)); + g_assert_no_error (error); + + g_assert_true (soup_websocket_server_process_handshake_with_extensions (msg, NULL, NULL, supported_extensions, &accepted_extensions)); + g_assert_null (accepted_extensions); + g_assert_cmpstr (soup_message_headers_get_one (msg->response_headers, "Sec-WebSocket-Extensions"), ==, NULL); + + g_assert_true (soup_websocket_client_verify_handshake_with_extensions (msg, supported_extensions, &accepted_extensions, &error)); + g_assert_no_error (error); + g_assert_null (accepted_extensions); + + g_object_unref (msg); + g_ptr_array_unref (supported_extensions); +} + +static void +test_deflate_disabled_in_message_soup (Test *test, + gconstpointer unused) +{ + test->enable_extensions = TRUE; + test->disable_deflate_in_message = TRUE; + setup_soup_server (test, NULL, NULL, got_server_connection, test); + client_connect (test, NULL, NULL, got_client_connection, test); + WAIT_UNTIL (test->server != NULL); + WAIT_UNTIL (test->client != NULL || test->client_error != NULL); + g_assert_no_error (test->client_error); + + g_assert_cmpstr (soup_message_headers_get_one (test->msg->request_headers, "Sec-WebSocket-Extensions"), ==, NULL); + g_assert_cmpstr (soup_message_headers_get_one (test->msg->response_headers, "Sec-WebSocket-Extensions"), ==, NULL); +} + +static gpointer +send_compressed_fragments_error_server_thread (gpointer user_data) +{ + Test *test = user_data; + gsize written; + z_stream zstream; + GByteArray *data; + guint8 byte; + guint8 buffer[512]; + gsize buffer_length; + GError *error = NULL; + + memset (&zstream, 0, sizeof(z_stream)); + g_assert (deflateInit2 (&zstream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) == Z_OK); + + data = g_byte_array_new (); + + do_deflate (&zstream, "one ", buffer, &buffer_length); + byte = 0x00 | 0x01 | 0x40; /* !fin | opcode | compressed */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + /* Only the first fragment should include the compressed bit set. */ + do_deflate (&zstream, "two ", buffer, &buffer_length); + byte = 0x00 | 0x00 | 0x40; /* !fin | no opcode | compressed */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + do_deflate (&zstream, "three", buffer, &buffer_length); + g_assert_cmpuint (buffer_length, >=, 4); + buffer_length -= 4; + byte = 0x80; /* fin | no opcode */ + data = g_byte_array_append (data, &byte, 1); + byte = (0xFF & buffer_length); /* mask | 7-bit-len */ + data = g_byte_array_append (data, &byte, 1); + data = g_byte_array_append (data, buffer, buffer_length); + + g_output_stream_write_all (g_io_stream_get_output_stream (test->raw_server), + data->data, data->len, &written, NULL, &error); + g_assert_no_error (error); + g_assert_cmpuint (written, ==, data->len); + g_io_stream_close (test->raw_server, NULL, &error); + g_assert_no_error (error); + + deflateEnd (&zstream); + g_byte_array_free (data, TRUE); + + return NULL; +} + +static void +test_deflate_receive_fragmented_error (Test *test, + gconstpointer data) +{ + GThread *thread; + GBytes *received = NULL; + gboolean close_event = FALSE; + GError *error = NULL; + + thread = g_thread_new ("deflate-fragment-error-thread", + send_compressed_fragments_error_server_thread, + test); + + g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error); + g_signal_connect (test->client, "message", G_CALLBACK (on_text_message), &received); + g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event); + + WAIT_UNTIL (error != NULL || received != NULL); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR); + g_clear_error (&error); + g_assert_null (received); + + g_thread_join (thread); + + WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); + g_assert (close_event); +} + +static void +test_cookies_in_request (Test *test, + gconstpointer data) +{ + SoupCookie *cookie; + const char *cookie_header; + SoupCookie *requested_cookie; + + cookie = soup_cookie_new ("foo", "bar", "127.0.0.1", "/", -1); + test->initial_cookies = g_list_prepend (test->initial_cookies, soup_cookie_copy (cookie)); + + setup_soup_server (test, NULL, NULL, got_server_connection, test); + client_connect (test, NULL, NULL, got_client_connection, test); + WAIT_UNTIL (test->server != NULL); + WAIT_UNTIL (test->client != NULL || test->client_error != NULL); + g_assert_no_error (test->client_error); + + cookie_header = soup_message_headers_get_one (test->msg->request_headers, "Cookie"); + requested_cookie = soup_cookie_parse (cookie_header, NULL); + g_assert_true (soup_cookie_equal (cookie, requested_cookie)); + soup_cookie_free (cookie); + soup_cookie_free (requested_cookie); +} + +static void +cookies_test_websocket_server_request_started (SoupServer *server, SoupMessage *msg, + SoupClientContext *client, gpointer user_data) +{ + soup_message_headers_append (msg->response_headers, "Set-Cookie", "foo=bar; Path=/"); +} + +static void +test_cookies_in_response (Test *test, + gconstpointer data) +{ + SoupCookieJar *jar; + GSList *cookies; + SoupCookie *cookie; + + setup_soup_server (test, NULL, NULL, got_server_connection, test); + g_signal_connect (test->soup_server, "request-started", + G_CALLBACK (cookies_test_websocket_server_request_started), + NULL); + client_connect (test, NULL, NULL, got_client_connection, test); + WAIT_UNTIL (test->server != NULL); + WAIT_UNTIL (test->client != NULL || test->client_error != NULL); + g_assert_no_error (test->client_error); + + jar = SOUP_COOKIE_JAR (soup_session_get_feature (test->session, SOUP_TYPE_COOKIE_JAR)); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_nonnull (cookies); + g_assert_cmpuint (g_slist_length (cookies), ==, 1); + cookie = soup_cookie_new ("foo", "bar", "127.0.0.1", "/", -1); + g_assert_true (soup_cookie_equal (cookie, (SoupCookie *)cookies->data)); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + soup_cookie_free (cookie); +} + int main (int argc, char *argv[]) @@ -855,6 +1874,10 @@ main (int argc, test_handshake, teardown_soup_connection); + g_test_add ("/websocket/soup/handshake-error", Test, NULL, NULL, + test_handshake_unsupported_extension, + teardown_soup_connection); + g_test_add ("/websocket/direct/send-client-to-server", Test, NULL, setup_direct_connection, test_send_client_to_server, @@ -882,32 +1905,37 @@ main (int argc, test_send_big_packets, teardown_soup_connection); - g_test_add ("/websocket/direct/send-bad-data", Test, NULL, + g_test_add ("/websocket/direct/send-empty-packets", Test, NULL, setup_direct_connection, - test_send_bad_data, + test_send_empty_packets, teardown_direct_connection); - g_test_add ("/websocket/soup/send-bad-data", Test, NULL, + g_test_add ("/websocket/soup/send-empty-packets", Test, NULL, setup_soup_connection, - test_send_bad_data, + test_send_empty_packets, teardown_soup_connection); - g_test_add ("/websocket/direct/close-clean-client", Test, NULL, + g_test_add ("/websocket/direct/send-bad-data", Test, NULL, setup_direct_connection, - test_close_clean_client, + test_send_bad_data, teardown_direct_connection); - g_test_add ("/websocket/soup/close-clean-client", Test, NULL, + g_test_add ("/websocket/soup/send-bad-data", Test, NULL, setup_soup_connection, - test_close_clean_client, + test_send_bad_data, teardown_soup_connection); - g_test_add ("/websocket/direct/close-clean-server", Test, NULL, - setup_direct_connection, - test_close_clean_server, - teardown_direct_connection); - g_test_add ("/websocket/soup/close-clean-server", Test, NULL, - setup_soup_connection, - test_close_clean_server, - teardown_soup_connection); + g_test_add ("/websocket/direct/close-clean-client", Test, NULL, NULL, + test_close_clean_client_direct, + NULL); + g_test_add ("/websocket/soup/close-clean-client", Test, NULL, NULL, + test_close_clean_client_soup, + NULL); + + g_test_add ("/websocket/direct/close-clean-server", Test, NULL, NULL, + test_close_clean_server_direct, + NULL); + g_test_add ("/websocket/soup/close-clean-server", Test, NULL, NULL, + test_close_clean_server_soup, + NULL); g_test_add ("/websocket/direct/message-after-closing", Test, NULL, setup_direct_connection, @@ -918,6 +1946,16 @@ main (int argc, test_message_after_closing, teardown_soup_connection); + g_test_add ("/websocket/direct/close-after-close", Test, NULL, + setup_half_direct_connection, + test_close_after_close, + teardown_direct_connection); + + g_test_add ("/websocket/soup/server-unref-connection-on-close", Test, NULL, + setup_soup_connection, + test_server_unref_connection_on_close, + teardown_soup_connection); + g_test_add ("/websocket/direct/protocol-negotiate", Test, NULL, NULL, test_protocol_negotiate_direct, @@ -953,6 +1991,91 @@ main (int argc, test_receive_fragmented, teardown_direct_connection); + g_test_add ("/websocket/direct/receive-invalid-encode-length-16", Test, NULL, + setup_half_direct_connection, + test_receive_invalid_encode_length_16, + teardown_direct_connection); + + g_test_add ("/websocket/direct/receive-invalid-encode-length-64", Test, NULL, + setup_half_direct_connection, + test_receive_invalid_encode_length_64, + teardown_direct_connection); + + g_test_add ("/websocket/direct/client-receive-masked-frame", Test, NULL, + setup_half_direct_connection, + test_client_receive_masked_frame, + teardown_direct_connection); + + g_test_add ("/websocket/direct/server-receive-unmasked-frame", Test, NULL, + setup_direct_connection, + test_server_receive_unmasked_frame, + teardown_direct_connection); + g_test_add ("/websocket/soup/server-receive-unmasked-frame", Test, NULL, + setup_soup_connection, + test_server_receive_unmasked_frame, + teardown_soup_connection); + + g_test_add ("/websocket/soup/deflate-handshake", Test, NULL, + setup_soup_connection_with_extensions, + test_handshake, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-negotiate", Test, NULL, NULL, + test_deflate_negotiate_direct, + NULL); + + g_test_add ("/websocket/direct/deflate-disabled-in-message", Test, NULL, NULL, + test_deflate_disabled_in_message_direct, + NULL); + g_test_add ("/websocket/soup/deflate-disabled-in-message", Test, NULL, NULL, + test_deflate_disabled_in_message_soup, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-send-client-to-server", Test, NULL, + setup_direct_connection_with_extensions, + test_send_client_to_server, + teardown_direct_connection); + g_test_add ("/websocket/soup/deflate-send-client-to-server", Test, NULL, + setup_soup_connection_with_extensions, + test_send_client_to_server, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-send-server-to-client", Test, NULL, + setup_direct_connection_with_extensions, + test_send_server_to_client, + teardown_direct_connection); + g_test_add ("/websocket/soup/deflate-send-server-to-client", Test, NULL, + setup_soup_connection_with_extensions, + test_send_server_to_client, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-send-big-packets", Test, NULL, + setup_direct_connection_with_extensions, + test_send_big_packets, + teardown_direct_connection); + g_test_add ("/websocket/soup/deflate-send-big-packets", Test, NULL, + setup_soup_connection_with_extensions, + test_send_big_packets, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-send-empty-packets", Test, NULL, + setup_direct_connection_with_extensions, + test_send_empty_packets, + teardown_direct_connection); + g_test_add ("/websocket/soup/deflate-send-empty-packets", Test, NULL, + setup_soup_connection_with_extensions, + test_send_empty_packets, + teardown_soup_connection); + + g_test_add ("/websocket/direct/deflate-receive-fragmented", Test, NULL, + setup_half_direct_connection_with_extensions, + test_receive_fragmented, + teardown_direct_connection); + g_test_add ("/websocket/direct/deflate-receive-fragmented-error", Test, NULL, + setup_half_direct_connection_with_extensions, + test_deflate_receive_fragmented_error, + teardown_direct_connection); + if (g_test_slow ()) { g_test_add ("/websocket/direct/close-after-timeout", Test, NULL, setup_half_direct_connection, @@ -964,6 +2087,13 @@ main (int argc, test_client_context, teardown_soup_connection); + g_test_add ("/websocket/soup/cookies-in-request", Test, NULL, NULL, + test_cookies_in_request, + teardown_soup_connection); + g_test_add ("/websocket/soup/cookies-in-response", Test, NULL, NULL, + test_cookies_in_response, + teardown_soup_connection); + ret = g_test_run (); test_cleanup (); diff --git a/tests/xmlrpc-old-server-test.c b/tests/xmlrpc-old-server-test.c index a7076b5a..977c5379 100644 --- a/tests/xmlrpc-old-server-test.c +++ b/tests/xmlrpc-old-server-test.c @@ -344,6 +344,13 @@ main (int argc, char **argv) g_free (out); for (i = 0; tests[i] && *tests[i]; i++) { + /* GLib >= 2.62 defaults to TAP output for tests, and + * this adds TAP diagnostics "#..." and the test count + * "1..N", even in the output of "some-test -l". + * Ignore those. */ + if (tests[i][0] == '#' || g_str_has_prefix (tests[i], "1..")) + continue; + g_assert_true (g_str_has_prefix (tests[i], "/xmlrpc-old/")); path = g_strdup_printf ("/xmlrpc-old-server/%s", tests[i] + strlen ("/xmlrpc-old/")); g_test_add_data_func (path, tests[i], do_one_xmlrpc_test); diff --git a/tests/xmlrpc-server-test.c b/tests/xmlrpc-server-test.c index 80f04ea8..a6d4abd5 100644 --- a/tests/xmlrpc-server-test.c +++ b/tests/xmlrpc-server-test.c @@ -344,6 +344,13 @@ main (int argc, char **argv) g_free (out); for (i = 0; tests[i] && *tests[i]; i++) { + /* GLib >= 2.62 defaults to TAP output for tests, and + * this adds TAP diagnostics "#..." and the test count + * "1..N", even in the output of "some-test -l". + * Ignore those. */ + if (tests[i][0] == '#' || g_str_has_prefix (tests[i], "1..")) + continue; + g_assert_true (g_str_has_prefix (tests[i], "/xmlrpc/")); path = g_strdup_printf ("/xmlrpc-server/%s", tests[i] + strlen ("/xmlrpc/")); g_test_add_data_func (path, tests[i], do_one_xmlrpc_test); diff --git a/tests/xmlrpc-server.php b/tests/xmlrpc-server.php index f315b6d0..7003e683 100644 --- a/tests/xmlrpc-server.php +++ b/tests/xmlrpc-server.php @@ -20,7 +20,7 @@ function sum ($method_name, $params, $app_data) foreach ($params[0] as $val) { if (xmlrpc_get_type ($val) != "double") return paramfault(); - + $sum = $sum + $val; } return $sum; diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c index 58d96abc..8b1f9dab 100644 --- a/tests/xmlrpc-test.c +++ b/tests/xmlrpc-test.c @@ -473,6 +473,7 @@ verify_serialization_fail (GVariant *value) body = soup_xmlrpc_build_request ("MyMethod", value, &error); g_assert (body == NULL); g_assert (error != NULL); + g_clear_error (&error); } static void @@ -565,6 +566,7 @@ verify_deserialization (GVariant *expected_variant, soup_xmlrpc_params_free (out_params); g_variant_unref (variant); + g_variant_unref (expected_variant); g_free (method_name); g_free (body); } @@ -591,6 +593,8 @@ verify_deserialization_fail (const char *signature, g_assert (variant == NULL); g_free (body); + g_free (method_name); + g_clear_error (&error); soup_xmlrpc_params_free (out_params); } |