From 14c56c1e5ce1b598d09000edf38f57d24a3df2c8c951f9789b5251ca52c3a13b Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 6 Aug 2007 19:32:54 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libsoup?expand=0&rev=5 --- libsoup-2.2.100-r924.patch | 4307 ++++++++++++++++++++++++++++++++++++ libsoup-334021.patch | 302 +++ libsoup.changes | 6 + libsoup.spec | 15 +- 4 files changed, 4626 insertions(+), 4 deletions(-) create mode 100644 libsoup-2.2.100-r924.patch create mode 100644 libsoup-334021.patch diff --git a/libsoup-2.2.100-r924.patch b/libsoup-2.2.100-r924.patch new file mode 100644 index 0000000..2a7f452 --- /dev/null +++ b/libsoup-2.2.100-r924.patch @@ -0,0 +1,4307 @@ +diff -ruNp libsoup-2.2.100/aclocal.m4 libsoup-2.2.100/aclocal.m4 +--- libsoup-2.2.100/aclocal.m4 2007-02-12 10:34:08.000000000 -0500 ++++ libsoup-2.2.100/aclocal.m4 2007-05-01 15:49:07.000000000 -0400 +@@ -11,6 +11,331 @@ + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + ++# Configure paths for GLIB ++# Owen Taylor 1997-2001 ++ ++dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) ++dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or ++dnl gthread is specified in MODULES, pass to pkg-config ++dnl ++AC_DEFUN([AM_PATH_GLIB_2_0], ++[dnl ++dnl Get the cflags and libraries from pkg-config ++dnl ++AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], ++ , enable_glibtest=yes) ++ ++ pkg_config_args=glib-2.0 ++ for module in . $4 ++ do ++ case "$module" in ++ gmodule) ++ pkg_config_args="$pkg_config_args gmodule-2.0" ++ ;; ++ gmodule-no-export) ++ pkg_config_args="$pkg_config_args gmodule-no-export-2.0" ++ ;; ++ gobject) ++ pkg_config_args="$pkg_config_args gobject-2.0" ++ ;; ++ gthread) ++ pkg_config_args="$pkg_config_args gthread-2.0" ++ ;; ++ esac ++ done ++ ++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) ++ ++ no_glib="" ++ ++ if test x$PKG_CONFIG != xno ; then ++ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then ++ : ++ else ++ echo *** pkg-config too old; version 0.7 or better required. ++ no_glib=yes ++ PKG_CONFIG=no ++ fi ++ else ++ no_glib=yes ++ fi ++ ++ min_glib_version=ifelse([$1], ,2.0.0,$1) ++ AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) ++ ++ if test x$PKG_CONFIG != xno ; then ++ ## don't try to run the test against uninstalled libtool libs ++ if $PKG_CONFIG --uninstalled $pkg_config_args; then ++ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" ++ enable_glibtest=no ++ fi ++ ++ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then ++ : ++ else ++ no_glib=yes ++ fi ++ fi ++ ++ if test x"$no_glib" = x ; then ++ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` ++ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` ++ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` ++ ++ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` ++ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` ++ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` ++ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` ++ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ ++ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` ++ if test "x$enable_glibtest" = "xyes" ; then ++ ac_save_CFLAGS="$CFLAGS" ++ ac_save_LIBS="$LIBS" ++ CFLAGS="$CFLAGS $GLIB_CFLAGS" ++ LIBS="$GLIB_LIBS $LIBS" ++dnl ++dnl Now check if the installed GLIB is sufficiently new. (Also sanity ++dnl checks the results of pkg-config to some extent) ++dnl ++ rm -f conf.glibtest ++ AC_TRY_RUN([ ++#include ++#include ++#include ++ ++int ++main () ++{ ++ int major, minor, micro; ++ char *tmp_version; ++ ++ system ("touch conf.glibtest"); ++ ++ /* HP/UX 9 (%@#!) writes to sscanf strings */ ++ tmp_version = g_strdup("$min_glib_version"); ++ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { ++ printf("%s, bad version string\n", "$min_glib_version"); ++ exit(1); ++ } ++ ++ if ((glib_major_version != $glib_config_major_version) || ++ (glib_minor_version != $glib_config_minor_version) || ++ (glib_micro_version != $glib_config_micro_version)) ++ { ++ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", ++ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, ++ glib_major_version, glib_minor_version, glib_micro_version); ++ printf ("*** was found! If pkg-config was correct, then it is best\n"); ++ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); ++ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); ++ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); ++ printf("*** required on your system.\n"); ++ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); ++ printf("*** to point to the correct configuration files\n"); ++ } ++ else if ((glib_major_version != GLIB_MAJOR_VERSION) || ++ (glib_minor_version != GLIB_MINOR_VERSION) || ++ (glib_micro_version != GLIB_MICRO_VERSION)) ++ { ++ printf("*** GLIB header files (version %d.%d.%d) do not match\n", ++ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); ++ printf("*** library (version %d.%d.%d)\n", ++ glib_major_version, glib_minor_version, glib_micro_version); ++ } ++ else ++ { ++ if ((glib_major_version > major) || ++ ((glib_major_version == major) && (glib_minor_version > minor)) || ++ ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) ++ { ++ return 0; ++ } ++ else ++ { ++ printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", ++ glib_major_version, glib_minor_version, glib_micro_version); ++ printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", ++ major, minor, micro); ++ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); ++ printf("***\n"); ++ printf("*** If you have already installed a sufficiently new version, this error\n"); ++ printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); ++ printf("*** being found. The easiest way to fix this is to remove the old version\n"); ++ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); ++ printf("*** correct copy of pkg-config. (In this case, you will have to\n"); ++ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); ++ printf("*** so that the correct libraries are found at run-time))\n"); ++ } ++ } ++ return 1; ++} ++],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) ++ CFLAGS="$ac_save_CFLAGS" ++ LIBS="$ac_save_LIBS" ++ fi ++ fi ++ if test "x$no_glib" = x ; then ++ AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) ++ ifelse([$2], , :, [$2]) ++ else ++ AC_MSG_RESULT(no) ++ if test "$PKG_CONFIG" = "no" ; then ++ echo "*** A new enough version of pkg-config was not found." ++ echo "*** See http://www.freedesktop.org/software/pkgconfig/" ++ else ++ if test -f conf.glibtest ; then ++ : ++ else ++ echo "*** Could not run GLIB test program, checking why..." ++ ac_save_CFLAGS="$CFLAGS" ++ ac_save_LIBS="$LIBS" ++ CFLAGS="$CFLAGS $GLIB_CFLAGS" ++ LIBS="$LIBS $GLIB_LIBS" ++ AC_TRY_LINK([ ++#include ++#include ++], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], ++ [ echo "*** The test program compiled, but did not run. This usually means" ++ echo "*** that the run-time linker is not finding GLIB or finding the wrong" ++ echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" ++ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" ++ echo "*** to the installed location Also, make sure you have run ldconfig if that" ++ echo "*** is required on your system" ++ echo "***" ++ echo "*** If you have an old version installed, it is best to remove it, although" ++ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], ++ [ echo "*** The test program failed to compile or link. See the file config.log for the" ++ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) ++ CFLAGS="$ac_save_CFLAGS" ++ LIBS="$ac_save_LIBS" ++ fi ++ fi ++ GLIB_CFLAGS="" ++ GLIB_LIBS="" ++ GLIB_GENMARSHAL="" ++ GOBJECT_QUERY="" ++ GLIB_MKENUMS="" ++ ifelse([$3], , :, [$3]) ++ fi ++ AC_SUBST(GLIB_CFLAGS) ++ AC_SUBST(GLIB_LIBS) ++ AC_SUBST(GLIB_GENMARSHAL) ++ AC_SUBST(GOBJECT_QUERY) ++ AC_SUBST(GLIB_MKENUMS) ++ rm -f conf.glibtest ++]) ++ ++dnl Autoconf macros for libgcrypt ++dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++dnl ++dnl This file is free software; as a special exception the author gives ++dnl unlimited permission to copy and/or distribute it, with or without ++dnl modifications, as long as this notice is preserved. ++dnl ++dnl This file is distributed in the hope that it will be useful, but ++dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the ++dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ ++ ++dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, ++dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) ++dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. ++dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed ++dnl with the API version to also check the API compatibility. Example: ++dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed ++dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using ++dnl this features allows to prevent build against newer versions of libgcrypt ++dnl with a changed API. ++dnl ++AC_DEFUN([AM_PATH_LIBGCRYPT], ++[ AC_ARG_WITH(libgcrypt-prefix, ++ AC_HELP_STRING([--with-libgcrypt-prefix=PFX], ++ [prefix where LIBGCRYPT is installed (optional)]), ++ libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") ++ if test x$libgcrypt_config_prefix != x ; then ++ if test x${LIBGCRYPT_CONFIG+set} != xset ; then ++ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config ++ fi ++ fi ++ ++ AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) ++ tmp=ifelse([$1], ,1:1.2.0,$1) ++ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then ++ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` ++ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` ++ else ++ req_libgcrypt_api=0 ++ min_libgcrypt_version="$tmp" ++ fi ++ ++ AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) ++ ok=no ++ if test "$LIBGCRYPT_CONFIG" != "no" ; then ++ req_major=`echo $min_libgcrypt_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` ++ req_minor=`echo $min_libgcrypt_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` ++ req_micro=`echo $min_libgcrypt_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` ++ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` ++ major=`echo $libgcrypt_config_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` ++ minor=`echo $libgcrypt_config_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` ++ micro=`echo $libgcrypt_config_version | \ ++ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` ++ if test "$major" -gt "$req_major"; then ++ ok=yes ++ else ++ if test "$major" -eq "$req_major"; then ++ if test "$minor" -gt "$req_minor"; then ++ ok=yes ++ else ++ if test "$minor" -eq "$req_minor"; then ++ if test "$micro" -ge "$req_micro"; then ++ ok=yes ++ fi ++ fi ++ fi ++ fi ++ fi ++ fi ++ if test $ok = yes; then ++ AC_MSG_RESULT(yes) ++ else ++ AC_MSG_RESULT(no) ++ fi ++ if test $ok = yes; then ++ # If we have a recent libgcrypt, we should also check that the ++ # API is compatible ++ if test "$req_libgcrypt_api" -gt 0 ; then ++ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` ++ if test "$tmp" -gt 0 ; then ++ AC_MSG_CHECKING([LIBGCRYPT API version]) ++ if test "$req_libgcrypt_api" -eq "$tmp" ; then ++ AC_MSG_RESULT(okay) ++ else ++ ok=no ++ AC_MSG_RESULT([does not match (want=$req_libgcrypt_api got=$tmp)]) ++ fi ++ fi ++ fi ++ fi ++ if test $ok = yes; then ++ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` ++ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` ++ ifelse([$2], , :, [$2]) ++ else ++ LIBGCRYPT_CFLAGS="" ++ LIBGCRYPT_LIBS="" ++ ifelse([$3], , :, [$3]) ++ fi ++ AC_SUBST(LIBGCRYPT_CFLAGS) ++ AC_SUBST(LIBGCRYPT_LIBS) ++]) ++ + # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + + # serial 48 AC_PROG_LIBTOOL +@@ -7446,220 +7771,4 @@ AC_SUBST([am__tar]) + AC_SUBST([am__untar]) + ]) # _AM_PROG_TAR + +-# Configure paths for GLIB +-# Owen Taylor 1997-2001 +- +-dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +-dnl gthread is specified in MODULES, pass to pkg-config +-dnl +-AC_DEFUN([AM_PATH_GLIB_2_0], +-[dnl +-dnl Get the cflags and libraries from pkg-config +-dnl +-AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], +- , enable_glibtest=yes) +- +- pkg_config_args=glib-2.0 +- for module in . $4 +- do +- case "$module" in +- gmodule) +- pkg_config_args="$pkg_config_args gmodule-2.0" +- ;; +- gmodule-no-export) +- pkg_config_args="$pkg_config_args gmodule-no-export-2.0" +- ;; +- gobject) +- pkg_config_args="$pkg_config_args gobject-2.0" +- ;; +- gthread) +- pkg_config_args="$pkg_config_args gthread-2.0" +- ;; +- esac +- done +- +- AC_PATH_PROG(PKG_CONFIG, pkg-config, no) +- +- no_glib="" +- +- if test x$PKG_CONFIG != xno ; then +- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then +- : +- else +- echo *** pkg-config too old; version 0.7 or better required. +- no_glib=yes +- PKG_CONFIG=no +- fi +- else +- no_glib=yes +- fi +- +- min_glib_version=ifelse([$1], ,2.0.0,$1) +- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) +- +- if test x$PKG_CONFIG != xno ; then +- ## don't try to run the test against uninstalled libtool libs +- if $PKG_CONFIG --uninstalled $pkg_config_args; then +- echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" +- enable_glibtest=no +- fi +- +- if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then +- : +- else +- no_glib=yes +- fi +- fi +- +- if test x"$no_glib" = x ; then +- GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` +- GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` +- GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` +- +- GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` +- GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` +- glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +- glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +- glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ +- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` +- if test "x$enable_glibtest" = "xyes" ; then +- ac_save_CFLAGS="$CFLAGS" +- ac_save_LIBS="$LIBS" +- CFLAGS="$CFLAGS $GLIB_CFLAGS" +- LIBS="$GLIB_LIBS $LIBS" +-dnl +-dnl Now check if the installed GLIB is sufficiently new. (Also sanity +-dnl checks the results of pkg-config to some extent) +-dnl +- rm -f conf.glibtest +- AC_TRY_RUN([ +-#include +-#include +-#include +- +-int +-main () +-{ +- int major, minor, micro; +- char *tmp_version; +- +- system ("touch conf.glibtest"); +- +- /* HP/UX 9 (%@#!) writes to sscanf strings */ +- tmp_version = g_strdup("$min_glib_version"); +- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { +- printf("%s, bad version string\n", "$min_glib_version"); +- exit(1); +- } +- +- if ((glib_major_version != $glib_config_major_version) || +- (glib_minor_version != $glib_config_minor_version) || +- (glib_micro_version != $glib_config_micro_version)) +- { +- printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", +- $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, +- glib_major_version, glib_minor_version, glib_micro_version); +- printf ("*** was found! If pkg-config was correct, then it is best\n"); +- printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); +- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); +- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); +- printf("*** required on your system.\n"); +- printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); +- printf("*** to point to the correct configuration files\n"); +- } +- else if ((glib_major_version != GLIB_MAJOR_VERSION) || +- (glib_minor_version != GLIB_MINOR_VERSION) || +- (glib_micro_version != GLIB_MICRO_VERSION)) +- { +- printf("*** GLIB header files (version %d.%d.%d) do not match\n", +- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); +- printf("*** library (version %d.%d.%d)\n", +- glib_major_version, glib_minor_version, glib_micro_version); +- } +- else +- { +- if ((glib_major_version > major) || +- ((glib_major_version == major) && (glib_minor_version > minor)) || +- ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) +- { +- return 0; +- } +- else +- { +- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", +- glib_major_version, glib_minor_version, glib_micro_version); +- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", +- major, minor, micro); +- printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); +- printf("***\n"); +- printf("*** If you have already installed a sufficiently new version, this error\n"); +- printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); +- printf("*** being found. The easiest way to fix this is to remove the old version\n"); +- printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); +- printf("*** correct copy of pkg-config. (In this case, you will have to\n"); +- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); +- printf("*** so that the correct libraries are found at run-time))\n"); +- } +- } +- return 1; +-} +-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) +- CFLAGS="$ac_save_CFLAGS" +- LIBS="$ac_save_LIBS" +- fi +- fi +- if test "x$no_glib" = x ; then +- AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) +- ifelse([$2], , :, [$2]) +- else +- AC_MSG_RESULT(no) +- if test "$PKG_CONFIG" = "no" ; then +- echo "*** A new enough version of pkg-config was not found." +- echo "*** See http://www.freedesktop.org/software/pkgconfig/" +- else +- if test -f conf.glibtest ; then +- : +- else +- echo "*** Could not run GLIB test program, checking why..." +- ac_save_CFLAGS="$CFLAGS" +- ac_save_LIBS="$LIBS" +- CFLAGS="$CFLAGS $GLIB_CFLAGS" +- LIBS="$LIBS $GLIB_LIBS" +- AC_TRY_LINK([ +-#include +-#include +-], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], +- [ echo "*** The test program compiled, but did not run. This usually means" +- echo "*** that the run-time linker is not finding GLIB or finding the wrong" +- echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" +- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" +- echo "*** to the installed location Also, make sure you have run ldconfig if that" +- echo "*** is required on your system" +- echo "***" +- echo "*** If you have an old version installed, it is best to remove it, although" +- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], +- [ echo "*** The test program failed to compile or link. See the file config.log for the" +- echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) +- CFLAGS="$ac_save_CFLAGS" +- LIBS="$ac_save_LIBS" +- fi +- fi +- GLIB_CFLAGS="" +- GLIB_LIBS="" +- GLIB_GENMARSHAL="" +- GOBJECT_QUERY="" +- GLIB_MKENUMS="" +- ifelse([$3], , :, [$3]) +- fi +- AC_SUBST(GLIB_CFLAGS) +- AC_SUBST(GLIB_LIBS) +- AC_SUBST(GLIB_GENMARSHAL) +- AC_SUBST(GOBJECT_QUERY) +- AC_SUBST(GLIB_MKENUMS) +- rm -f conf.glibtest +-]) +- + m4_include([acinclude.m4]) +diff -ruNp libsoup-2.2.100/ChangeLog libsoup-2.2.100/ChangeLog +--- libsoup-2.2.100/ChangeLog 2007-02-12 10:19:13.000000000 -0500 ++++ libsoup-2.2.100/ChangeLog 2007-05-01 16:00:48.000000000 -0400 +@@ -1,3 +1,142 @@ ++2007-04-16 Dan Winship ++ ++ * libsoup/soup-ssl.h: Make a real SoupSSLCredentials type rather ++ than just using gpointer ++ ++ * libsoup/soup-server.c (SoupServerPrivate): use it ++ ++ * libsoup/soup-session.c (SoupSessionPrivate): use it ++ ++ * libsoup/soup-gnutls.c: Use it, and consistently use "creds" ++ rather than "cred" as the abbreviation for "credentials". ++ ++ * docs/reference/libsoup-sections.txt: ++ * docs/reference/tmpl/soup-misc.sgml: ++ * docs/reference/tmpl/soup-ssl.sgml: update ++ ++2007-03-29 Dan Winship ++ ++ * libsoup/soup-session-sync.c (queue_message): Implement this by ++ sending the message (synchronously) in another thread and then ++ queueing the callback back in the main thread. ++ ++ * libsoup/soup-session.c (soup_session_queue_message): update docs ++ to be more explicit about what thread the callback occurs in ++ ++2007-03-17 Dan Winship ++ ++ * libsoup/soup-message.c (soup_message_set_auth) ++ (soup_message_get_auth, soup_message_set_proxy_auth) ++ (soup_message_get_proxy_auth): get/set auth/proxy_auth info for a ++ message. ++ ++ * libsoup/soup-session.c (add_auth): Use soup_message_set_auth and ++ soup_message_set_proxy_auth. ++ (update_auth_internal): Call soup_message_get_auth or ++ soup_message_get_proxy_auth to determine the message's prior auth, ++ rather than calling lookup_auth() again, since it isn't guaranteed ++ to return the same thing now as it did when the message was ++ originally sent. Fixes erroneous 401s when queuing multiple ++ messages at once to an as-yet-unauthenticated-to server. #271540 ++ ++ * libsoup/soup-session-async.c (queue_message): don't run the ++ queue right away, do it at idle time. Otherwise in some cases ++ (especially errors), the message callbacks could be invoked before ++ queue_message returns. ++ ++ * tests/auth-test.c: add a regression test for #271540. ++ ++2007-03-17 Dan Winship ++ ++ * configure.in: require glib 2.12. check for timegm(). ++ ++ * libsoup/soup-date.c (soup_mktime_utc): Use timegm if available. ++ (soup_date_iso8601_parse): use g_time_val_from_iso8601. #337010, ++ patch from Emmanuele Bassi. ++ ++ * libsoup/soup-types.h: remove local copy of ++ G_GNUC_NULL_TERMINATED since we now depend on a new-enough copy of ++ glib. ++ ++ * libsoup/soup-misc.c (soup_base64_encode_close) ++ (soup_base64_encode_step, soup_base64_encode) ++ (soup_base64_decode_step): Make these just be wrappers around the ++ glib base64 methods. (For now; eventually they'll just go away.) ++ ++ * libsoup/soup-auth-basic.c (authenticate): ++ * libsoup/soup-auth-digest.c (authenticate): ++ * libsoup/soup-connection-ntlm.c (soup_ntlm_parse_challenge) ++ (soup_ntlm_response): ++ * libsoup/soup-server-auth.c (soup_server_auth_new): ++ * libsoup/soup-soap-message.c (soup_soap_message_write_base64): ++ * libsoup/soup-xmlrpc-message.c ++ (soup_xmlrpc_message_write_base64): ++ * libsoup/soup-xmlrpc-response.c (soup_xmlrpc_value_get_base64): ++ Use glib base64 methods ++ ++2007-03-16 Dan Winship ++ ++ * libsoup/soup-message.c (soup_message_get_response_encoding): ++ update the handling of CONNECT: it has no response body by ++ default, but does have a body if its headers say so. ++ ++ * tests/proxy-test.c: test libsoup's behavior when talking to ++ proxies. ++ ++ * tests/httpd.conf.in: Load mod_proxy and mod_ssl, and add ++ sections configuring them, for proxy-test ++ ++ * configure.in: update the apache-module-dir-finding code to deal ++ with the fact that some modules (eg, mod_ssl) might only be in the ++ mpm-specific module dir, while others (eg, mod_php5) might only be ++ in the generic module dir. ++ ++2007-03-12 Dan Winship ++ ++ * tests/Makefile.am (INCLUDES): add $(LIBGNUTLS_CFLAGS) for ++ ssl-test. #417617, patch from Elijah Newren. ++ ++2007-03-12 Dan Winship ++ ++ * libsoup/soup-session-sync.c (wait_for_connection): if ++ soup_connection_connect_sync() returns SOUP_STATUS_TRY_AGAIN, then ++ try again. (Duh.) Fixes SSL-via-proxy-when-using-synchronous-I/O- ++ where-the-proxy-closes-the-connection-when-returning-407. (Reported ++ by Varadhan.) ++ ++ * tests/get.c: Rewrite to use soup_session_send_message rather ++ than soup_session_queue_message, and add a "-s" flag to use ++ SoupSessionSync rather than SoupSessionAsync (so we can test bugs ++ in the sync code paths). ++ ++2007-03-08 Dan Winship ++ ++ * libsoup/soup-gnutls.c (do_handshake): don't return ++ G_IO_STATUS_AGAIN if we're doing blocking I/O; just keep retrying ++ until the handshake is complete. ++ (soup_gnutls_read, soup_gnutls_write): if we get ++ GNUTLS_E_REHANDSHAKE, call do_handshake() immediately rather than ++ returning G_IO_STATUS_AGAIN; if the socket is blocking then ++ G_IO_STATUS_AGAIN is wrong, and if the socket is non-blocking, we ++ might already need to return SOUP_SSL_ERROR_HANDSHAKE_NEEDS_WRITE ++ or SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ. ++ ++ #415402, based on a patch from Jacob Berkman. ++ ++ * tests/ssl-test.c: basic ssl test. In particular, tests that ++ rehandshake requests are handled correctly during both synchronous ++ and asynchronous I/O. Might eventually test other stuff too... ++ ++ * configure.in: ++ * tests/Makefile.am: updates for ssl-test ++ ++2007-02-19 Dan Winship ++ ++ * configure.in: Get gcrypt libs/cflags. ++ ++ * libsoup/Makefile.am (INCLUDES, libsoup_2_2_la_LIBADD): add ++ gcrypt flags. Patch from "Cygwin Ports Maintainer", #384498 ++ + 2007-02-12 Dan Winship + + * configure.in: 2.2.100 +diff -ruNp libsoup-2.2.100/config.h.in libsoup-2.2.100/config.h.in +--- libsoup-2.2.100/config.h.in 2007-02-12 10:34:10.000000000 -0500 ++++ libsoup-2.2.100/config.h.in 2007-05-01 15:49:23.000000000 -0400 +@@ -33,6 +33,10 @@ + /* Define to 1 if you have the `gmtime_r' function. */ + #undef HAVE_GMTIME_R + ++/* Define to 1 if you have the `gnutls_certificate_client_set_sign_function' ++ function. */ ++#undef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++ + /* Define to 1 if you have the `inet_aton' function. */ + #undef HAVE_INET_ATON + +@@ -78,6 +82,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_TYPES_H + ++/* Define to 1 if you have the `timegm' function. */ ++#undef HAVE_TIMEGM ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_UNISTD_H + +diff -ruNp libsoup-2.2.100/configure libsoup-2.2.100/configure +--- libsoup-2.2.100/configure 2007-02-12 10:34:10.000000000 -0500 ++++ libsoup-2.2.100/configure 2007-05-01 15:49:12.000000000 -0400 +@@ -876,7 +876,12 @@ OS_WIN32_TRUE + OS_WIN32_FALSE + LIBGNUTLS_CFLAGS + LIBGNUTLS_LIBS ++LIBGCRYPT_CONFIG ++LIBGCRYPT_CFLAGS ++LIBGCRYPT_LIBS + SSL_REQUIREMENT ++HAVE_SSL_TRUE ++HAVE_SSL_FALSE + HTML_DIR + ENABLE_GTK_DOC_TRUE + ENABLE_GTK_DOC_FALSE +@@ -884,6 +889,8 @@ GTK_DOC_USE_LIBTOOL_TRUE + GTK_DOC_USE_LIBTOOL_FALSE + APACHE_HTTPD + APACHE_MODULE_DIR ++APACHE_SSL_MODULE_DIR ++APACHE_PHP_MODULE_DIR + HAVE_APACHE_TRUE + HAVE_APACHE_FALSE + IF_HAVE_PHP +@@ -1512,6 +1519,8 @@ Optional Packages: + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] include additional configurations [automatic] ++ --with-libgcrypt-prefix=PFX ++ prefix where LIBGCRYPT is installed (optional) + --with-html-dir=PATH path to installed docs + --with-apache-httpd Path to apache httpd (for tests) + --with-apache-module-dir Apache modules dir (for tests) +@@ -5910,7 +5919,7 @@ ia64-*-hpux*) + ;; + *-*-irix6*) + # Find out which ABI we are using. +- echo '#line 5913 "configure"' > conftest.$ac_ext ++ echo '#line 5922 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? +@@ -8709,11 +8718,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:8712: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:8721: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:8716: \$? = $ac_status" >&5 ++ echo "$as_me:8725: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -8977,11 +8986,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:8980: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:8989: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:8984: \$? = $ac_status" >&5 ++ echo "$as_me:8993: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -9081,11 +9090,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:9084: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:9093: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:9088: \$? = $ac_status" >&5 ++ echo "$as_me:9097: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -11533,7 +11542,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < conftest.$ac_ext <&5) ++ (eval echo "\"\$as_me:14013: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:14008: \$? = $ac_status" >&5 ++ echo "$as_me:14017: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -14105,11 +14114,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:14108: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:14117: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:14112: \$? = $ac_status" >&5 ++ echo "$as_me:14121: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -15675,11 +15684,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:15678: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:15687: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:15682: \$? = $ac_status" >&5 ++ echo "$as_me:15691: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -15779,11 +15788,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:15782: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:15791: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:15786: \$? = $ac_status" >&5 ++ echo "$as_me:15795: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -18009,11 +18018,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:18012: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:18021: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:18016: \$? = $ac_status" >&5 ++ echo "$as_me:18025: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -18277,11 +18286,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:18280: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:18289: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 +- echo "$as_me:18284: \$? = $ac_status" >&5 ++ echo "$as_me:18293: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. +@@ -18381,11 +18390,11 @@ else + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` +- (eval echo "\"\$as_me:18384: $lt_compile\"" >&5) ++ (eval echo "\"\$as_me:18393: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 +- echo "$as_me:18388: \$? = $ac_status" >&5 ++ echo "$as_me:18397: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized +@@ -21569,7 +21578,7 @@ fi + no_glib=yes + fi + +- min_glib_version=2.6.0 ++ min_glib_version=2.12.0 + { echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 + echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6; } + +@@ -22210,6 +22219,116 @@ fi + done + + ++for ac_func in timegm ++do ++as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` ++{ echo "$as_me:$LINENO: checking for $ac_func" >&5 ++echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } ++if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++/* Define $ac_func to an innocuous variant, in case declares $ac_func. ++ For example, HP-UX 11i declares gettimeofday. */ ++#define $ac_func innocuous_$ac_func ++ ++/* System header to define __stub macros and hopefully few prototypes, ++ which can conflict with char $ac_func (); below. ++ Prefer to if __STDC__ is defined, since ++ exists even on freestanding compilers. */ ++ ++#ifdef __STDC__ ++# include ++#else ++# include ++#endif ++ ++#undef $ac_func ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char $ac_func (); ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined __stub_$ac_func || defined __stub___$ac_func ++choke me ++#endif ++ ++int ++main () ++{ ++return $ac_func (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_try") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_try") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ eval "$as_ac_var=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ eval "$as_ac_var=no" ++fi ++ ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ac_res=`eval echo '${'$as_ac_var'}'` ++ { echo "$as_me:$LINENO: result: $ac_res" >&5 ++echo "${ECHO_T}$ac_res" >&6; } ++if test `eval echo '${'$as_ac_var'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++done ++ ++ + + { echo "$as_me:$LINENO: checking for socket" >&5 + echo $ECHO_N "checking for socket... $ECHO_C" >&6; } +@@ -22819,7 +22938,141 @@ else + LIBGNUTLS_LIBS=$pkg_cv_LIBGNUTLS_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6; } +- have_ssl=yes ++ ++# Check whether --with-libgcrypt-prefix was given. ++if test "${with_libgcrypt_prefix+set}" = set; then ++ withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval" ++else ++ libgcrypt_config_prefix="" ++fi ++ ++ if test x$libgcrypt_config_prefix != x ; then ++ if test x${LIBGCRYPT_CONFIG+set} != xset ; then ++ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config ++ fi ++ fi ++ ++ # Extract the first word of "libgcrypt-config", so it can be a program name with args. ++set dummy libgcrypt-config; ac_word=$2 ++{ echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } ++if test "${ac_cv_path_LIBGCRYPT_CONFIG+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ case $LIBGCRYPT_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++IFS=$as_save_IFS ++ ++ test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no" ++ ;; ++esac ++fi ++LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG ++if test -n "$LIBGCRYPT_CONFIG"; then ++ { echo "$as_me:$LINENO: result: $LIBGCRYPT_CONFIG" >&5 ++echo "${ECHO_T}$LIBGCRYPT_CONFIG" >&6; } ++else ++ { echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6; } ++fi ++ ++ ++ tmp=1:1.2.0 ++ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then ++ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` ++ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` ++ else ++ req_libgcrypt_api=0 ++ min_libgcrypt_version="$tmp" ++ fi ++ ++ { echo "$as_me:$LINENO: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5 ++echo $ECHO_N "checking for LIBGCRYPT - version >= $min_libgcrypt_version... $ECHO_C" >&6; } ++ ok=no ++ if test "$LIBGCRYPT_CONFIG" != "no" ; then ++ req_major=`echo $min_libgcrypt_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` ++ req_minor=`echo $min_libgcrypt_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` ++ req_micro=`echo $min_libgcrypt_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` ++ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` ++ major=`echo $libgcrypt_config_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` ++ minor=`echo $libgcrypt_config_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` ++ micro=`echo $libgcrypt_config_version | \ ++ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` ++ if test "$major" -gt "$req_major"; then ++ ok=yes ++ else ++ if test "$major" -eq "$req_major"; then ++ if test "$minor" -gt "$req_minor"; then ++ ok=yes ++ else ++ if test "$minor" -eq "$req_minor"; then ++ if test "$micro" -ge "$req_micro"; then ++ ok=yes ++ fi ++ fi ++ fi ++ fi ++ fi ++ fi ++ if test $ok = yes; then ++ { echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6; } ++ else ++ { echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6; } ++ fi ++ if test $ok = yes; then ++ # If we have a recent libgcrypt, we should also check that the ++ # API is compatible ++ if test "$req_libgcrypt_api" -gt 0 ; then ++ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` ++ if test "$tmp" -gt 0 ; then ++ { echo "$as_me:$LINENO: checking LIBGCRYPT API version" >&5 ++echo $ECHO_N "checking LIBGCRYPT API version... $ECHO_C" >&6; } ++ if test "$req_libgcrypt_api" -eq "$tmp" ; then ++ { echo "$as_me:$LINENO: result: okay" >&5 ++echo "${ECHO_T}okay" >&6; } ++ else ++ ok=no ++ { echo "$as_me:$LINENO: result: does not match (want=$req_libgcrypt_api got=$tmp)" >&5 ++echo "${ECHO_T}does not match (want=$req_libgcrypt_api got=$tmp)" >&6; } ++ fi ++ fi ++ fi ++ fi ++ if test $ok = yes; then ++ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` ++ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` ++ have_ssl=yes ++ else ++ LIBGCRYPT_CFLAGS="" ++ LIBGCRYPT_LIBS="" ++ have_ssl=no ++ fi ++ ++ ++ + fi + if test "$have_ssl" = "yes"; then + +@@ -22828,6 +23081,120 @@ cat >>confdefs.h <<\_ACEOF + _ACEOF + + SSL_REQUIREMENT="gnutls" ++ ++ old_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $LIBGNUTLS_LIBS $LIBGCRYPT_LIBS" ++ ++for ac_func in gnutls_certificate_client_set_sign_function ++do ++as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` ++{ echo "$as_me:$LINENO: checking for $ac_func" >&5 ++echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } ++if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++/* Define $ac_func to an innocuous variant, in case declares $ac_func. ++ For example, HP-UX 11i declares gettimeofday. */ ++#define $ac_func innocuous_$ac_func ++ ++/* System header to define __stub macros and hopefully few prototypes, ++ which can conflict with char $ac_func (); below. ++ Prefer to if __STDC__ is defined, since ++ exists even on freestanding compilers. */ ++ ++#ifdef __STDC__ ++# include ++#else ++# include ++#endif ++ ++#undef $ac_func ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char $ac_func (); ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined __stub_$ac_func || defined __stub___$ac_func ++choke me ++#endif ++ ++int ++main () ++{ ++return $ac_func (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_try") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_try") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ eval "$as_ac_var=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ eval "$as_ac_var=no" ++fi ++ ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ac_res=`eval echo '${'$as_ac_var'}'` ++ { echo "$as_me:$LINENO: result: $ac_res" >&5 ++echo "${ECHO_T}$ac_res" >&6; } ++if test `eval echo '${'$as_ac_var'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++done ++ ++ LDFLAGS="$old_LDFLAGS" + else + if test "$enable_ssl" = "auto"; then + { echo "$as_me:$LINENO: WARNING: Disabling SSL support" >&5 +@@ -22847,6 +23214,17 @@ fi + + + ++if test $enable_ssl != no; then ++ HAVE_SSL_TRUE= ++ HAVE_SSL_FALSE='#' ++else ++ HAVE_SSL_TRUE='#' ++ HAVE_SSL_FALSE= ++fi ++ ++ ++ ++ + # Check whether --with-html-dir was given. + if test "${with_html_dir+set}" = set; then + withval=$with_html_dir; +@@ -23061,11 +23439,17 @@ if test "${with_apache_module_dir+set}" + withval=$with_apache_module_dir; APACHE_MODULE_DIR="$withval" + else + apache_prefix=`dirname \`dirname $APACHE_HTTPD\`` ++ mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'` + # This only works with bash, but should fail harmlessly in sh +- for dir in $apache_prefix/lib{64,}/{apache,http}{2,}{/modules,}; do ++ for dir in $apache_prefix/lib{64,}/{apache,http}{2,}{$mpm,}{/modules,}; do + if test -f $dir/mod_auth_digest.so; then + APACHE_MODULE_DIR="$dir" +- break ++ fi ++ if test -f $dir/mod_ssl.so; then ++ APACHE_SSL_MODULE_DIR="$dir" ++ fi ++ if test -f $dir/mod_php5.so; then ++ APACHE_PHP_MODULE_DIR="$dir" + fi + done + fi +@@ -23073,6 +23457,8 @@ fi + { echo "$as_me:$LINENO: result: $APACHE_MODULE_DIR" >&5 + echo "${ECHO_T}$APACHE_MODULE_DIR" >&6; } + ++ ++ + fi + + if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR"; then +@@ -23099,7 +23485,7 @@ fi + if test "$have_apache" = 1; then + { echo "$as_me:$LINENO: checking for mod_php5" >&5 + echo $ECHO_N "checking for mod_php5... $ECHO_C" >&6; } +- if test -f $APACHE_MODULE_DIR/mod_php5.so; then ++ if test -f $APACHE_PHP_MODULE_DIR/mod_php5.so; then + have_php=yes + IF_HAVE_PHP="" + else +@@ -23276,6 +23662,13 @@ echo "$as_me: error: conditional \"OS_WI + Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } + fi ++if test -z "${HAVE_SSL_TRUE}" && test -z "${HAVE_SSL_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"HAVE_SSL\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"HAVE_SSL\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi + if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK_DOC\" was never defined. + Usually this means the macro was only invoked conditionally." >&5 +@@ -23994,7 +24387,12 @@ OS_WIN32_TRUE!$OS_WIN32_TRUE$ac_delim + OS_WIN32_FALSE!$OS_WIN32_FALSE$ac_delim + LIBGNUTLS_CFLAGS!$LIBGNUTLS_CFLAGS$ac_delim + LIBGNUTLS_LIBS!$LIBGNUTLS_LIBS$ac_delim ++LIBGCRYPT_CONFIG!$LIBGCRYPT_CONFIG$ac_delim ++LIBGCRYPT_CFLAGS!$LIBGCRYPT_CFLAGS$ac_delim ++LIBGCRYPT_LIBS!$LIBGCRYPT_LIBS$ac_delim + SSL_REQUIREMENT!$SSL_REQUIREMENT$ac_delim ++HAVE_SSL_TRUE!$HAVE_SSL_TRUE$ac_delim ++HAVE_SSL_FALSE!$HAVE_SSL_FALSE$ac_delim + HTML_DIR!$HTML_DIR$ac_delim + ENABLE_GTK_DOC_TRUE!$ENABLE_GTK_DOC_TRUE$ac_delim + ENABLE_GTK_DOC_FALSE!$ENABLE_GTK_DOC_FALSE$ac_delim +@@ -24002,6 +24400,8 @@ GTK_DOC_USE_LIBTOOL_TRUE!$GTK_DOC_USE_LI + GTK_DOC_USE_LIBTOOL_FALSE!$GTK_DOC_USE_LIBTOOL_FALSE$ac_delim + APACHE_HTTPD!$APACHE_HTTPD$ac_delim + APACHE_MODULE_DIR!$APACHE_MODULE_DIR$ac_delim ++APACHE_SSL_MODULE_DIR!$APACHE_SSL_MODULE_DIR$ac_delim ++APACHE_PHP_MODULE_DIR!$APACHE_PHP_MODULE_DIR$ac_delim + HAVE_APACHE_TRUE!$HAVE_APACHE_TRUE$ac_delim + HAVE_APACHE_FALSE!$HAVE_APACHE_FALSE$ac_delim + IF_HAVE_PHP!$IF_HAVE_PHP$ac_delim +@@ -24011,7 +24411,7 @@ LIBOBJS!$LIBOBJS$ac_delim + LTLIBOBJS!$LTLIBOBJS$ac_delim + _ACEOF + +- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then ++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 49; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +diff -ruNp libsoup-2.2.100/configure.in libsoup-2.2.100/configure.in +--- libsoup-2.2.100/configure.in 2007-02-12 10:18:49.000000000 -0500 ++++ libsoup-2.2.100/configure.in 2007-05-01 16:00:48.000000000 -0400 +@@ -73,7 +73,7 @@ dnl *********************** + dnl *** Checks for glib *** + dnl *********************** + +-AM_PATH_GLIB_2_0(2.6.0,,,gobject gthread) ++AM_PATH_GLIB_2_0(2.12.0,,,gobject gthread) + + PKG_CHECK_MODULES(XML, libxml-2.0) + AC_SUBST(XML_CFLAGS) +@@ -106,6 +106,7 @@ dnl ******************* + dnl *** Misc checks *** + dnl ******************* + AC_CHECK_FUNCS(gmtime_r) ++AC_CHECK_FUNCS(timegm) + + dnl ********************************* + dnl *** Networking library checks *** +@@ -134,7 +135,8 @@ AC_ARG_ENABLE(ssl, + enable_ssl=auto) + + if test "$enable_ssl" != "no"; then +- PKG_CHECK_MODULES(LIBGNUTLS, gnutls, have_ssl=yes, have_ssl=no) ++ PKG_CHECK_MODULES(LIBGNUTLS, gnutls, ++ [AM_PATH_LIBGCRYPT([], have_ssl=yes, have_ssl=no)], have_ssl=no) + if test "$have_ssl" = "yes"; then + AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support]) + SSL_REQUIREMENT="gnutls" +@@ -152,6 +154,9 @@ AC_SUBST(LIBGNUTLS_CFLAGS) + AC_SUBST(LIBGNUTLS_LIBS) + AC_SUBST(SSL_REQUIREMENT) + ++dnl This is not supposed to be conditional, but... ++AM_CONDITIONAL(HAVE_SSL, test $enable_ssl != no) ++ + dnl *************** + dnl *** gtk-doc *** + dnl *************** +@@ -207,15 +212,23 @@ if test "$APACHE_HTTPD" != "no"; then + [ --with-apache-module-dir Apache modules dir (for tests)], + APACHE_MODULE_DIR="$withval", + [apache_prefix=`dirname \`dirname $APACHE_HTTPD\`` ++ mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'` + # This only works with bash, but should fail harmlessly in sh +- for dir in $apache_prefix/lib{64,}/{apache,http}{2,}{/modules,}; do ++ for dir in $apache_prefix/lib{64,}/{apache,http}{2,}{$mpm,}{/modules,}; do + if test -f $dir/mod_auth_digest.so; then + APACHE_MODULE_DIR="$dir" +- break ++ fi ++ if test -f $dir/mod_ssl.so; then ++ APACHE_SSL_MODULE_DIR="$dir" ++ fi ++ if test -f $dir/mod_php5.so; then ++ APACHE_PHP_MODULE_DIR="$dir" + fi + done]) + AC_MSG_RESULT($APACHE_MODULE_DIR) + AC_SUBST(APACHE_MODULE_DIR) ++ AC_SUBST(APACHE_SSL_MODULE_DIR) ++ AC_SUBST(APACHE_PHP_MODULE_DIR) + fi + + if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR"; then +@@ -228,7 +241,7 @@ AM_CONDITIONAL(HAVE_APACHE, test $have_a + + if test "$have_apache" = 1; then + AC_MSG_CHECKING([for mod_php5]) +- if test -f $APACHE_MODULE_DIR/mod_php5.so; then ++ if test -f $APACHE_PHP_MODULE_DIR/mod_php5.so; then + have_php=yes + IF_HAVE_PHP="" + else +diff -ruNp libsoup-2.2.100/libsoup/Makefile.am libsoup-2.2.100/libsoup/Makefile.am +--- libsoup-2.2.100/libsoup/Makefile.am 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/Makefile.am 2007-04-09 17:03:24.000000000 -0400 +@@ -10,6 +10,7 @@ INCLUDES = \ + $(SOUP_DEBUG_FLAGS) \ + $(GLIB_CFLAGS) \ + $(XML_CFLAGS) \ ++ $(LIBGCRYPT_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) + + MARSHAL_GENERATED = soup-marshal.c soup-marshal.h +@@ -67,6 +68,7 @@ libsoup_2_2_la_LIBADD = \ + $(XML_LIBS) \ + $(LIBGNUTLS_LIBS_STATIC) \ + $(LIBGNUTLS_LIBS) \ ++ $(LIBGCRYPT_LIBS) \ + $(LIBWS2_32) + + libsoup_2_2_la_SOURCES = \ +diff -ruNp libsoup-2.2.100/libsoup/Makefile.in libsoup-2.2.100/libsoup/Makefile.in +--- libsoup-2.2.100/libsoup/Makefile.in 2007-02-12 10:34:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/Makefile.in 2007-05-01 15:49:10.000000000 -0400 +@@ -61,7 +61,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) + am__DEPENDENCIES_1 = + libsoup_2_2_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) ++ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + am__objects_1 = soup-marshal.lo + am_libsoup_2_2_la_OBJECTS = $(am__objects_1) soup-address.lo \ + soup-auth.lo soup-auth-basic.lo soup-auth-digest.lo \ +@@ -102,6 +102,8 @@ AMDEP_TRUE = @AMDEP_TRUE@ + AMTAR = @AMTAR@ + 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@ +@@ -141,6 +143,8 @@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE + GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ + HAVE_APACHE_FALSE = @HAVE_APACHE_FALSE@ + HAVE_APACHE_TRUE = @HAVE_APACHE_TRUE@ ++HAVE_SSL_FALSE = @HAVE_SSL_FALSE@ ++HAVE_SSL_TRUE = @HAVE_SSL_TRUE@ + HAVE_XMLRPC_EPI_PHP_FALSE = @HAVE_XMLRPC_EPI_PHP_FALSE@ + HAVE_XMLRPC_EPI_PHP_TRUE = @HAVE_XMLRPC_EPI_PHP_TRUE@ + HTML_DIR = @HTML_DIR@ +@@ -150,6 +154,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LDFLAGS = @LDFLAGS@ ++LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ ++LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ ++LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ + LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ + LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ + LIBOBJS = @LIBOBJS@ +@@ -240,6 +247,7 @@ INCLUDES = \ + $(SOUP_DEBUG_FLAGS) \ + $(GLIB_CFLAGS) \ + $(XML_CFLAGS) \ ++ $(LIBGCRYPT_CFLAGS) \ + $(LIBGNUTLS_CFLAGS) + + MARSHAL_GENERATED = soup-marshal.c soup-marshal.h +@@ -282,6 +290,7 @@ libsoup_2_2_la_LIBADD = \ + $(XML_LIBS) \ + $(LIBGNUTLS_LIBS_STATIC) \ + $(LIBGNUTLS_LIBS) \ ++ $(LIBGCRYPT_LIBS) \ + $(LIBWS2_32) + + libsoup_2_2_la_SOURCES = \ +diff -ruNp libsoup-2.2.100/libsoup/soup-auth-basic.c libsoup-2.2.100/libsoup/soup-auth-basic.c +--- libsoup-2.2.100/libsoup/soup-auth-basic.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-auth-basic.c 2007-04-09 17:03:24.000000000 -0400 +@@ -118,7 +118,7 @@ authenticate (SoupAuth *auth, const char + user_pass = g_strdup_printf ("%s:%s", username, password); + len = strlen (user_pass); + +- priv->token = soup_base64_encode (user_pass, len); ++ priv->token = g_base64_encode ((guchar *)user_pass, len); + + memset (user_pass, 0, len); + g_free (user_pass); +diff -ruNp libsoup-2.2.100/libsoup/soup-auth-digest.c libsoup-2.2.100/libsoup/soup-auth-digest.c +--- libsoup-2.2.100/libsoup/soup-auth-digest.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-auth-digest.c 2007-04-09 17:03:24.000000000 -0400 +@@ -1,4 +1,4 @@ +-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-digest-offset: 8 -*- */ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + /* + * soup-auth-digest.c: HTTP Digest Authentication + * +@@ -258,7 +258,7 @@ authenticate (SoupAuth *auth, const char + auth, + (unsigned long) getpid (), + (unsigned long) time (0)); +- priv->cnonce = soup_base64_encode (bgen, strlen (bgen)); ++ priv->cnonce = g_base64_encode ((guchar *)bgen, strlen (bgen)); + g_free (bgen); + + priv->user = g_strdup (username); +diff -ruNp libsoup-2.2.100/libsoup/soup-connection-ntlm.c libsoup-2.2.100/libsoup/soup-connection-ntlm.c +--- libsoup-2.2.100/libsoup/soup-connection-ntlm.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-connection-ntlm.c 2007-04-09 17:03:24.000000000 -0400 +@@ -328,25 +328,14 @@ soup_ntlm_parse_challenge (const char *c + char **nonce, + char **default_domain) + { +- int clen, decodelen; ++ gsize clen; + NTLMString domain; + guchar *chall; +- int state; +- unsigned int save; + + if (strncmp (challenge, "NTLM ", 5) != 0) + return FALSE; + +- decodelen = strlen (challenge) - 5; +- chall = g_malloc (decodelen); +- +- state = save = 0; +- clen = soup_base64_decode_step ((const guchar *) challenge + 5, +- decodelen, +- chall, +- &state, +- &save); +- ++ chall = g_base64_decode (challenge + 5, &clen); + if (clen < NTLM_CHALLENGE_DOMAIN_STRING_OFFSET || + clen < NTLM_CHALLENGE_NONCE_OFFSET + NTLM_CHALLENGE_NONCE_LENGTH) { + g_free (chall); +@@ -385,7 +374,7 @@ soup_ntlm_response (const char *nonce, + int hlen, dlen, ulen, offset; + guchar hash[21], lm_resp[24], nt_resp[24]; + NTLMResponse resp; +- guchar *out, *p; ++ char *out, *p; + int state, save; + + nt_hash (password, hash); +@@ -411,51 +400,27 @@ soup_ntlm_response (const char *nonce, + ntlm_set_string (&resp.nt_resp, &offset, sizeof (nt_resp)); + + out = g_malloc (((offset + 3) * 4) / 3 + 6); +- strncpy ((char *)out, "NTLM ", 5); ++ strncpy (out, "NTLM ", 5); + p = out + 5; + + state = save = 0; + +- p += soup_base64_encode_step ((guchar *) &resp, +- sizeof (resp), +- FALSE, +- p, +- &state, +- &save); +- p += soup_base64_encode_step ((const guchar *) domain, +- dlen, +- FALSE, +- p, +- &state, +- &save); +- p += soup_base64_encode_step ((const guchar *) user, +- ulen, +- FALSE, +- p, +- &state, +- &save); +- p += soup_base64_encode_step ((const guchar *) host, +- hlen, +- FALSE, +- p, +- &state, +- &save); +- p += soup_base64_encode_step (lm_resp, +- sizeof (lm_resp), +- FALSE, +- p, +- &state, +- &save); +- +- p += soup_base64_encode_close (nt_resp, +- sizeof (nt_resp), +- FALSE, +- p, +- &state, +- &save); ++ p += g_base64_encode_step ((const guchar *) &resp, sizeof (resp), ++ FALSE, p, &state, &save); ++ p += g_base64_encode_step ((const guchar *) domain, dlen, ++ FALSE, p, &state, &save); ++ p += g_base64_encode_step ((const guchar *) user, ulen, ++ FALSE, p, &state, &save); ++ p += g_base64_encode_step ((const guchar *) host, hlen, ++ FALSE, p, &state, &save); ++ p += g_base64_encode_step (lm_resp, sizeof (lm_resp), ++ FALSE, p, &state, &save); ++ p += g_base64_encode_step (nt_resp, sizeof (nt_resp), ++ FALSE, p, &state, &save); ++ p += g_base64_encode_close (FALSE, p, &state, &save); + *p = '\0'; + +- return (char *)out; ++ return out; + } + + /* DES utils */ +diff -ruNp libsoup-2.2.100/libsoup/soup-date.c libsoup-2.2.100/libsoup/soup-date.c +--- libsoup-2.2.100/libsoup/soup-date.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-date.c 2007-04-09 17:03:24.000000000 -0400 +@@ -26,10 +26,6 @@ static const char *days[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + +-static const int days_before[] = { +- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 +-}; +- + static int + parse_month (const char *month) + { +@@ -54,12 +50,18 @@ parse_month (const char *month) + time_t + soup_mktime_utc (struct tm *tm) + { ++#if HAVE_TIMEGM ++ return timegm (tm); ++#else + time_t tt; ++ static const int days_before[] = { ++ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ++ }; + + /* We check the month because (a) if we don't, the + * days_before[] part below may access random memory, and (b) + * soup_date_parse() doesn't check the return value of +- * parse_month(). The caller is responsible for ensure the ++ * parse_month(). The caller is responsible for ensuring the + * sanity of everything else. + */ + if (tm->tm_mon < 0 || tm->tm_mon > 11) +@@ -71,7 +73,9 @@ soup_mktime_utc (struct tm *tm) + if (tm->tm_year % 4 == 0 && tm->tm_mon < 2) + tt--; + tt = ((((tt * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60 + tm->tm_sec; ++ + return tt; ++#endif + } + + /** +@@ -185,6 +189,7 @@ char * + soup_date_generate (time_t when) + { + struct tm tm; ++ + soup_gmtime (&when, &tm); + + /* RFC1123 format, eg, "Sun, 06 Nov 1994 08:49:37 GMT" */ +@@ -206,59 +211,10 @@ soup_date_generate (time_t when) + time_t + soup_date_iso8601_parse (const char *timestamp) + { +- struct tm tm; +- long val; +- time_t tt; +- +- val = strtoul (timestamp, (char **)×tamp, 10); +- if (*timestamp == '-') { +- // YYYY-MM-DD +- tm.tm_year = val - 1900; +- timestamp++; +- tm.tm_mon = strtoul (timestamp, (char **)×tamp, 10) - 1; +- if (*timestamp++ != '-') +- return -1; +- tm.tm_mday = strtoul (timestamp, (char **)×tamp, 10); +- } else { +- // YYYYMMDD +- tm.tm_mday = val % 100; +- tm.tm_mon = (val % 10000) / 100 - 1; +- tm.tm_year = val / 10000 - 1900; +- } +- +- if (*timestamp++ != 'T') +- return -1; +- +- val = strtoul (timestamp, (char **)×tamp, 10); +- if (*timestamp == ':') { +- // hh:mm:ss +- tm.tm_hour = val; +- timestamp++; +- tm.tm_min = strtoul (timestamp, (char **)×tamp, 10); +- if (*timestamp++ != ':') +- return -1; +- tm.tm_sec = strtoul (timestamp, (char **)×tamp, 10); +- } else { +- // hhmmss +- tm.tm_sec = val % 100; +- tm.tm_min = (val % 10000) / 100; +- tm.tm_hour = val / 10000; +- } ++ GTimeVal timeval; + +- tt = soup_mktime_utc (&tm); ++ if (!g_time_val_from_iso8601 (timestamp, &timeval)) ++ return (time_t) -1; + +- if (*timestamp == '.') +- strtoul (timestamp + 1, (char **)×tamp, 10); +- +- if (*timestamp == '+' || *timestamp == '-') { +- int sign = (*timestamp == '+') ? -1 : 1; +- val = strtoul (timestamp + 1, (char **)×tamp, 10); +- if (*timestamp == ':') +- val = 60 * val + strtoul (timestamp + 1, NULL, 10); +- else +- val = 60 * (val / 100) + (val % 100); +- tt += sign * val; +- } +- +- return tt; ++ return (time_t) timeval.tv_sec; + } +diff -ruNp libsoup-2.2.100/libsoup/soup-gnutls.c libsoup-2.2.100/libsoup/soup-gnutls.c +--- libsoup-2.2.100/libsoup/soup-gnutls.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-gnutls.c 2007-05-01 16:00:48.000000000 -0400 +@@ -2,10 +2,7 @@ + /* + * soup-gnutls.c + * +- * Authors: +- * Ian Peters +- * +- * Copyright (C) 2003, Ximian, Inc. ++ * Copyright (C) 2003-2006, Novell, Inc. + */ + + #ifdef HAVE_CONFIG_H +@@ -15,6 +12,7 @@ + #ifdef HAVE_SSL + + #include ++#include + #include + #include + #include +@@ -32,17 +30,17 @@ gboolean soup_ssl_supported = TRUE; + + #define DH_BITS 1024 + +-typedef struct { +- gnutls_certificate_credentials cred; ++struct SoupSSLCredentials { ++ gnutls_certificate_credentials creds; + gboolean have_ca_file; +-} SoupGNUTLSCred; ++}; + + typedef struct { + GIOChannel channel; + int fd; + GIOChannel *real_sock; + gnutls_session session; +- SoupGNUTLSCred *cred; ++ SoupSSLCredentials *creds; + char *hostname; + gboolean established; + SoupSSLType type; +@@ -129,21 +127,26 @@ verify_certificate (gnutls_session sessi + return TRUE; + } + ++#define SOUP_GNUTLS_CHANNEL_NONBLOCKING(chan) (fcntl ((chan)->fd, F_GETFL, 0) & O_NONBLOCK) ++ + static GIOStatus + do_handshake (SoupGNUTLSChannel *chan, GError **err) + { + int result; + ++again: + result = gnutls_handshake (chan->session); + +- if (result == GNUTLS_E_AGAIN || +- result == GNUTLS_E_INTERRUPTED) { +- g_set_error (err, SOUP_SSL_ERROR, +- (gnutls_record_get_direction (chan->session) ? +- SOUP_SSL_ERROR_HANDSHAKE_NEEDS_WRITE : +- SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ), +- "Handshaking..."); +- return G_IO_STATUS_AGAIN; ++ if (result == GNUTLS_E_AGAIN || result == GNUTLS_E_INTERRUPTED) { ++ if (SOUP_GNUTLS_CHANNEL_NONBLOCKING (chan)) { ++ g_set_error (err, SOUP_SSL_ERROR, ++ (gnutls_record_get_direction (chan->session) ? ++ SOUP_SSL_ERROR_HANDSHAKE_NEEDS_WRITE : ++ SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ), ++ "Handshaking..."); ++ return G_IO_STATUS_AGAIN; ++ } else ++ goto again; + } + + if (result < 0) { +@@ -153,7 +156,7 @@ do_handshake (SoupGNUTLSChannel *chan, G + return G_IO_STATUS_ERROR; + } + +- if (chan->type == SOUP_SSL_TYPE_CLIENT && chan->cred->have_ca_file && ++ if (chan->type == SOUP_SSL_TYPE_CLIENT && chan->creds->have_ca_file && + !verify_certificate (chan->session, chan->hostname, err)) + return G_IO_STATUS_ERROR; + +@@ -172,6 +175,7 @@ soup_gnutls_read (GIOChannel *channel, + + *bytes_read = 0; + ++again: + if (!chan->established) { + result = do_handshake (chan, err); + +@@ -186,13 +190,17 @@ soup_gnutls_read (GIOChannel *channel, + + if (result == GNUTLS_E_REHANDSHAKE) { + chan->established = FALSE; +- return G_IO_STATUS_AGAIN; ++ goto again; + } + +- if (result < 0) { +- if ((result == GNUTLS_E_INTERRUPTED) || +- (result == GNUTLS_E_AGAIN)) ++ if (result == GNUTLS_E_INTERRUPTED || result == GNUTLS_E_AGAIN) { ++ if (SOUP_GNUTLS_CHANNEL_NONBLOCKING (chan)) + return G_IO_STATUS_AGAIN; ++ else ++ goto again; ++ } ++ ++ if (result < 0) { + g_set_error (err, G_IO_CHANNEL_ERROR, + G_IO_CHANNEL_ERROR_FAILED, + "Received corrupted data"); +@@ -216,6 +224,7 @@ soup_gnutls_write (GIOChannel *channel + + *bytes_written = 0; + ++again: + if (!chan->established) { + result = do_handshake (chan, err); + +@@ -228,15 +237,22 @@ soup_gnutls_write (GIOChannel *channel + + result = gnutls_record_send (chan->session, buf, count); + ++ /* I'm pretty sure this can't actually happen in response to a ++ * write, but... ++ */ + if (result == GNUTLS_E_REHANDSHAKE) { + chan->established = FALSE; +- return G_IO_STATUS_AGAIN; ++ goto again; + } + +- if (result < 0) { +- if ((result == GNUTLS_E_INTERRUPTED) || +- (result == GNUTLS_E_AGAIN)) ++ if (result == GNUTLS_E_INTERRUPTED || result == GNUTLS_E_AGAIN) { ++ if (SOUP_GNUTLS_CHANNEL_NONBLOCKING (chan)) + return G_IO_STATUS_AGAIN; ++ else ++ goto again; ++ } ++ ++ if (result < 0) { + g_set_error (err, G_IO_CHANNEL_ERROR, + G_IO_CHANNEL_ERROR_FAILED, + "Received corrupted data"); +@@ -352,7 +368,7 @@ THROW_CREATE_ERROR: + * @sock: a #GIOChannel wrapping a TCP socket. + * @type: whether this is a client or server socket + * @remote_host: the hostname of the remote machine +- * @credentials: a client or server credentials structure ++ * @creds: a client or server credentials structure + * + * This attempts to wrap a new #GIOChannel around @sock that + * will SSL-encrypt/decrypt all traffic through it. +@@ -362,17 +378,16 @@ THROW_CREATE_ERROR: + **/ + GIOChannel * + soup_ssl_wrap_iochannel (GIOChannel *sock, SoupSSLType type, +- const char *remote_host, gpointer credentials) ++ const char *remote_host, SoupSSLCredentials *creds) + { + SoupGNUTLSChannel *chan = NULL; + GIOChannel *gchan = NULL; + gnutls_session session = NULL; +- SoupGNUTLSCred *cred = credentials; + int sockfd; + int ret; + + g_return_val_if_fail (sock != NULL, NULL); +- g_return_val_if_fail (credentials != NULL, NULL); ++ g_return_val_if_fail (creds != NULL, NULL); + + sockfd = g_io_channel_unix_get_fd (sock); + if (!sockfd) { +@@ -389,7 +404,7 @@ soup_ssl_wrap_iochannel (GIOChannel *soc + goto THROW_CREATE_ERROR; + + if (gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, +- cred->cred) != 0) ++ creds->creds) != 0) + goto THROW_CREATE_ERROR; + + if (type == SOUP_SSL_TYPE_SERVER) +@@ -401,7 +416,7 @@ soup_ssl_wrap_iochannel (GIOChannel *soc + chan->fd = sockfd; + chan->real_sock = sock; + chan->session = session; +- chan->cred = cred; ++ chan->creds = creds; + chan->hostname = g_strdup (remote_host); + chan->type = type; + g_io_channel_ref (sock); +@@ -451,22 +466,22 @@ soup_gnutls_init (void) + * Return value: the client credentials, which must be freed with + * soup_ssl_free_client_credentials(). + **/ +-gpointer ++SoupSSLCredentials * + soup_ssl_get_client_credentials (const char *ca_file) + { +- SoupGNUTLSCred *cred; ++ SoupSSLCredentials *creds; + int status; + + if (!soup_gnutls_inited) + soup_gnutls_init (); + +- cred = g_new0 (SoupGNUTLSCred, 1); +- gnutls_certificate_allocate_credentials (&cred->cred); ++ creds = g_new0 (SoupSSLCredentials, 1); ++ gnutls_certificate_allocate_credentials (&creds->creds); + + if (ca_file) { +- cred->have_ca_file = TRUE; ++ creds->have_ca_file = TRUE; + status = gnutls_certificate_set_x509_trust_file ( +- cred->cred, ca_file, GNUTLS_X509_FMT_PEM); ++ creds->creds, ca_file, GNUTLS_X509_FMT_PEM); + if (status < 0) { + g_warning ("Failed to set SSL trust file (%s).", + ca_file); +@@ -478,7 +493,7 @@ soup_ssl_get_client_credentials (const c + } + } + +- return cred; ++ return creds; + } + + /** +@@ -486,15 +501,13 @@ soup_ssl_get_client_credentials (const c + * @creds: a client credentials structure returned by + * soup_ssl_get_client_credentials(). + * +- * Frees @client_creds. ++ * Frees @creds. + **/ + void +-soup_ssl_free_client_credentials (gpointer creds) ++soup_ssl_free_client_credentials (SoupSSLCredentials *creds) + { +- SoupGNUTLSCred *cred = creds; +- +- gnutls_certificate_free_credentials (cred->cred); +- g_free (cred); ++ gnutls_certificate_free_credentials (creds->creds); ++ g_free (creds); + } + + /** +@@ -510,10 +523,10 @@ soup_ssl_free_client_credentials (gpoint + * Return value: the server credentials, which must be freed with + * soup_ssl_free_server_credentials(). + **/ +-gpointer ++SoupSSLCredentials * + soup_ssl_get_server_credentials (const char *cert_file, const char *key_file) + { +- SoupGNUTLSCred *cred; ++ SoupSSLCredentials *creds; + + if (!soup_gnutls_inited) + soup_gnutls_init (); +@@ -522,20 +535,20 @@ soup_ssl_get_server_credentials (const c + return NULL; + } + +- cred = g_new0 (SoupGNUTLSCred, 1); +- gnutls_certificate_allocate_credentials (&cred->cred); ++ creds = g_new0 (SoupSSLCredentials, 1); ++ gnutls_certificate_allocate_credentials (&creds->creds); + +- if (gnutls_certificate_set_x509_key_file (cred->cred, ++ if (gnutls_certificate_set_x509_key_file (creds->creds, + cert_file, key_file, + GNUTLS_X509_FMT_PEM) != 0) { + g_warning ("Failed to set SSL certificate and key files " + "(%s, %s).", cert_file, key_file); +- soup_ssl_free_server_credentials (cred); ++ soup_ssl_free_server_credentials (creds); + return NULL; + } + +- gnutls_certificate_set_dh_params (cred->cred, dh_params); +- return cred; ++ gnutls_certificate_set_dh_params (creds->creds, dh_params); ++ return creds; + } + + /** +@@ -543,15 +556,13 @@ soup_ssl_get_server_credentials (const c + * @creds: a server credentials structure returned by + * soup_ssl_get_server_credentials(). + * +- * Frees @server_creds. ++ * Frees @creds. + **/ + void +-soup_ssl_free_server_credentials (gpointer creds) ++soup_ssl_free_server_credentials (SoupSSLCredentials *creds) + { +- SoupGNUTLSCred *cred = creds; +- +- gnutls_certificate_free_credentials (cred->cred); +- g_free (cred); ++ gnutls_certificate_free_credentials (creds->creds); ++ g_free (creds); + } + + #endif /* HAVE_SSL */ +diff -ruNp libsoup-2.2.100/libsoup/soup-message.c libsoup-2.2.100/libsoup/soup-message.c +--- libsoup-2.2.100/libsoup/soup-message.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-message.c 2007-04-09 17:03:24.000000000 -0400 +@@ -70,6 +70,11 @@ finalize (GObject *object) + if (priv->uri) + soup_uri_free (priv->uri); + ++ if (priv->auth) ++ g_object_unref (priv->auth); ++ if (priv->proxy_auth) ++ g_object_unref (priv->proxy_auth); ++ + if (msg->request.owner == SOUP_BUFFER_SYSTEM_OWNED) + g_free (msg->request.body); + if (msg->response.owner == SOUP_BUFFER_SYSTEM_OWNED) +@@ -725,6 +730,110 @@ soup_message_foreach_header (GHashTable + } + + /** ++ * soup_message_set_auth: ++ * @msg: a #SoupMessage ++ * @auth: a #SoupAuth, or %NULL ++ * ++ * Sets @msg to authenticate to its destination using @auth, which ++ * must have already been fully authenticated. If @auth is %NULL, @msg ++ * will not authenticate to its destination. ++ **/ ++void ++soup_message_set_auth (SoupMessage *msg, SoupAuth *auth) ++{ ++ SoupMessagePrivate *priv; ++ char *token; ++ ++ g_return_if_fail (SOUP_IS_MESSAGE (msg)); ++ g_return_if_fail (auth == NULL || SOUP_IS_AUTH (auth)); ++ g_return_if_fail (auth == NULL || soup_auth_is_authenticated (auth)); ++ ++ priv = SOUP_MESSAGE_GET_PRIVATE (msg); ++ ++ if (priv->auth) ++ g_object_unref (priv->auth); ++ soup_message_remove_header (msg->request_headers, "Authorization"); ++ priv->auth = auth; ++ if (!priv->auth) ++ return; ++ ++ g_object_ref (priv->auth); ++ token = soup_auth_get_authorization (auth, msg); ++ soup_message_add_header (msg->request_headers, "Authorization", token); ++ g_free (token); ++} ++ ++/** ++ * soup_message_get_auth: ++ * @msg: a #SoupMessage ++ * ++ * Gets the #SoupAuth used by @msg for authentication. ++ * ++ * Return value: the #SoupAuth used by @msg for authentication, or ++ * %NULL if @msg is unauthenticated. ++ **/ ++SoupAuth * ++soup_message_get_auth (SoupMessage *msg) ++{ ++ g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL); ++ ++ return SOUP_MESSAGE_GET_PRIVATE (msg)->auth; ++} ++ ++/** ++ * soup_message_set_proxy_auth: ++ * @msg: a #SoupMessage ++ * @auth: a #SoupAuth, or %NULL ++ * ++ * Sets @msg to authenticate to its proxy using @auth, which must have ++ * already been fully authenticated. If @auth is %NULL, @msg will not ++ * authenticate to its proxy. ++ **/ ++void ++soup_message_set_proxy_auth (SoupMessage *msg, SoupAuth *auth) ++{ ++ SoupMessagePrivate *priv; ++ char *token; ++ ++ g_return_if_fail (SOUP_IS_MESSAGE (msg)); ++ g_return_if_fail (auth == NULL || SOUP_IS_AUTH (auth)); ++ g_return_if_fail (auth == NULL || soup_auth_is_authenticated (auth)); ++ ++ priv = SOUP_MESSAGE_GET_PRIVATE (msg); ++ ++ if (priv->proxy_auth) ++ g_object_unref (priv->proxy_auth); ++ soup_message_remove_header (msg->request_headers, ++ "Proxy-Authorization"); ++ priv->proxy_auth = auth; ++ if (!priv->proxy_auth) ++ return; ++ ++ g_object_ref (priv->proxy_auth); ++ token = soup_auth_get_authorization (auth, msg); ++ soup_message_add_header (msg->request_headers, ++ "Proxy-Authorization", token); ++ g_free (token); ++} ++ ++/** ++ * soup_message_get_proxy_auth: ++ * @msg: a #SoupMessage ++ * ++ * Gets the #SoupAuth used by @msg for authentication to its proxy.. ++ * ++ * Return value: the #SoupAuth used by @msg for authentication to its ++ * proxy, or %NULL if @msg isn't authenticated to its proxy. ++ **/ ++SoupAuth * ++soup_message_get_proxy_auth (SoupMessage *msg) ++{ ++ g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL); ++ ++ return SOUP_MESSAGE_GET_PRIVATE (msg)->proxy_auth; ++} ++ ++/** + * soup_message_cleanup_response: + * @req: a #SoupMessage + * +@@ -984,9 +1093,7 @@ soup_message_get_response_encoding (Soup + { + SoupMethodId method = soup_method_get_id (msg->method); + +- /* FIXME: should CONNECT really be here? Where does it say that? */ + if (method == SOUP_METHOD_ID_HEAD || +- method == SOUP_METHOD_ID_CONNECT || + msg->status_code == SOUP_STATUS_NO_CONTENT || + msg->status_code == SOUP_STATUS_NOT_MODIFIED || + SOUP_STATUS_IS_INFORMATIONAL (msg->status_code)) +@@ -1022,7 +1129,9 @@ soup_message_get_response_encoding (Soup + *content_length = lval; + return SOUP_TRANSFER_CONTENT_LENGTH; + } +- } else ++ } else if (method == SOUP_METHOD_ID_CONNECT) ++ return SOUP_TRANSFER_NONE; ++ else + return SOUP_TRANSFER_EOF; + } + } +diff -ruNp libsoup-2.2.100/libsoup/soup-message-private.h libsoup-2.2.100/libsoup/soup-message-private.h +--- libsoup-2.2.100/libsoup/soup-message-private.h 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-message-private.h 2007-04-09 17:03:24.000000000 -0400 +@@ -6,7 +6,8 @@ + #ifndef SOUP_MESSAGE_PRIVATE_H + #define SOUP_MESSAGE_PRIVATE_H 1 + +-#include ++#include "soup-message.h" ++#include "soup-auth.h" + + typedef struct { + gpointer io_data; +@@ -20,6 +21,8 @@ typedef struct { + SoupHttpVersion http_version; + + SoupUri *uri; ++ ++ SoupAuth *auth, *proxy_auth; + } SoupMessagePrivate; + #define SOUP_MESSAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_MESSAGE, SoupMessagePrivate)) + +@@ -57,4 +60,12 @@ void soup_message_io_server (SoupMessag + SoupMessageParseHeadersFn parse_headers_cb, + gpointer user_data); + ++/* Auth handling */ ++void soup_message_set_auth (SoupMessage *msg, ++ SoupAuth *auth); ++SoupAuth *soup_message_get_auth (SoupMessage *msg); ++void soup_message_set_proxy_auth (SoupMessage *msg, ++ SoupAuth *auth); ++SoupAuth *soup_message_get_proxy_auth (SoupMessage *msg); ++ + #endif /* SOUP_MESSAGE_PRIVATE_H */ +diff -ruNp libsoup-2.2.100/libsoup/soup-misc.c libsoup-2.2.100/libsoup/soup-misc.c +--- libsoup-2.2.100/libsoup/soup-misc.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-misc.c 2007-04-09 17:03:24.000000000 -0400 +@@ -50,16 +50,6 @@ soup_str_case_equal (gconstpointer v1, + return g_ascii_strcasecmp (string1, string2) == 0; + } + +-/* Base64 utils (straight from camel-mime-utils.c) */ +-#define d(x) +- +-static const char *base64_alphabet = +- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +- +-/* +- * call this when finished encoding everything, to +- * flush off the last little bit +- */ + int + soup_base64_encode_close (const guchar *in, + int inlen, +@@ -68,53 +58,19 @@ soup_base64_encode_close (const guchar + int *state, + int *save) + { +- int c1, c2; +- unsigned char *outptr = out; +- +- if (inlen > 0) +- outptr += soup_base64_encode_step (in, +- inlen, +- break_lines, +- outptr, +- state, +- save); +- +- c1 = ((unsigned char *) save) [1]; +- c2 = ((unsigned char *) save) [2]; +- +- d(printf("mode = %d\nc1 = %c\nc2 = %c\n", +- (int)((char *) save) [0], +- (int)((char *) save) [1], +- (int)((char *) save) [2])); +- +- switch (((char *) save) [0]) { +- case 2: +- outptr [2] = base64_alphabet[ ( (c2 &0x0f) << 2 ) ]; +- g_assert (outptr [2] != 0); +- goto skip; +- case 1: +- outptr[2] = '='; +- skip: +- outptr [0] = base64_alphabet [ c1 >> 2 ]; +- outptr [1] = base64_alphabet [ c2 >> 4 | ( (c1&0x3) << 4 )]; +- outptr [3] = '='; +- outptr += 4; +- break; ++ if (inlen > 0) { ++ out += soup_base64_encode_step (in, ++ inlen, ++ break_lines, ++ out, ++ state, ++ save); + } +- if (break_lines) +- *outptr++ = '\n'; +- +- *save = 0; +- *state = 0; + +- return outptr-out; ++ return (int)g_base64_encode_close (break_lines, (char *) out, ++ state, save); + } + +-/* +- * performs an 'encode step', only encodes blocks of 3 characters to the +- * output at a time, saves left-over state in state and save (initialise to +- * 0 on first invocation). +- */ + int + soup_base64_encode_step (const guchar *in, + int len, +@@ -123,142 +79,16 @@ soup_base64_encode_step (const guchar * + int *state, + int *save) + { +- register guchar *outptr; +- register const guchar *inptr; +- +- if (len <= 0) +- return 0; +- +- inptr = in; +- outptr = out; +- +- d (printf ("we have %d chars, and %d saved chars\n", +- len, +- ((char *) save) [0])); +- +- if (len + ((char *) save) [0] > 2) { +- const guchar *inend = in+len-2; +- register int c1, c2, c3; +- register int already; +- +- already = *state; +- +- switch (((char *) save) [0]) { +- case 1: c1 = ((unsigned char *) save) [1]; goto skip1; +- case 2: c1 = ((unsigned char *) save) [1]; +- c2 = ((unsigned char *) save) [2]; goto skip2; +- } +- +- /* +- * yes, we jump into the loop, no i'm not going to change it, +- * it's beautiful! +- */ +- while (inptr < inend) { +- c1 = *inptr++; +- skip1: +- c2 = *inptr++; +- skip2: +- c3 = *inptr++; +- *outptr++ = base64_alphabet [ c1 >> 2 ]; +- *outptr++ = base64_alphabet [ c2 >> 4 | +- ((c1&0x3) << 4) ]; +- *outptr++ = base64_alphabet [ ((c2 &0x0f) << 2) | +- (c3 >> 6) ]; +- *outptr++ = base64_alphabet [ c3 & 0x3f ]; +- /* this is a bit ugly ... */ +- if (break_lines && (++already)>=19) { +- *outptr++='\n'; +- already = 0; +- } +- } +- +- ((char *)save)[0] = 0; +- len = 2-(inptr-inend); +- *state = already; +- } +- +- d(printf("state = %d, len = %d\n", +- (int)((char *)save)[0], +- len)); +- +- if (len>0) { +- register char *saveout; +- +- /* points to the slot for the next char to save */ +- saveout = & (((char *)save)[1]) + ((char *)save)[0]; +- +- /* len can only be 0 1 or 2 */ +- switch(len) { +- case 2: *saveout++ = *inptr++; +- case 1: *saveout++ = *inptr++; +- } +- ((char *)save)[0]+=len; +- } +- +- d(printf("mode = %d\nc1 = %c\nc2 = %c\n", +- (int)((char *)save)[0], +- (int)((char *)save)[1], +- (int)((char *)save)[2])); +- +- return outptr-out; ++ return (int)g_base64_encode_step (in, len, break_lines, ++ (char *)out, state, save); + } + +-/** +- * soup_base64_encode: +- * @text: the binary data to encode. +- * @len: the length of @text. +- * +- * Encode a sequence of binary data into it's Base-64 stringified +- * representation. +- * +- * Return value: The Base-64 encoded string representing @text. +- */ + char * + soup_base64_encode (const char *text, int len) + { +- unsigned char *out; +- int state = 0, outlen, save = 0; +- +- out = g_malloc (len * 4 / 3 + 5); +- outlen = soup_base64_encode_close ((const guchar *)text, +- len, +- FALSE, +- out, +- &state, +- &save); +- out[outlen] = '\0'; +- return (char *) out; +-} +- +-static unsigned char camel_mime_base64_rank[256] = { +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63, +- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255, +- 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255, +- 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, +- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, +-}; ++ return g_base64_encode ((const guchar *)text, len); ++} + +-/** +- * base64_decode_step: decode a chunk of base64 encoded data +- * @in: input stream +- * @len: max length of data to decode +- * @out: output stream +- * @state: holds the number of bits that are stored in @save +- * @save: leftover bits that have not yet been decoded +- * +- * Decodes a chunk of base64 encoded data +- **/ + int + soup_base64_decode_step (const guchar *in, + int len, +@@ -266,68 +96,20 @@ soup_base64_decode_step (const guchar * + int *state, + guint *save) + { +- register const guchar *inptr; +- register guchar *outptr; +- const guchar *inend; +- guchar c; +- register unsigned int v; +- int i; +- +- inend = in+len; +- outptr = out; +- +- /* convert 4 base64 bytes to 3 normal bytes */ +- v=*save; +- i=*state; +- inptr = in; +- while (inptr < inend) { +- c = camel_mime_base64_rank [*inptr++]; +- if (c != 0xff) { +- v = (v<<6) | c; +- i++; +- if (i==4) { +- *outptr++ = v>>16; +- *outptr++ = v>>8; +- *outptr++ = v; +- i=0; +- } +- } +- } +- +- *save = v; +- *state = i; +- +- /* quick scan back for '=' on the end somewhere */ +- /* fortunately we can drop 1 output char for each trailing = (upto 2) */ +- i=2; +- while (inptr > in && i) { +- inptr--; +- if (camel_mime_base64_rank [*inptr] != 0xff) { +- if (*inptr == '=') +- outptr--; +- i--; +- } +- } +- +- /* if i!= 0 then there is a truncation error! */ +- return outptr - out; ++ return (int) g_base64_decode_step ((const char *)in, len, ++ out, state, save); + } + + char * + soup_base64_decode (const char *text, + int *out_len) + { +- guchar *ret; +- int inlen, state = 0; +- unsigned int save = 0; +- +- inlen = strlen (text); +- ret = g_malloc0 (inlen); +- +- *out_len = soup_base64_decode_step ((const guchar *)text, inlen, +- ret, &state, &save); ++ char *ret; ++ gsize out_len_tmp; + +- return (char *)ret; ++ ret = (char *) g_base64_decode (text, &out_len_tmp); ++ *out_len = out_len_tmp; ++ return ret; + } + + typedef struct { +diff -ruNp libsoup-2.2.100/libsoup/soup-misc.h libsoup-2.2.100/libsoup/soup-misc.h +--- libsoup-2.2.100/libsoup/soup-misc.h 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-misc.h 2007-04-09 17:03:24.000000000 -0400 +@@ -9,7 +9,8 @@ + #include + #include + +-/* Base64 encoding/decoding */ ++#ifndef LIBSOUP_DISABLE_DEPRECATED ++/* Base64 encoding/decoding. DEPRECATED: use */ + + char *soup_base64_encode (const char *text, + int len); +@@ -36,6 +37,7 @@ int soup_base64_decode_st + guchar *out, + int *state, + guint *save); ++#endif /* LIBSOUP_DISABLE_DEPRECATED */ + + /* Non-default-GMainContext operations */ + GSource *soup_add_io_watch (GMainContext *async_context, +diff -ruNp libsoup-2.2.100/libsoup/soup-server-auth.c libsoup-2.2.100/libsoup/soup-server-auth.c +--- libsoup-2.2.100/libsoup/soup-server-auth.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-server-auth.c 2007-04-09 17:03:24.000000000 -0400 +@@ -352,23 +352,24 @@ soup_server_auth_new (SoupServerAuthCont + switch (type) { + case SOUP_AUTH_TYPE_BASIC: + { +- gchar *userpass, *colon; +- gint len; ++ guchar *userpass, *colon; ++ gsize len; + +- userpass = soup_base64_decode (header, &len); ++ userpass = g_base64_decode (header, &len); + if (!userpass) + break; + +- colon = strchr (userpass, ':'); ++ colon = memchr (userpass, ':', len); + if (!colon) { + g_free (userpass); + break; + } + + ret->basic.type = SOUP_AUTH_TYPE_BASIC; +- ret->basic.user = g_strndup (userpass, ++ ret->basic.user = g_strndup ((char *)userpass, + colon - userpass); +- ret->basic.passwd = g_strdup (colon + 1); ++ ret->basic.passwd = g_strndup ((char *)colon + 1, ++ len - (colon + 1 - userpass)); + + g_free (userpass); + +diff -ruNp libsoup-2.2.100/libsoup/soup-server.c libsoup-2.2.100/libsoup/soup-server.c +--- libsoup-2.2.100/libsoup/soup-server.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-server.c 2007-05-01 14:29:21.000000000 -0400 +@@ -33,7 +33,7 @@ typedef struct { + guint port; + + char *ssl_cert_file, *ssl_key_file; +- gpointer ssl_creds; ++ SoupSSLCredentials *ssl_creds; + + GMainLoop *loop; + +diff -ruNp libsoup-2.2.100/libsoup/soup-session-async.c libsoup-2.2.100/libsoup/soup-session-async.c +--- libsoup-2.2.100/libsoup/soup-session-async.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-session-async.c 2007-04-09 17:03:24.000000000 -0400 +@@ -184,6 +184,19 @@ final_finished (SoupMessage *req, gpoint + run_queue (sa, FALSE); + } + ++static gboolean ++idle_run_queue (gpointer user_data) ++{ ++ SoupSessionAsync *sa = user_data; ++ ++ g_object_add_weak_pointer (G_OBJECT (sa), (gpointer)&sa); ++ g_object_unref (sa); ++ ++ if (sa) ++ run_queue (sa, TRUE); ++ return FALSE; ++} ++ + static void + queue_message (SoupSession *session, SoupMessage *req, + SoupMessageCallbackFn callback, gpointer user_data) +@@ -202,7 +215,8 @@ queue_message (SoupSession *session, Sou + + SOUP_SESSION_CLASS (soup_session_async_parent_class)->queue_message (session, req, callback, user_data); + +- run_queue (sa, TRUE); ++ g_object_ref (sa); ++ g_idle_add (idle_run_queue, sa); + } + + static guint +diff -ruNp libsoup-2.2.100/libsoup/soup-session.c libsoup-2.2.100/libsoup/soup-session.c +--- libsoup-2.2.100/libsoup/soup-session.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-session.c 2007-05-01 16:00:48.000000000 -0400 +@@ -19,6 +19,7 @@ + #include "soup-connection-ntlm.h" + #include "soup-marshal.h" + #include "soup-message-filter.h" ++#include "soup-message-private.h" + #include "soup-message-queue.h" + #include "soup-ssl.h" + #include "soup-uri.h" +@@ -39,7 +40,7 @@ typedef struct { + gboolean use_ntlm; + + char *ssl_ca_file; +- gpointer ssl_creds; ++ SoupSSLCredentials *ssl_creds; + + GSList *filters; + +@@ -744,8 +745,7 @@ authenticate_auth (SoupSession *session, + + static gboolean + update_auth_internal (SoupSession *session, SoupMessage *msg, +- const GSList *headers, gboolean proxy, +- gboolean got_unauthorized) ++ const GSList *headers, gboolean proxy) + { + SoupSessionHost *host; + SoupAuth *new_auth, *prior_auth, *old_auth; +@@ -772,20 +772,11 @@ update_auth_internal (SoupSession *sessi + return FALSE; + + /* See if this auth is the same auth we used last time */ +- prior_auth = lookup_auth (session, msg, proxy); ++ prior_auth = proxy ? soup_message_get_proxy_auth (msg) : soup_message_get_auth (msg); + if (prior_auth && + G_OBJECT_TYPE (prior_auth) == G_OBJECT_TYPE (new_auth) && + !strcmp (soup_auth_get_realm (prior_auth), + soup_auth_get_realm (new_auth))) { +- if (!got_unauthorized) { +- /* The user is just trying to preauthenticate +- * using information we already have, so +- * there's nothing more that needs to be done. +- */ +- g_object_unref (new_auth); +- return TRUE; +- } +- + /* The server didn't like the username/password we + * provided before. Invalidate it and note this fact. + */ +@@ -891,7 +882,7 @@ authorize_handler (SoupMessage *msg, gpo + if (!headers) + return; + +- if (update_auth_internal (session, msg, headers, proxy, TRUE)) ++ if (update_auth_internal (session, msg, headers, proxy)) + soup_session_requeue_message (session, msg); + } + +@@ -926,23 +917,18 @@ redirect_handler (SoupMessage *msg, gpoi + static void + add_auth (SoupSession *session, SoupMessage *msg, gboolean proxy) + { +- const char *header = proxy ? "Proxy-Authorization" : "Authorization"; + SoupAuth *auth; +- char *token; + + auth = lookup_auth (session, msg, proxy); +- if (!auth) +- return; +- if (!soup_auth_is_authenticated (auth) && +- !authenticate_auth (session, auth, msg, FALSE, proxy)) +- return; +- +- token = soup_auth_get_authorization (auth, msg); +- if (token) { +- soup_message_remove_header (msg->request_headers, header); +- soup_message_add_header (msg->request_headers, header, token); +- g_free (token); ++ if (auth && !soup_auth_is_authenticated (auth)) { ++ if (!authenticate_auth (session, auth, msg, FALSE, proxy)) ++ auth = NULL; + } ++ ++ if (proxy) ++ soup_message_set_proxy_auth (msg, auth); ++ else ++ soup_message_set_auth (msg, auth); + } + + static void +@@ -1273,8 +1259,9 @@ queue_message (SoupSession *session, Sou + * any resources related to the time it was last sent are freed. + * + * Upon message completion, the callback specified in @callback will +- * be invoked. If after returning from this callback the message has +- * not been requeued, @msg will be unreffed. ++ * be invoked (in the thread associated with @session's async ++ * context). If after returning from this callback the message has not ++ * been requeued, @msg will be unreffed. + */ + void + soup_session_queue_message (SoupSession *session, SoupMessage *msg, +diff -ruNp libsoup-2.2.100/libsoup/soup-session-sync.c libsoup-2.2.100/libsoup/soup-session-sync.c +--- libsoup-2.2.100/libsoup/soup-session-sync.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-session-sync.c 2007-04-09 17:07:39.000000000 -0400 +@@ -11,6 +11,7 @@ + + #include "soup-session-sync.h" + #include "soup-connection.h" ++#include "soup-misc.h" + + typedef struct { + GMutex *lock; +@@ -98,13 +99,63 @@ soup_session_sync_new_with_options (cons + return session; + } + ++typedef struct { ++ SoupSession *session; ++ SoupMessage *msg; ++ SoupMessageCallbackFn callback; ++ gpointer user_data; ++} SoupSessionSyncAsyncData; ++ ++static void ++async_data_free (SoupSessionSyncAsyncData *sad) ++{ ++ g_object_unref (sad->session); ++ g_object_unref (sad->msg); ++ g_free (sad); ++} ++ ++static gboolean ++queue_message_callback (gpointer data) ++{ ++ SoupSessionSyncAsyncData *sad = data; ++ ++ sad->callback (sad->msg, sad->user_data); ++ async_data_free (sad); ++ return FALSE; ++} ++ ++static gpointer ++queue_message_thread (gpointer data) ++{ ++ SoupSessionSyncAsyncData *sad = data; ++ ++ soup_session_send_message (sad->session, sad->msg); ++ if (sad->callback) { ++ GMainContext *async_context; ++ ++ g_object_get (sad->session, ++ SOUP_SESSION_ASYNC_CONTEXT, &async_context, ++ NULL); ++ soup_add_idle (async_context, queue_message_callback, sad); ++ } else ++ async_data_free (sad); ++ ++ return NULL; ++} + + static void + queue_message (SoupSession *session, SoupMessage *msg, + SoupMessageCallbackFn callback, gpointer user_data) + { +- /* FIXME */ +- g_warning ("soup_session_queue_message called on synchronous session"); ++ SoupSessionSyncAsyncData *sad; ++ ++ sad = g_new (SoupSessionSyncAsyncData, 1); ++ sad->session = g_object_ref (session); ++ sad->msg = g_object_ref (msg); ++ sad->callback = callback; ++ sad->user_data = user_data; ++ ++ g_thread_create (queue_message_thread, sad, FALSE, NULL); + } + + static SoupConnection * +@@ -130,7 +181,9 @@ wait_for_connection (SoupSession *sessio + * not return the no-longer-valid connection. + */ + +- if (!SOUP_STATUS_IS_SUCCESSFUL (status)) ++ if (status == SOUP_STATUS_TRY_AGAIN) ++ goto try_again; ++ else if (!SOUP_STATUS_IS_SUCCESSFUL (status)) + conn = NULL; + else if (msg->status == SOUP_MESSAGE_STATUS_FINISHED) { + /* Message was cancelled while we were +diff -ruNp libsoup-2.2.100/libsoup/soup-soap-message.c libsoup-2.2.100/libsoup/soup-soap-message.c +--- libsoup-2.2.100/libsoup/soup-soap-message.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-soap-message.c 2007-04-09 17:03:24.000000000 -0400 +@@ -513,7 +513,7 @@ soup_soap_message_write_double (SoupSoap + void + soup_soap_message_write_base64 (SoupSoapMessage *msg, const char *string, int len) + { +- gchar *str = soup_base64_encode (string, len); ++ gchar *str = g_base64_encode ((const guchar *)string, len); + soup_soap_message_write_string (msg, str); + g_free (str); + } +diff -ruNp libsoup-2.2.100/libsoup/soup-ssl.h libsoup-2.2.100/libsoup/soup-ssl.h +--- libsoup-2.2.100/libsoup/soup-ssl.h 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-ssl.h 2007-05-01 16:00:48.000000000 -0400 +@@ -20,16 +20,19 @@ typedef enum { + SOUP_SSL_TYPE_SERVER + } SoupSSLType; + +-gpointer soup_ssl_get_client_credentials (const char *ca_file); +-void soup_ssl_free_client_credentials (gpointer creds); +-gpointer soup_ssl_get_server_credentials (const char *cert_file, +- const char *key_file); +-void soup_ssl_free_server_credentials (gpointer creds); +- +-GIOChannel *soup_ssl_wrap_iochannel (GIOChannel *sock, +- SoupSSLType type, +- const char *remote_host, +- gpointer credentials); ++typedef struct SoupSSLCredentials SoupSSLCredentials; ++ ++SoupSSLCredentials *soup_ssl_get_client_credentials (const char *ca_file); ++void soup_ssl_free_client_credentials (SoupSSLCredentials *creds); ++ ++SoupSSLCredentials *soup_ssl_get_server_credentials (const char *cert_file, ++ const char *key_file); ++void soup_ssl_free_server_credentials (SoupSSLCredentials *creds); ++ ++GIOChannel *soup_ssl_wrap_iochannel (GIOChannel *sock, ++ SoupSSLType type, ++ const char *remote_host, ++ SoupSSLCredentials *creds); + + #define SOUP_SSL_ERROR soup_ssl_error_quark() + +diff -ruNp libsoup-2.2.100/libsoup/soup-types.h libsoup-2.2.100/libsoup/soup-types.h +--- libsoup-2.2.100/libsoup/soup-types.h 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-types.h 2007-04-12 16:40:44.000000000 -0400 +@@ -49,13 +49,4 @@ GType type_name##_get_type(void)\ + return type; \ + } + +-/* Compat for glib 2.6.x */ +-#ifndef G_GNUC_NULL_TERMINATED +-# if __GNUC__ >= 4 +-# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +-# else +-# define G_GNUC_NULL_TERMINATED +-# endif +-#endif +- + #endif +diff -ruNp libsoup-2.2.100/libsoup/soup-xmlrpc-message.c libsoup-2.2.100/libsoup/soup-xmlrpc-message.c +--- libsoup-2.2.100/libsoup/soup-xmlrpc-message.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-xmlrpc-message.c 2007-04-09 17:03:24.000000000 -0400 +@@ -226,7 +226,7 @@ soup_xmlrpc_message_write_base64 (SoupXm + g_return_if_fail (SOUP_IS_XMLRPC_MESSAGE (msg)); + priv = SOUP_XMLRPC_MESSAGE_GET_PRIVATE (msg); + +- str = soup_base64_encode (buf, len); ++ str = g_base64_encode (buf, len); + + priv->last_node = xmlNewChild (priv->last_node, NULL, (const xmlChar *)"value", NULL); + xmlNewTextChild (priv->last_node, NULL, (const xmlChar *)"base64", (xmlChar *)str); +diff -ruNp libsoup-2.2.100/libsoup/soup-xmlrpc-response.c libsoup-2.2.100/libsoup/soup-xmlrpc-response.c +--- libsoup-2.2.100/libsoup/soup-xmlrpc-response.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/libsoup/soup-xmlrpc-response.c 2007-04-09 17:03:24.000000000 -0400 +@@ -361,8 +361,8 @@ soup_xmlrpc_value_get_base64 (SoupXmlrpc + { + xmlNode *xml; + xmlChar *content; +- char *decoded; +- int len; ++ guchar *decoded; ++ gsize len; + + xml = (xmlNode *) value; + if (strcmp ((const char *)xml->name, "value")) +@@ -372,11 +372,11 @@ soup_xmlrpc_value_get_base64 (SoupXmlrpc + return FALSE; + + content = xmlNodeGetContent (xml); +- decoded = soup_base64_decode ((const char *)content, &len); ++ decoded = g_base64_decode ((const char *)content, &len); + xmlFree (content); + + *data = g_byte_array_new (); +- g_byte_array_append (*data, (guchar *)decoded, len); ++ g_byte_array_append (*data, decoded, len); + g_free (decoded); + + return TRUE; +diff -ruNp libsoup-2.2.100/Makefile.in libsoup-2.2.100/Makefile.in +--- libsoup-2.2.100/Makefile.in 2007-02-12 10:34:12.000000000 -0500 ++++ libsoup-2.2.100/Makefile.in 2007-05-01 15:49:11.000000000 -0400 +@@ -80,6 +80,8 @@ AMDEP_TRUE = @AMDEP_TRUE@ + AMTAR = @AMTAR@ + 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@ +@@ -119,6 +121,8 @@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE + GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ + HAVE_APACHE_FALSE = @HAVE_APACHE_FALSE@ + HAVE_APACHE_TRUE = @HAVE_APACHE_TRUE@ ++HAVE_SSL_FALSE = @HAVE_SSL_FALSE@ ++HAVE_SSL_TRUE = @HAVE_SSL_TRUE@ + HAVE_XMLRPC_EPI_PHP_FALSE = @HAVE_XMLRPC_EPI_PHP_FALSE@ + HAVE_XMLRPC_EPI_PHP_TRUE = @HAVE_XMLRPC_EPI_PHP_TRUE@ + HTML_DIR = @HTML_DIR@ +@@ -128,6 +132,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LDFLAGS = @LDFLAGS@ ++LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ ++LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ ++LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ + LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ + LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ + LIBOBJS = @LIBOBJS@ +diff -ruNp libsoup-2.2.100/tests/auth-test.c libsoup-2.2.100/tests/auth-test.c +--- libsoup-2.2.100/tests/auth-test.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/tests/auth-test.c 2007-04-09 17:03:24.000000000 -0400 +@@ -14,6 +14,7 @@ + #include "apache-wrapper.h" + #endif + ++GMainLoop *loop; + int errors = 0; + + typedef struct { +@@ -243,12 +244,69 @@ reauthenticate (SoupSession *session, So + } + } + ++static void ++bug271540_sent (SoupMessage *msg, gpointer data) ++{ ++ int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "#")); ++ gboolean *authenticated = data; ++ int auth = identify_auth (msg); ++ ++ if (!*authenticated && auth) { ++ printf (" using auth on message %d before authenticating!!??\n", n); ++ errors++; ++ } else if (*authenticated && !auth) { ++ printf (" sent unauthenticated message %d after authenticating!\n", n); ++ errors++; ++ } ++} ++ ++static void ++bug271540_authenticate (SoupSession *session, SoupMessage *msg, ++ const char *auth_type, const char *auth_realm, ++ char **username, char **password, gpointer data) ++{ ++ int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "#")); ++ gboolean *authenticated = data; ++ ++ if (strcmp (auth_type, "Basic") != 0 || ++ strcmp (auth_realm, "realm1") != 0) ++ return; ++ ++ if (!*authenticated) { ++ printf (" authenticating message %d\n", n); ++ *username = g_strdup ("user1"); ++ *password = g_strdup ("realm1"); ++ *authenticated = TRUE; ++ } else { ++ printf (" asked to authenticate message %d after authenticating!\n", n); ++ errors++; ++ } ++} ++ ++static void ++bug271540_finished (SoupMessage *msg, gpointer data) ++{ ++ int *left = data; ++ int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "#")); ++ ++ if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { ++ printf (" got status '%d %s' on message %d!\n", ++ msg->status_code, msg->reason_phrase, n); ++ errors++; ++ } ++ ++ (*left)--; ++ if (!*left) ++ g_main_loop_quit (loop); ++} ++ + int + main (int argc, char **argv) + { + SoupSession *session; + SoupMessage *msg; + char *base_uri, *uri, *expected; ++ gboolean authenticated; + #ifdef HAVE_APACHE + gboolean using_apache = FALSE; + #endif +@@ -325,6 +383,30 @@ main (int argc, char **argv) + + g_object_unref (msg); + } ++ g_object_unref (session); ++ ++ /* And now for a regression test */ ++ ++ printf ("Regression test for bug 271540:\n"); ++ session = soup_session_async_new (); ++ ++ authenticated = FALSE; ++ g_signal_connect (session, "authenticate", ++ G_CALLBACK (bug271540_authenticate), &authenticated); ++ ++ uri = g_strconcat (base_uri, "Basic/realm1/", NULL); ++ for (i = 0; i < 10; i++) { ++ msg = soup_message_new (SOUP_METHOD_GET, uri); ++ g_object_set_data (G_OBJECT (msg), "#", GINT_TO_POINTER (i + 1)); ++ g_signal_connect (msg, "wrote_headers", ++ G_CALLBACK (bug271540_sent), &authenticated); ++ ++ soup_session_queue_message (session, msg, ++ bug271540_finished, &i); ++ } ++ ++ loop = g_main_loop_new (NULL, TRUE); ++ g_main_loop_run (loop); + + g_object_unref (session); + +diff -ruNp libsoup-2.2.100/tests/get.c libsoup-2.2.100/tests/get.c +--- libsoup-2.2.100/tests/get.c 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/tests/get.c 2007-04-09 17:03:24.000000000 -0400 +@@ -26,6 +26,7 @@ const char *method = SOUP_METHOD_GET; + char *base; + SoupUri *base_uri; + int pending; ++GHashTable *fetched_urls; + + static GPtrArray * + find_hrefs (const SoupUri *base, const char *body, int length) +@@ -98,8 +99,6 @@ mkdirs (const char *path) + } + } + +-static void get_url (const char *url); +- + static void + print_header (gpointer name, gpointer value, gpointer data) + { +@@ -107,18 +106,57 @@ print_header (gpointer name, gpointer va + } + + static void +-got_url (SoupMessage *msg, gpointer uri) ++get_url (const char *url) + { +- char *name; ++ char *url_to_get, *slash, *name; ++ SoupMessage *msg; + int fd, i; ++ SoupUri *uri; + GPtrArray *hrefs; + const char *header; + ++ if (strncmp (url, base, strlen (base)) != 0) ++ return; ++ if (strchr (url, '?') && strcmp (url, base) != 0) ++ return; ++ ++ slash = strrchr (url, '/'); ++ if (slash && !slash[1]) ++ url_to_get = g_strdup_printf ("%sindex.html", url); ++ else ++ url_to_get = g_strdup (url); ++ ++ if (g_hash_table_lookup (fetched_urls, url_to_get)) ++ return; ++ g_hash_table_insert (fetched_urls, url_to_get, url_to_get); ++ ++ if (recurse) { ++ /* See if we're already downloading it, and create the ++ * file if not. ++ */ ++ ++ name = url_to_get + strlen (base); ++ if (*name == '/') ++ name++; ++ if (access (name, F_OK) == 0) ++ return; ++ ++ mkdirs (name); ++ fd = open (name, O_WRONLY | O_CREAT | O_TRUNC, 0644); ++ close (fd); ++ } ++ ++ msg = soup_message_new (method, url_to_get); ++ soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); ++ ++ soup_session_send_message (session, msg); ++ + name = soup_message_get_uri (msg)->path; + if (strncmp (base_uri->path, name, strlen (base_uri->path)) != 0) { + fprintf (stderr, " Error: not under %s\n", base_uri->path); +- goto DONE; ++ return; + } ++ + if (debug) { + char *path = soup_uri_to_string (soup_message_get_uri (msg), TRUE); + printf ("%s %s HTTP/1.%d\n\n", method, path, +@@ -136,18 +174,19 @@ got_url (SoupMessage *msg, gpointer uri) + name++; + + if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) { +- unlink (name); ++ if (recurse) ++ unlink (name); + header = soup_message_get_header (msg->response_headers, "Location"); + if (header) { + if (!debug) + printf (" -> %s\n", header); + get_url (header); + } +- goto DONE; ++ return; + } + + if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) +- goto DONE; ++ return; + + if (recurse) + fd = open (name, O_WRONLY | O_CREAT | O_TRUNC, 0644); +@@ -155,66 +194,21 @@ got_url (SoupMessage *msg, gpointer uri) + fd = STDOUT_FILENO; + write (fd, msg->response.body, msg->response.length); + if (!recurse) +- goto DONE; ++ return; + close (fd); + + header = soup_message_get_header (msg->response_headers, "Content-Type"); + if (header && g_ascii_strncasecmp (header, "text/html", 9) != 0) +- goto DONE; ++ return; + ++ uri = soup_uri_new (url); + hrefs = find_hrefs (uri, msg->response.body, msg->response.length); ++ soup_uri_free (uri); + for (i = 0; i < hrefs->len; i++) { + get_url (hrefs->pdata[i]); + g_free (hrefs->pdata[i]); + } + g_ptr_array_free (hrefs, TRUE); +- +- DONE: +- soup_uri_free (uri); +- if (!--pending) +- g_main_quit (loop); +-} +- +-static void +-get_url (const char *url) +-{ +- char *url_to_get, *slash, *name; +- SoupMessage *msg; +- int fd; +- +- if (strncmp (url, base, strlen (base)) != 0) +- return; +- +- slash = strrchr (url, '/'); +- if (slash && !slash[1]) +- url_to_get = g_strdup_printf ("%sindex.html", url); +- else +- url_to_get = g_strdup (url); +- +- if (recurse) { +- /* See if we're already downloading it, and create the +- * file if not. +- */ +- +- name = url_to_get + strlen (base); +- if (*name == '/') +- name++; +- if (access (name, F_OK) == 0) { +- g_free (url_to_get); +- return; +- } +- +- mkdirs (name); +- fd = open (name, O_WRONLY | O_CREAT | O_TRUNC, 0644); +- close (fd); +- } +- +- msg = soup_message_new (method, url_to_get); +- soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); +- +- pending++; +- soup_session_queue_message (session, msg, got_url, soup_uri_new (url)); +- g_free (url_to_get); + } + + static void +@@ -229,12 +223,13 @@ main (int argc, char **argv) + { + const char *cafile = NULL; + SoupUri *proxy = NULL; ++ gboolean synchronous = FALSE; + int opt; + + g_type_init (); + g_thread_init (NULL); + +- while ((opt = getopt (argc, argv, "c:dhp:r")) != -1) { ++ while ((opt = getopt (argc, argv, "c:dhp:rs")) != -1) { + switch (opt) { + case 'c': + cafile = optarg; +@@ -262,6 +257,10 @@ main (int argc, char **argv) + recurse = TRUE; + break; + ++ case 's': ++ synchronous = TRUE; ++ break; ++ + case '?': + usage (); + break; +@@ -279,10 +278,19 @@ main (int argc, char **argv) + exit (1); + } + +- session = soup_session_async_new_with_options ( +- SOUP_SESSION_SSL_CA_FILE, cafile, +- SOUP_SESSION_PROXY_URI, proxy, +- NULL); ++ fetched_urls = g_hash_table_new (g_str_hash, g_str_equal); ++ ++ if (synchronous) { ++ session = soup_session_sync_new_with_options ( ++ SOUP_SESSION_SSL_CA_FILE, cafile, ++ SOUP_SESSION_PROXY_URI, proxy, ++ NULL); ++ } else { ++ session = soup_session_async_new_with_options ( ++ SOUP_SESSION_SSL_CA_FILE, cafile, ++ SOUP_SESSION_PROXY_URI, proxy, ++ NULL); ++ } + + if (recurse) { + char *outdir; +@@ -297,11 +305,13 @@ main (int argc, char **argv) + g_free (outdir); + } + ++ if (!synchronous) ++ loop = g_main_loop_new (NULL, TRUE); ++ + get_url (base); + +- loop = g_main_loop_new (NULL, TRUE); +- g_main_run (loop); +- g_main_loop_unref (loop); ++ if (!synchronous) ++ g_main_loop_unref (loop); + + soup_uri_free (base_uri); + +diff -ruNp libsoup-2.2.100/tests/httpd.conf.in libsoup-2.2.100/tests/httpd.conf.in +--- libsoup-2.2.100/tests/httpd.conf.in 2007-01-02 13:25:11.000000000 -0500 ++++ libsoup-2.2.100/tests/httpd.conf.in 2007-04-09 17:03:24.000000000 -0400 +@@ -6,21 +6,161 @@ Listen 127.0.0.1:47524 + PidFile @builddir@/httpd.pid + DocumentRoot @srcdir@ + ++# The tests shut down apache with "graceful-stop", because that makes ++# it close its listening socket right away. But it seems to sometimes ++# result in apache never fully exiting. This fixes that. ++GracefulShutdownTimeout 1 ++ + # Change this to "./error.log" if it's failing and you don't know why + ErrorLog /dev/null + +-LoadModule alias_module @APACHE_MODULE_DIR@/mod_alias.so +-LoadModule auth_basic_module @APACHE_MODULE_DIR@/mod_auth_basic.so +-LoadModule auth_digest_module @APACHE_MODULE_DIR@/mod_auth_digest.so +-LoadModule authn_file_module @APACHE_MODULE_DIR@/mod_authn_file.so +-LoadModule authz_user_module @APACHE_MODULE_DIR@/mod_authz_user.so +-LoadModule dir_module @APACHE_MODULE_DIR@/mod_dir.so +-LoadModule mime_module @APACHE_MODULE_DIR@/mod_mime.so +-@IF_HAVE_PHP@LoadModule php5_module @APACHE_MODULE_DIR@/mod_php5.so ++LoadModule alias_module @APACHE_MODULE_DIR@/mod_alias.so ++LoadModule auth_basic_module @APACHE_MODULE_DIR@/mod_auth_basic.so ++LoadModule auth_digest_module @APACHE_MODULE_DIR@/mod_auth_digest.so ++LoadModule authn_file_module @APACHE_MODULE_DIR@/mod_authn_file.so ++LoadModule authz_host_module @APACHE_MODULE_DIR@/mod_authz_host.so ++LoadModule authz_user_module @APACHE_MODULE_DIR@/mod_authz_user.so ++LoadModule dir_module @APACHE_MODULE_DIR@/mod_dir.so ++LoadModule mime_module @APACHE_MODULE_DIR@/mod_mime.so ++@IF_HAVE_PHP@LoadModule php5_module @APACHE_PHP_MODULE_DIR@/mod_php5.so ++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 + + DirectoryIndex httpd.pid + AddType application/x-httpd-php .php + ++ ++# Proxy #1: unauthenticated ++Listen 127.0.0.1:47526 ++ ++ ProxyRequests On ++ AllowCONNECT 47525 ++ ++ # Deny proxying by default ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ # Allow local http connections ++ ++ Order Allow,Deny ++ Allow from all ++ ++ ++ # Allow CONNECT to local https port ++ ++ Order Allow,Deny ++ Allow from all ++ ++ ++ # Deny non-proxy requests ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ ++# Proxy #2: authenticated ++Listen 127.0.0.1:47527 ++ ++ ProxyRequests On ++ AllowCONNECT 47525 ++ ++ # Deny proxying by default ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ # Allow local http connections with authentication ++ ++ Order Allow,Deny ++ Allow from all ++ ++ AuthType Basic ++ AuthName realm1 ++ AuthUserFile ./htpasswd ++ Require valid-user ++ ++ ++ # Allow CONNECT to local https port with authentication ++ ++ Order Allow,Deny ++ Allow from all ++ ++ AuthType Basic ++ AuthName realm1 ++ AuthUserFile ./htpasswd ++ Require valid-user ++ ++ ++ # Fail non-proxy requests ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ ++# Proxy #3: unauthenticatable-to ++Listen 127.0.0.1:47528 ++ ++ ProxyRequests On ++ AllowCONNECT 47525 ++ ++ # Deny proxying by default ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ # Allow local http connections with authentication ++ ++ Order Allow,Deny ++ Allow from all ++ ++ AuthType Basic ++ AuthName realm1 ++ AuthUserFile ./htpasswd ++ Require user no-such-user ++ ++ ++ # Allow CONNECT to local https port with authentication ++ ++ Order Allow,Deny ++ Allow from all ++ ++ AuthType Basic ++ AuthName realm1 ++ AuthUserFile ./htpasswd ++ Require user no-such-user ++ ++ ++ # Fail non-proxy requests ++ ++ Order Deny,Allow ++ Deny from all ++ ++ ++ ++ ++# SSL setup ++ ++ Listen 127.0.0.1:47525 ++ ++ ++ SSLEngine on ++ ++ SSLCertificateFile test-cert.pem ++ SSLCertificateKeyFile test-key.pem ++ ++ ++ ++ ++ ++# Basic auth tests + Alias /Basic/realm1/realm2/realm1 @builddir@ + Alias /Basic/realm1/realm2 @builddir@ + Alias /Basic/realm1/subdir @builddir@ +@@ -28,6 +168,7 @@ Alias /Basic/realm1/not @builddir@ + Alias /Basic/realm1 @builddir@ + Alias /Basic/realm2 @builddir@ + Alias /Basic/realm3 @builddir@ ++Alias /Basic @builddir@ + + + AuthType Basic +@@ -71,7 +212,7 @@ Alias /Basic/realm3 @builddir@ + Require user user3 + + +- ++# Digest auth tests + Alias /Digest/realm1/realm2/realm1 @builddir@ + Alias /Digest/realm1/realm2 @builddir@ + Alias /Digest/realm1/subdir @builddir@ +@@ -79,6 +220,7 @@ Alias /Digest/realm1/not @builddir@ + Alias /Digest/realm1 @builddir@ + Alias /Digest/realm2 @builddir@ + Alias /Digest/realm3 @builddir@ ++Alias /Digest @builddir@ + + + AuthType Digest +@@ -127,4 +269,3 @@ Alias /Digest/realm3 @builddir@ + AuthDigestDomain /Digest/realm3 + Require valid-user + +- +diff -ruNp libsoup-2.2.100/tests/Makefile.am libsoup-2.2.100/tests/Makefile.am +--- libsoup-2.2.100/tests/Makefile.am 2007-01-05 14:41:31.000000000 -0500 ++++ libsoup-2.2.100/tests/Makefile.am 2007-04-09 17:03:24.000000000 -0400 +@@ -1,12 +1,12 @@ + INCLUDES = \ + -I$(top_srcdir) \ + $(XML_CFLAGS) \ +- $(GLIB_CFLAGS) ++ $(GLIB_CFLAGS) \ ++ $(LIBGNUTLS_CFLAGS) + + LIBS = $(top_builddir)/libsoup/libsoup-$(SOUP_API_VERSION).la + + noinst_PROGRAMS = \ +- auth-test \ + date \ + dict \ + dns \ +@@ -17,6 +17,8 @@ noinst_PROGRAMS = \ + simple-httpd \ + simple-proxy \ + uri-parsing \ ++ $(APACHE_TESTS) \ ++ $(SSL_TESTS) \ + $(XMLRPC_TESTS) + + auth_test_SOURCES = auth-test.c apache-wrapper.c apache-wrapper.h +@@ -26,20 +28,25 @@ dns_SOURCES = dns.c + get_SOURCES = get.c + getbug_SOURCES = getbug.c + header_parsing_SOURCES = header-parsing.c ++proxy_test_SOURCES = proxy-test.c apache-wrapper.c apache-wrapper.h + revserver_SOURCES = revserver.c + simple_httpd_SOURCES = simple-httpd.c + simple_proxy_SOURCES = simple-proxy.c ++ssl_test_SOURCES = ssl-test.c + uri_parsing_SOURCES = uri-parsing.c + xmlrpc_test_SOURCES = xmlrpc-test.c apache-wrapper.c apache-wrapper.h + + if HAVE_APACHE +-APACHE_TESTS = auth-test ++APACHE_TESTS = auth-test proxy-test ++endif ++if HAVE_SSL ++SSL_TESTS = ssl-test + endif + if HAVE_XMLRPC_EPI_PHP + XMLRPC_TESTS = xmlrpc-test + endif + +-TESTS = date header-parsing uri-parsing $(APACHE_TESTS) $(XMLRPC_TESTS) ++TESTS = date header-parsing uri-parsing $(APACHE_TESTS) $(SSL_TESTS) $(XMLRPC_TESTS) + + EXTRA_DIST = \ + libsoup.supp \ +diff -ruNp libsoup-2.2.100/tests/Makefile.in libsoup-2.2.100/tests/Makefile.in +--- libsoup-2.2.100/tests/Makefile.in 2007-02-12 10:34:12.000000000 -0500 ++++ libsoup-2.2.100/tests/Makefile.in 2007-05-01 15:49:10.000000000 -0400 +@@ -36,11 +36,11 @@ PRE_UNINSTALL = : + POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ +-noinst_PROGRAMS = auth-test$(EXEEXT) date$(EXEEXT) dict$(EXEEXT) \ +- dns$(EXEEXT) get$(EXEEXT) getbug$(EXEEXT) \ +- header-parsing$(EXEEXT) revserver$(EXEEXT) \ +- simple-httpd$(EXEEXT) simple-proxy$(EXEEXT) \ +- uri-parsing$(EXEEXT) $(am__EXEEXT_1) ++noinst_PROGRAMS = date$(EXEEXT) dict$(EXEEXT) dns$(EXEEXT) \ ++ get$(EXEEXT) getbug$(EXEEXT) header-parsing$(EXEEXT) \ ++ revserver$(EXEEXT) simple-httpd$(EXEEXT) simple-proxy$(EXEEXT) \ ++ uri-parsing$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ ++ $(am__EXEEXT_3) + subdir = tests + DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/httpd.conf.in +@@ -52,7 +52,10 @@ am__configure_deps = $(am__aclocal_m4_de + mkinstalldirs = $(install_sh) -d + CONFIG_HEADER = $(top_builddir)/config.h + CONFIG_CLEAN_FILES = httpd.conf +-@HAVE_XMLRPC_EPI_PHP_TRUE@am__EXEEXT_1 = xmlrpc-test$(EXEEXT) ++@HAVE_APACHE_TRUE@am__EXEEXT_1 = auth-test$(EXEEXT) \ ++@HAVE_APACHE_TRUE@ proxy-test$(EXEEXT) ++@HAVE_SSL_TRUE@am__EXEEXT_2 = ssl-test$(EXEEXT) ++@HAVE_XMLRPC_EPI_PHP_TRUE@am__EXEEXT_3 = xmlrpc-test$(EXEEXT) + PROGRAMS = $(noinst_PROGRAMS) + am_auth_test_OBJECTS = auth-test.$(OBJEXT) apache-wrapper.$(OBJEXT) + auth_test_OBJECTS = $(am_auth_test_OBJECTS) +@@ -75,6 +78,9 @@ getbug_LDADD = $(LDADD) + am_header_parsing_OBJECTS = header-parsing.$(OBJEXT) + header_parsing_OBJECTS = $(am_header_parsing_OBJECTS) + header_parsing_LDADD = $(LDADD) ++am_proxy_test_OBJECTS = proxy-test.$(OBJEXT) apache-wrapper.$(OBJEXT) ++proxy_test_OBJECTS = $(am_proxy_test_OBJECTS) ++proxy_test_LDADD = $(LDADD) + am_revserver_OBJECTS = revserver.$(OBJEXT) + revserver_OBJECTS = $(am_revserver_OBJECTS) + revserver_LDADD = $(LDADD) +@@ -84,6 +90,9 @@ simple_httpd_LDADD = $(LDADD) + am_simple_proxy_OBJECTS = simple-proxy.$(OBJEXT) + simple_proxy_OBJECTS = $(am_simple_proxy_OBJECTS) + simple_proxy_LDADD = $(LDADD) ++am_ssl_test_OBJECTS = ssl-test.$(OBJEXT) ++ssl_test_OBJECTS = $(am_ssl_test_OBJECTS) ++ssl_test_LDADD = $(LDADD) + am_uri_parsing_OBJECTS = uri-parsing.$(OBJEXT) + uri_parsing_OBJECTS = $(am_uri_parsing_OBJECTS) + uri_parsing_LDADD = $(LDADD) +@@ -104,13 +113,15 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ + SOURCES = $(auth_test_SOURCES) $(date_SOURCES) $(dict_SOURCES) \ + $(dns_SOURCES) $(get_SOURCES) $(getbug_SOURCES) \ +- $(header_parsing_SOURCES) $(revserver_SOURCES) \ +- $(simple_httpd_SOURCES) $(simple_proxy_SOURCES) \ ++ $(header_parsing_SOURCES) $(proxy_test_SOURCES) \ ++ $(revserver_SOURCES) $(simple_httpd_SOURCES) \ ++ $(simple_proxy_SOURCES) $(ssl_test_SOURCES) \ + $(uri_parsing_SOURCES) $(xmlrpc_test_SOURCES) + DIST_SOURCES = $(auth_test_SOURCES) $(date_SOURCES) $(dict_SOURCES) \ + $(dns_SOURCES) $(get_SOURCES) $(getbug_SOURCES) \ +- $(header_parsing_SOURCES) $(revserver_SOURCES) \ +- $(simple_httpd_SOURCES) $(simple_proxy_SOURCES) \ ++ $(header_parsing_SOURCES) $(proxy_test_SOURCES) \ ++ $(revserver_SOURCES) $(simple_httpd_SOURCES) \ ++ $(simple_proxy_SOURCES) $(ssl_test_SOURCES) \ + $(uri_parsing_SOURCES) $(xmlrpc_test_SOURCES) + ETAGS = etags + CTAGS = ctags +@@ -122,6 +133,8 @@ AMDEP_TRUE = @AMDEP_TRUE@ + AMTAR = @AMTAR@ + 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@ +@@ -161,6 +174,8 @@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE + GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ + HAVE_APACHE_FALSE = @HAVE_APACHE_FALSE@ + HAVE_APACHE_TRUE = @HAVE_APACHE_TRUE@ ++HAVE_SSL_FALSE = @HAVE_SSL_FALSE@ ++HAVE_SSL_TRUE = @HAVE_SSL_TRUE@ + HAVE_XMLRPC_EPI_PHP_FALSE = @HAVE_XMLRPC_EPI_PHP_FALSE@ + HAVE_XMLRPC_EPI_PHP_TRUE = @HAVE_XMLRPC_EPI_PHP_TRUE@ + HTML_DIR = @HTML_DIR@ +@@ -170,6 +185,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LDFLAGS = @LDFLAGS@ ++LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ ++LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ ++LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ + LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ + LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ + LIBOBJS = @LIBOBJS@ +@@ -256,7 +274,8 @@ target_alias = @target_alias@ + INCLUDES = \ + -I$(top_srcdir) \ + $(XML_CFLAGS) \ +- $(GLIB_CFLAGS) ++ $(GLIB_CFLAGS) \ ++ $(LIBGNUTLS_CFLAGS) + + auth_test_SOURCES = auth-test.c apache-wrapper.c apache-wrapper.h + date_SOURCES = date.c +@@ -265,14 +284,17 @@ dns_SOURCES = dns.c + get_SOURCES = get.c + getbug_SOURCES = getbug.c + header_parsing_SOURCES = header-parsing.c ++proxy_test_SOURCES = proxy-test.c apache-wrapper.c apache-wrapper.h + revserver_SOURCES = revserver.c + simple_httpd_SOURCES = simple-httpd.c + simple_proxy_SOURCES = simple-proxy.c ++ssl_test_SOURCES = ssl-test.c + uri_parsing_SOURCES = uri-parsing.c + xmlrpc_test_SOURCES = xmlrpc-test.c apache-wrapper.c apache-wrapper.h +-@HAVE_APACHE_TRUE@APACHE_TESTS = auth-test ++@HAVE_APACHE_TRUE@APACHE_TESTS = auth-test proxy-test ++@HAVE_SSL_TRUE@SSL_TESTS = ssl-test + @HAVE_XMLRPC_EPI_PHP_TRUE@XMLRPC_TESTS = xmlrpc-test +-TESTS = date header-parsing uri-parsing $(APACHE_TESTS) $(XMLRPC_TESTS) ++TESTS = date header-parsing uri-parsing $(APACHE_TESTS) $(SSL_TESTS) $(XMLRPC_TESTS) + EXTRA_DIST = \ + libsoup.supp \ + test-cert.pem \ +@@ -345,6 +367,9 @@ getbug$(EXEEXT): $(getbug_OBJECTS) $(get + header-parsing$(EXEEXT): $(header_parsing_OBJECTS) $(header_parsing_DEPENDENCIES) + @rm -f header-parsing$(EXEEXT) + $(LINK) $(header_parsing_LDFLAGS) $(header_parsing_OBJECTS) $(header_parsing_LDADD) $(LIBS) ++proxy-test$(EXEEXT): $(proxy_test_OBJECTS) $(proxy_test_DEPENDENCIES) ++ @rm -f proxy-test$(EXEEXT) ++ $(LINK) $(proxy_test_LDFLAGS) $(proxy_test_OBJECTS) $(proxy_test_LDADD) $(LIBS) + revserver$(EXEEXT): $(revserver_OBJECTS) $(revserver_DEPENDENCIES) + @rm -f revserver$(EXEEXT) + $(LINK) $(revserver_LDFLAGS) $(revserver_OBJECTS) $(revserver_LDADD) $(LIBS) +@@ -354,6 +379,9 @@ simple-httpd$(EXEEXT): $(simple_httpd_OB + simple-proxy$(EXEEXT): $(simple_proxy_OBJECTS) $(simple_proxy_DEPENDENCIES) + @rm -f simple-proxy$(EXEEXT) + $(LINK) $(simple_proxy_LDFLAGS) $(simple_proxy_OBJECTS) $(simple_proxy_LDADD) $(LIBS) ++ssl-test$(EXEEXT): $(ssl_test_OBJECTS) $(ssl_test_DEPENDENCIES) ++ @rm -f ssl-test$(EXEEXT) ++ $(LINK) $(ssl_test_LDFLAGS) $(ssl_test_OBJECTS) $(ssl_test_LDADD) $(LIBS) + uri-parsing$(EXEEXT): $(uri_parsing_OBJECTS) $(uri_parsing_DEPENDENCIES) + @rm -f uri-parsing$(EXEEXT) + $(LINK) $(uri_parsing_LDFLAGS) $(uri_parsing_OBJECTS) $(uri_parsing_LDADD) $(LIBS) +@@ -375,9 +403,11 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getbug.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/header-parsing.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy-test.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/revserver.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple-httpd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple-proxy.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl-test.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri-parsing.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrpc-test.Po@am__quote@ + +diff -ruNp libsoup-2.2.100/tests/proxy-test.c libsoup-2.2.100/tests/proxy-test.c +--- libsoup-2.2.100/tests/proxy-test.c 1969-12-31 19:00:00.000000000 -0500 ++++ libsoup-2.2.100/tests/proxy-test.c 2007-04-09 17:03:24.000000000 -0400 +@@ -0,0 +1,148 @@ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include ++#include ++#include ++ ++#include "libsoup/soup.h" ++#include "apache-wrapper.h" ++ ++int errors = 0; ++ ++typedef struct { ++ const char *explanation; ++ const char *url; ++ const guint final_status; ++} SoupProxyTest; ++ ++SoupProxyTest tests[] = { ++ { "GET -> 200", "", SOUP_STATUS_OK }, ++ { "GET -> 404", "/not-found", SOUP_STATUS_NOT_FOUND }, ++ { "GET -> 401 -> 200", "/Basic/realm1/", SOUP_STATUS_OK }, ++ { "GET -> 401 -> 401", "/Basic/realm2/", SOUP_STATUS_UNAUTHORIZED }, ++ { "GET -> 403", "http://no-proxy.example.com/", SOUP_STATUS_FORBIDDEN }, ++}; ++int ntests = sizeof (tests) / sizeof (tests[0]); ++ ++#define HTTP_SERVER "http://127.0.0.1:47524" ++#define HTTPS_SERVER "https://127.0.0.1:47525" ++ ++enum { ++ SIMPLE_PROXY, ++ AUTH_PROXY, ++ UNAUTH_PROXY ++}; ++static const char *proxies[] = { ++ "http://127.0.0.1:47526", ++ "http://127.0.0.1:47527", ++ "http://127.0.0.1:47528" ++}; ++static const char *proxy_names[] = { ++ "simple proxy", ++ "authenticated proxy", ++ "unauthenticatable-to proxy" ++}; ++ ++static void ++authenticate (SoupSession *session, SoupMessage *msg, ++ const char *auth_type, const char *auth_realm, ++ char **username, char **password, gpointer data) ++{ ++ *username = g_strdup ("user1"); ++ *password = g_strdup ("realm1"); ++} ++ ++static void ++test_url (const char *url, int proxy, guint expected, gboolean sync) ++{ ++ SoupSession *session; ++ SoupUri *proxy_uri; ++ SoupMessage *msg; ++ ++ printf (" GET %s via %s\n", url, proxy_names[proxy]); ++ if (proxy == UNAUTH_PROXY && expected != SOUP_STATUS_FORBIDDEN) ++ expected = SOUP_STATUS_PROXY_UNAUTHORIZED; ++ ++ /* We create a new session for each request to ensure that ++ * connections/auth aren't cached between tests. ++ */ ++ proxy_uri = soup_uri_new (proxies[proxy]); ++ session = g_object_new (sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC, ++ SOUP_SESSION_PROXY_URI, proxy_uri, ++ NULL); ++ soup_uri_free (proxy_uri); ++ g_signal_connect (session, "authenticate", ++ G_CALLBACK (authenticate), NULL); ++ ++ msg = soup_message_new (SOUP_METHOD_GET, url); ++ if (!msg) { ++ fprintf (stderr, "proxy-test: Could not parse URI\n"); ++ exit (1); ++ } ++ ++ soup_session_send_message (session, msg); ++ ++ printf (" %d %s\n", msg->status_code, msg->reason_phrase); ++ if (msg->status_code != expected) { ++ printf (" EXPECTED %d!\n", expected); ++ errors++; ++ } ++ ++ g_object_unref (msg); ++ soup_session_abort (session); ++ g_object_unref (session); ++} ++ ++static void ++run_test (int i, gboolean sync) ++{ ++ char *http_url, *https_url; ++ ++ printf ("Test %d: %s (%s)\n", i + 1, tests[i].explanation, ++ sync ? "sync" : "async"); ++ ++ if (!strncmp (tests[i].url, "http", 4)) { ++ http_url = g_strdup (tests[i].url); ++ https_url = g_strdup_printf ("https%s", tests[i].url + 4); ++ } else { ++ http_url = g_strconcat (HTTP_SERVER, tests[i].url, NULL); ++ https_url = g_strconcat (HTTPS_SERVER, tests[i].url, NULL); ++ } ++ test_url (http_url, SIMPLE_PROXY, tests[i].final_status, sync); ++ test_url (https_url, SIMPLE_PROXY, tests[i].final_status, sync); ++ test_url (http_url, AUTH_PROXY, tests[i].final_status, sync); ++ test_url (https_url, AUTH_PROXY, tests[i].final_status, sync); ++ test_url (http_url, UNAUTH_PROXY, tests[i].final_status, sync); ++ test_url (https_url, UNAUTH_PROXY, tests[i].final_status, sync); ++ ++ g_free (http_url); ++ g_free (https_url); ++ ++ printf ("\n"); ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int i; ++ ++ g_type_init (); ++ g_thread_init (NULL); ++ ++ if (!apache_init ()) { ++ fprintf (stderr, "Could not start apache\n"); ++ return 1; ++ } ++ ++ for (i = 0; i < ntests; i++) { ++ run_test (i, FALSE); ++ run_test (i, TRUE); ++ } ++ ++ apache_cleanup (); ++ ++ printf ("proxy-test: %d errors\n", errors); ++ return errors; ++} +diff -ruNp libsoup-2.2.100/tests/ssl-test.c libsoup-2.2.100/tests/ssl-test.c +--- libsoup-2.2.100/tests/ssl-test.c 1969-12-31 19:00:00.000000000 -0500 ++++ libsoup-2.2.100/tests/ssl-test.c 2007-05-01 15:44:30.000000000 -0400 +@@ -0,0 +1,323 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "libsoup/soup-socket.h" ++#include "libsoup/soup-ssl.h" ++ ++#define BUFSIZE 1024 ++#define DH_BITS 1024 ++ ++GMainLoop *loop; ++gnutls_dh_params_t dh_params; ++ ++/* SERVER */ ++ ++/* Read @bufsize bytes into @buf from @session. */ ++static void ++server_read (gnutls_session_t session, char *buf, int bufsize) ++{ ++ int total, nread; ++ ++ total = 0; ++ while (total < bufsize) { ++ nread = gnutls_record_recv (session, buf + total, ++ bufsize - total); ++ if (nread <= 0) ++ g_error ("server read failed at position %d", total); ++ total += nread; ++ } ++} ++ ++/* Write @bufsize bytes from @buf to @session, forcing 3 rehandshakes ++ * along the way. (We do an odd number of rehandshakes to make sure ++ * they occur at weird times relative to the client's read buffer ++ * size.) ++ */ ++static void ++server_write (gnutls_session_t session, char *buf, int bufsize) ++{ ++ int total, nwrote; ++ int next_rehandshake = bufsize / 3; ++ ++ total = 0; ++ while (total < bufsize) { ++ if (total >= next_rehandshake) { ++ if (gnutls_rehandshake (session) < 0) ++ g_error ("client refused rehandshake at position %d", total); ++ if (gnutls_handshake (session) < 0) ++ g_error ("server rehandshake failed at position %d", total); ++ next_rehandshake = MIN (bufsize, next_rehandshake + bufsize / 3); ++ } ++ ++ nwrote = gnutls_record_send (session, buf + total, ++ next_rehandshake - total); ++ if (nwrote <= 0) ++ g_error ("server write failed at position %d: %d", total, nwrote); ++ total += nwrote; ++ } ++} ++ ++const char *ssl_cert_file = "test-cert.pem"; ++const char *ssl_key_file = "test-key.pem"; ++ ++static gpointer ++server_thread (gpointer user_data) ++{ ++ int listener = GPOINTER_TO_INT (user_data), client; ++ gnutls_certificate_credentials creds; ++ gnutls_session_t session; ++ struct sockaddr_in sin; ++ int len; ++ char buf[BUFSIZE]; ++ int status; ++ ++ gnutls_certificate_allocate_credentials (&creds); ++ if (gnutls_certificate_set_x509_key_file (creds, ++ ssl_cert_file, ssl_key_file, ++ GNUTLS_X509_FMT_PEM) != 0) { ++ g_error ("Failed to set SSL certificate and key files " ++ "(%s, %s).", ssl_cert_file, ssl_key_file); ++ } ++ gnutls_certificate_set_dh_params (creds, dh_params); ++ ++ /* Create a new session */ ++ gnutls_init (&session, GNUTLS_SERVER); ++ gnutls_set_default_priority (session); ++ gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, creds); ++ gnutls_dh_set_prime_bits (session, DH_BITS); ++ ++ /* Wait for client thread to connect */ ++ len = sizeof (sin); ++ client = accept (listener, (struct sockaddr *) &sin, (void *)&len); ++ gnutls_transport_set_ptr (session, GINT_TO_POINTER (client)); ++ ++ /* Initial handshake */ ++ status = gnutls_handshake (session); ++ if (status < 0) ++ g_error ("initial handshake failed: %d", status); ++ ++ /* Synchronous client test. */ ++ server_read (session, buf, BUFSIZE); ++ server_write (session, buf, BUFSIZE); ++ ++ /* Async client test. */ ++ server_read (session, buf, BUFSIZE); ++ server_write (session, buf, BUFSIZE); ++ ++ /* That's all, folks. */ ++ gnutls_bye (session, GNUTLS_SHUT_WR); ++ gnutls_deinit (session); ++ close (client); ++ ++ return NULL; ++} ++ ++/* async client code */ ++ ++typedef struct { ++ char writebuf[BUFSIZE], readbuf[BUFSIZE]; ++ int total; ++} AsyncData; ++ ++static void ++async_read (SoupSocket *sock, gpointer user_data) ++{ ++ AsyncData *data = user_data; ++ SoupSocketIOStatus status; ++ gsize n; ++ ++ do { ++ status = soup_socket_read (sock, data->readbuf + data->total, ++ BUFSIZE - data->total, &n); ++ if (status == SOUP_SOCKET_OK) ++ data->total += n; ++ } while (status == SOUP_SOCKET_OK && data->total < BUFSIZE); ++ ++ if (status == SOUP_SOCKET_ERROR || status == SOUP_SOCKET_EOF) ++ g_error ("Async read got status %d", status); ++ else if (status == SOUP_SOCKET_WOULD_BLOCK) ++ return; ++ ++ if (memcmp (data->writebuf, data->readbuf, BUFSIZE) != 0) ++ g_error ("Sync read didn't match write"); ++ ++ g_main_loop_quit (loop); ++} ++ ++static void ++async_write (SoupSocket *sock, gpointer user_data) ++{ ++ AsyncData *data = user_data; ++ SoupSocketIOStatus status; ++ gsize n; ++ ++ do { ++ status = soup_socket_write (sock, data->writebuf + data->total, ++ BUFSIZE - data->total, &n); ++ if (status == SOUP_SOCKET_OK) ++ data->total += n; ++ } while (status == SOUP_SOCKET_OK && data->total < BUFSIZE); ++ ++ if (status == SOUP_SOCKET_ERROR || status == SOUP_SOCKET_EOF) ++ g_error ("Async write got status %d", status); ++ else if (status == SOUP_SOCKET_WOULD_BLOCK) ++ return; ++ ++ data->total = 0; ++ async_read (sock, user_data); ++} ++ ++static gboolean ++start_writing (gpointer user_data) ++{ ++ SoupSocket *sock = user_data; ++ AsyncData *data; ++ int i; ++ ++ data = g_new (AsyncData, 1); ++ for (i = 0; i < BUFSIZE; i++) ++ data->writebuf[i] = i & 0xFF; ++ ++ g_signal_connect (sock, "writable", ++ G_CALLBACK (async_write), data); ++ g_signal_connect (sock, "readable", ++ G_CALLBACK (async_read), data); ++ ++ async_write (sock, data); ++ return FALSE; ++} ++ ++int debug; ++ ++static void ++debug_log (int level, const char *str) ++{ ++ fputs (str, stderr); ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int opt, listener, sin_len, port, i; ++ struct sockaddr_in sin; ++ GThread *server; ++ char writebuf[BUFSIZE], readbuf[BUFSIZE]; ++ SoupSocket *sock; ++ gsize n, total; ++ SoupSocketIOStatus status; ++ ++ g_type_init (); ++ g_thread_init (NULL); ++ ++ while ((opt = getopt (argc, argv, "c:d:k:")) != -1) { ++ switch (opt) { ++ case 'c': ++ ssl_cert_file = optarg; ++ break; ++ case 'd': ++ debug = atoi (optarg); ++ break; ++ case 'k': ++ ssl_key_file = optarg; ++ break; ++ ++ case '?': ++ fprintf (stderr, "Usage: %s [-d debuglevel] [-c ssl-cert-file] [-k ssl-key-file]\n", ++ argv[0]); ++ break; ++ } ++ } ++ ++ if (debug) { ++ gnutls_global_set_log_function (debug_log); ++ gnutls_global_set_log_level (debug); ++ } ++ ++ /* Create server socket */ ++ listener = socket (AF_INET, SOCK_STREAM, 0); ++ if (listener == -1) { ++ perror ("creating listening socket"); ++ exit (1); ++ } ++ ++ memset (&sin, 0, sizeof (sin)); ++ sin.sin_family = AF_INET; ++ sin.sin_addr.s_addr = INADDR_ANY; ++ ++ if (bind (listener, (struct sockaddr *) &sin, sizeof (sin)) == -1) { ++ perror ("binding listening socket"); ++ exit (1); ++ } ++ ++ if (listen (listener, 1) == -1) { ++ perror ("listening on socket"); ++ exit (1); ++ } ++ ++ sin_len = sizeof (sin); ++ getsockname (listener, (struct sockaddr *)&sin, (void *)&sin_len); ++ port = ntohs (sin.sin_port); ++ ++ /* Now spawn server thread */ ++ server = g_thread_create (server_thread, GINT_TO_POINTER (listener), ++ FALSE, NULL); ++ ++ /* And create the client */ ++ sock = soup_socket_client_new_sync ("127.0.0.1", port, ++ soup_ssl_get_client_credentials (NULL), ++ &status); ++ if (status != SOUP_STATUS_OK) { ++ g_error ("Could not create client socket: %s", ++ soup_status_get_phrase (status)); ++ } ++ ++ soup_socket_start_ssl (sock); ++ ++ /* Synchronous client test */ ++ for (i = 0; i < BUFSIZE; i++) ++ writebuf[i] = i & 0xFF; ++ ++ total = 0; ++ while (total < BUFSIZE) { ++ status = soup_socket_write (sock, writebuf + total, ++ BUFSIZE - total, &n); ++ if (status != SOUP_SOCKET_OK) ++ g_error ("Sync write got status %d", status); ++ total += n; ++ } ++ ++ total = 0; ++ while (total < BUFSIZE) { ++ status = soup_socket_read (sock, readbuf + total, ++ BUFSIZE - total, &n); ++ if (status != SOUP_SOCKET_OK) ++ g_error ("Sync read got status %d", status); ++ total += n; ++ } ++ ++ if (memcmp (writebuf, readbuf, BUFSIZE) != 0) ++ g_error ("Sync read didn't match write"); ++ ++ printf ("SYNCHRONOUS SSL TEST PASSED\n"); ++ ++ /* Switch socket to async and do it again */ ++ ++ g_object_set (sock, ++ SOUP_SOCKET_FLAG_NONBLOCKING, TRUE, ++ NULL); ++ ++ g_idle_add (start_writing, sock); ++ loop = g_main_loop_new (NULL, TRUE); ++ g_main_loop_run (loop); ++ ++ printf ("ASYNCHRONOUS SSL TEST PASSED\n"); ++ ++ /* Success */ ++ return 0; ++} diff --git a/libsoup-334021.patch b/libsoup-334021.patch new file mode 100644 index 0000000..47f4149 --- /dev/null +++ b/libsoup-334021.patch @@ -0,0 +1,302 @@ + +Index: configure.in +=================================================================== +--- configure.in (revision 924) ++++ configure.in (working copy) +@@ -140,6 +140,11 @@ + if test "$have_ssl" = "yes"; then + AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support]) + SSL_REQUIREMENT="gnutls" ++ ++ old_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $LIBGNUTLS_LIBS $LIBGCRYPT_LIBS" ++ AC_CHECK_FUNCS(gnutls_certificate_client_set_sign_function) ++ LDFLAGS="$old_LDFLAGS" + else + if test "$enable_ssl" = "auto"; then + AC_MSG_WARN(Disabling SSL support); +Index: libsoup/soup-ssl.h +=================================================================== +--- libsoup/soup-ssl.h (revision 924) ++++ libsoup/soup-ssl.h (working copy) +@@ -44,4 +44,24 @@ + SOUP_SSL_ERROR_CERTIFICATE, + } SoupSocketError; + ++#ifdef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++#include ++ ++typedef int (*SoupGnuTLSCertificateRequestFunc) (const gnutls_datum_t *req_ca_rdn, ++ int nreqs, ++ gnutls_datum_t **cert_ret, ++ int *cert_ret_len, ++ gpointer user_data); ++ ++typedef int (*SoupGnuTLSSignDataFunc) (gnutls_datum_t *cert_der, ++ const gnutls_datum_t *hash_data, ++ gnutls_datum_t *sign_data, ++ gpointer user_data); ++ ++void soup_gnutls_set_callbacks (SoupSSLCredentials *creds, ++ SoupGnuTLSCertificateRequestFunc cert_func, ++ SoupGnuTLSSignDataFunc sign_func, ++ gpointer user_data); ++#endif /* HAVE_GNUTLS... */ ++ + #endif /* SOUP_SSL_H */ +Index: libsoup/soup-gnutls.c +=================================================================== +--- libsoup/soup-gnutls.c (revision 924) ++++ libsoup/soup-gnutls.c (working copy) +@@ -33,6 +33,12 @@ + struct SoupSSLCredentials { + gnutls_certificate_credentials creds; + gboolean have_ca_file; ++ ++#ifdef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++ SoupGnuTLSCertificateRequestFunc cert_func; ++ SoupGnuTLSSignDataFunc sign_func; ++ gpointer auth_data; ++#endif + }; + + typedef struct { +@@ -411,6 +417,7 @@ + gnutls_dh_set_prime_bits (session, DH_BITS); + + gnutls_transport_set_ptr (session, GINT_TO_POINTER (sockfd)); ++ gnutls_session_set_ptr (session, creds); + + chan = g_new0 (SoupGNUTLSChannel, 1); + chan->fd = sockfd; +@@ -451,6 +458,111 @@ + soup_gnutls_inited = TRUE; + } + ++#ifdef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++static int ++soup_ssl_retrieve_cert (gnutls_session_t session, ++ const gnutls_datum_t *req_ca_rdn, int nreqs, ++ const gnutls_pk_algorithm_t *sign_algos, ++ int sign_algos_length, gnutls_retr_st * st) ++{ ++ SoupSSLCredentials *creds; ++ int cert_ret_len = 0; ++ gnutls_datum_t *cert_ret; ++ gnutls_x509_crt_t *gnutls_cert; ++ int i; ++ int ret; ++ ++ creds = gnutls_session_get_ptr (session); ++ if (!creds) ++ return -1; ++ ++ g_return_val_if_fail (creds->cert_func != NULL, -1); ++ ++ if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) ++ return -1; ++ ++ ret = creds->cert_func (req_ca_rdn, nreqs, ++ &cert_ret, &cert_ret_len, ++ creds->auth_data); ++ ++ if (ret != 0) ++ return -1; ++ ++ if (cert_ret_len == 0) ++ return 0; ++ ++ gnutls_cert = gnutls_malloc (sizeof (gnutls_x509_crt_t) * cert_ret_len); ++ for (i = 0; i < cert_ret_len; i++) { ++ if (ret == 0) { ++ gnutls_x509_crt_init (&gnutls_cert[i]); ++ ret = gnutls_x509_crt_import (gnutls_cert[i], ++ &cert_ret[i], ++ GNUTLS_X509_FMT_DER); ++ if (ret != 0) { ++ int j; ++ for (j = 0; i < i; j++) ++ gnutls_x509_crt_deinit (gnutls_cert[j]); ++ } ++ } ++ gnutls_free (cert_ret[i].data); ++ } ++ gnutls_free (cert_ret); ++ ++ if (ret != 0) { ++ gnutls_free (gnutls_cert); ++ return -1; ++ } ++ ++ st->type = GNUTLS_CRT_X509; ++ st->cert.x509 = gnutls_cert; ++ st->ncerts = cert_ret_len; ++ st->key.x509 = NULL; ++ st->deinit_all = 1; ++ ++ return 0; ++} ++ ++static int ++soup_ssl_sign_data (gnutls_session_t session, ++ gnutls_datum_t * cert, ++ gnutls_certificate_type_t cert_type, ++ const gnutls_datum_t *hash_concat, ++ gnutls_datum_t * signature) ++{ ++ SoupSSLCredentials *creds; ++ int ret; ++ ++ creds = gnutls_session_get_ptr (session); ++ if (!creds) ++ return -1; ++ ++ g_return_val_if_fail (creds->sign_func != NULL, -1); ++ g_return_val_if_fail (cert_type == GNUTLS_CRT_X509, -1); ++ ++ ret = creds->sign_func (cert, hash_concat, signature, ++ creds->auth_data); ++ ++ return ret; ++} ++ ++void ++soup_gnutls_set_callbacks (SoupSSLCredentials *creds, ++ SoupGnuTLSCertificateRequestFunc cert_func, ++ SoupGnuTLSSignDataFunc sign_func, ++ gpointer user_data) ++{ ++ creds->cert_func = cert_func; ++ creds->sign_func = sign_func; ++ creds->auth_data = user_data; ++ ++ if (cert_func) ++ gnutls_certificate_client_set_retrieve_function (creds->creds, soup_ssl_retrieve_cert); ++ ++ if (sign_func) ++ gnutls_certificate_client_set_sign_function (creds->creds, soup_ssl_sign_data); ++} ++#endif /* HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION */ ++ + /** + * soup_ssl_get_client_credentials: + * @ca_file: path to a file containing X509-encoded Certificate +Index: libsoup/soup-session.c +=================================================================== +--- libsoup/soup-session.c (revision 924) ++++ libsoup/soup-session.c (working copy) +@@ -89,6 +89,8 @@ + enum { + AUTHENTICATE, + REAUTHENTICATE, ++ CERTIFICATE_REQUESTED, ++ SIGN_DATA, + LAST_SIGNAL + }; + +@@ -292,6 +294,35 @@ + G_TYPE_POINTER, + G_TYPE_POINTER); + ++ /* This signal is not part of SoupSession's public API, and ++ * *will* disappear without warning in the future. ++ */ ++ signals[CERTIFICATE_REQUESTED] = ++ g_signal_new ("certificate-requested", ++ G_OBJECT_CLASS_TYPE (object_class), ++ G_SIGNAL_RUN_LAST, ++ 0, NULL, NULL, ++ soup_marshal_INT__POINTER_INT_POINTER_POINTER, ++ G_TYPE_INT, 4, ++ G_TYPE_POINTER, ++ G_TYPE_INT, ++ G_TYPE_POINTER, ++ G_TYPE_POINTER); ++ ++ /* This signal is not part of SoupSession's public API, and ++ * *will* disappear without warning in the future. ++ */ ++ signals[SIGN_DATA] = ++ g_signal_new ("sign-data", ++ G_OBJECT_CLASS_TYPE (object_class), ++ G_SIGNAL_RUN_LAST, ++ 0, NULL, NULL, ++ soup_marshal_INT__POINTER_POINTER_POINTER, ++ G_TYPE_INT, 3, ++ G_TYPE_POINTER, ++ G_TYPE_POINTER, ++ G_TYPE_POINTER); ++ + /* properties */ + g_object_class_install_property ( + object_class, PROP_PROXY_URI, +@@ -550,6 +581,46 @@ + return strcmp (one->host, two->host) == 0; + } + ++#ifdef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++static int ++soup_session_ssl_certificate_requested (const gnutls_datum_t *req_ca_rdn, ++ int nreqs, ++ gnutls_datum_t **cert_ret, ++ int *cert_ret_len, ++ gpointer user_data) ++{ ++ SoupSession *session = user_data; ++ int ret = 0; ++ ++ g_return_val_if_fail (SOUP_IS_SESSION (user_data), -1); ++ ++ g_signal_emit (session, signals[CERTIFICATE_REQUESTED], 0, ++ req_ca_rdn, nreqs, ++ cert_ret, cert_ret_len, ++ &ret); ++ ++ return ret; ++} ++ ++static int ++soup_session_ssl_sign_data (gnutls_datum_t *cert_der, ++ const gnutls_datum_t *hash_data, ++ gnutls_datum_t *sign_data, ++ gpointer user_data) ++{ ++ SoupSession *session = user_data; ++ int ret = 0; ++ ++ g_return_val_if_fail (SOUP_IS_SESSION (user_data), -1); ++ ++ g_signal_emit (session, signals[SIGN_DATA], 0, ++ cert_der, hash_data, sign_data, ++ &ret); ++ ++ return ret; ++} ++#endif ++ + static SoupSessionHost * + soup_session_host_new (SoupSession *session, const SoupUri *source_uri) + { +@@ -563,6 +634,12 @@ + !priv->ssl_creds) { + priv->ssl_creds = + soup_ssl_get_client_credentials (priv->ssl_ca_file); ++#ifdef HAVE_GNUTLS_CERTIFICATE_CLIENT_SET_SIGN_FUNCTION ++ soup_gnutls_set_callbacks (priv->ssl_creds, ++ soup_session_ssl_certificate_requested, ++ soup_session_ssl_sign_data, ++ session); ++#endif + } + + return host; +Index: libsoup/soup-marshal.list +=================================================================== +--- libsoup/soup-marshal.list (revision 924) ++++ libsoup/soup-marshal.list (working copy) +@@ -2,3 +2,5 @@ + NONE:INT + NONE:OBJECT + NONE:OBJECT,STRING,STRING,POINTER,POINTER ++INT:POINTER,INT,POINTER,POINTER ++INT:POINTER,POINTER,POINTER diff --git a/libsoup.changes b/libsoup.changes index 19a1a2d..43033e8 100644 --- a/libsoup.changes +++ b/libsoup.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Aug 6 19:55:21 CEST 2007 - jberkman@novell.com + +- export new smartcard functionality from gnutls for evo-exchange (gnome bug + #334021) + ------------------------------------------------------------------- Mon Feb 19 14:47:15 CST 2007 - maw@suse.de diff --git a/libsoup.spec b/libsoup.spec index 40accbe..23b7d71 100644 --- a/libsoup.spec +++ b/libsoup.spec @@ -14,13 +14,15 @@ Name: libsoup BuildRequires: glib2-devel gnutls-devel gtk-doc libxml2-devel # We do not need these dependencies needed only for tests. #BuildRequires: apache2-mod_php5 php5-xmlrpc -License: GNU Library General Public License v. 2.0 and 2.1 (LGPL) +License: LGPL v2 or later Group: Development/Libraries/GNOME Autoreqprov: on Summary: Simple Object Access Protocol (SOAP) Version: 2.2.100 -Release: 1 +Release: 32 Source: ftp://ftp.gnome.org/pub/GNOME/stable/sources/libsoup/2.2/%{name}-%{version}.tar.bz2 +Patch1: libsoup-2.2.100-r924.patch +Patch2: libsoup-334021.patch URL: http://www.gnome.org BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -52,7 +54,7 @@ Authors: %package devel Summary: Include Files and Libraries mandatory for Development. Group: Development/Libraries/GNOME -Requires: %{name} = %{version} glib2-devel gnutls-devel +Requires: %{name} = %{version} glib2-devel gnutls-devel libxml2-devel %description devel Soup is a SOAP (Simple Object Access Protocol) implementation in C. It @@ -100,6 +102,8 @@ Authors: %prep %setup -q +%patch1 -p1 +%patch2 -p0 %build %configure\ @@ -120,7 +124,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc README COPYING ChangeLog NEWS AUTHORS INSTALL +%doc README COPYING ChangeLog NEWS AUTHORS %{_libdir}/*.so.* %files devel @@ -135,6 +139,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/gtk-doc/html/libsoup %changelog +* Mon Aug 06 2007 - jberkman@novell.com +- export new smartcard functionality from gnutls for evo-exchange (gnome bug + [#334021]) * Mon Feb 19 2007 - maw@suse.de - Update to version 2.2.100 - Remove header-parsing.patch which is now upstream.