diff -Nru libsoup2.4-2.60.3/aclocal.m4 libsoup2.4-2.61.90/aclocal.m4 --- libsoup2.4-2.60.3/aclocal.m4 2018-01-09 11:05:47.000000000 +0000 +++ libsoup2.4-2.61.90/aclocal.m4 2018-02-05 15:54:13.000000000 +0000 @@ -299,6 +299,9 @@ # Configure paths for GLIB # Owen Taylor 1997-2001 +# Increment this whenever this file is changed. +#serial 1 + 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, dnl gthread, or gio is specified in MODULES, pass to pkg-config @@ -388,7 +391,7 @@ #include int -main () +main (void) { unsigned int major, minor, micro; diff -Nru libsoup2.4-2.60.3/config.h.win32 libsoup2.4-2.61.90/config.h.win32 --- libsoup2.4-2.60.3/config.h.win32 2018-01-09 11:05:50.000000000 +0000 +++ libsoup2.4-2.61.90/config.h.win32 2018-02-05 15:55:58.000000000 +0000 @@ -87,7 +87,7 @@ #define PACKAGE_NAME "libsoup" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libsoup 2.60.3" +#define PACKAGE_STRING "libsoup 2.61.90" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libsoup" @@ -96,7 +96,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.60.3" +#define PACKAGE_VERSION "2.61.90" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 diff -Nru libsoup2.4-2.60.3/configure libsoup2.4-2.61.90/configure --- libsoup2.4-2.60.3/configure 2018-01-09 11:05:47.000000000 +0000 +++ libsoup2.4-2.61.90/configure 2018-02-05 15:54:14.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libsoup 2.60.3. +# Generated by GNU Autoconf 2.69 for libsoup 2.61.90. # # Report bugs to . # @@ -651,8 +651,8 @@ # Identity of this package. PACKAGE_NAME='libsoup' PACKAGE_TARNAME='libsoup' -PACKAGE_VERSION='2.60.3' -PACKAGE_STRING='libsoup 2.60.3' +PACKAGE_VERSION='2.61.90' +PACKAGE_STRING='libsoup 2.61.90' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup' PACKAGE_URL='' @@ -1553,7 +1553,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libsoup 2.60.3 to adapt to many kinds of systems. +\`configure' configures libsoup 2.61.90 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1624,7 +1624,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libsoup 2.60.3:";; + short | recursive ) echo "Configuration of libsoup 2.61.90:";; esac cat <<\_ACEOF @@ -1778,7 +1778,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libsoup configure 2.60.3 +libsoup configure 2.61.90 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2056,7 +2056,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libsoup $as_me 2.60.3, which was +It was created by libsoup $as_me 2.61.90, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2922,7 +2922,7 @@ # Define the identity of the package. PACKAGE='libsoup' - VERSION='2.60.3' + VERSION='2.61.90' cat >>confdefs.h <<_ACEOF @@ -3088,8 +3088,8 @@ SOUP_MAJOR_VERSION=2 -SOUP_MINOR_VERSION=60 -SOUP_MICRO_VERSION=3 +SOUP_MINOR_VERSION=61 +SOUP_MICRO_VERSION=90 @@ -12764,7 +12764,7 @@ #include int -main () +main (void) { unsigned int major, minor, micro; @@ -15407,7 +15407,7 @@ int main () { -int main (void) { return 0; } +return 0 ; return 0; } @@ -16061,7 +16061,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libsoup $as_me 2.60.3, which was +This file was extended by libsoup $as_me 2.61.90, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16127,7 +16127,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libsoup config.status 2.60.3 +libsoup config.status 2.61.90 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru libsoup2.4-2.60.3/configure.ac libsoup2.4-2.61.90/configure.ac --- libsoup2.4-2.60.3/configure.ac 2018-01-09 10:57:10.000000000 +0000 +++ libsoup2.4-2.61.90/configure.ac 2018-02-05 15:54:00.000000000 +0000 @@ -3,8 +3,8 @@ dnl ******************************************* m4_define([soup_major_version], [2]) -m4_define([soup_minor_version], [60]) -m4_define([soup_micro_version], [3]) +m4_define([soup_minor_version], [61]) +m4_define([soup_micro_version], [90]) AC_PREREQ(2.63) AC_INIT([libsoup],[soup_major_version.soup_minor_version.soup_micro_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup]) @@ -377,7 +377,7 @@ SAVED_CFLAGS="${CFLAGS}" CFLAGS="-fvisibility=hidden" AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) - AC_TRY_COMPILE([], [int main (void) { return 0; }], + AC_TRY_COMPILE([], [return 0], AC_MSG_RESULT(yes) enable_fvisibility_hidden=yes, AC_MSG_RESULT(no) diff -Nru libsoup2.4-2.60.3/debian/changelog libsoup2.4-2.61.90/debian/changelog --- libsoup2.4-2.60.3/debian/changelog 2018-01-21 14:24:30.000000000 +0000 +++ libsoup2.4-2.61.90/debian/changelog 2018-02-05 17:42:17.000000000 +0000 @@ -1,3 +1,10 @@ +libsoup2.4 (2.61.90-1) experimental; urgency=medium + + * New upstream release + * debian/libsoup2.4-1.symbols: Add new symbols + + -- Jeremy Bicha Mon, 05 Feb 2018 12:42:17 -0500 + libsoup2.4 (2.60.3-1) unstable; urgency=medium * New upstream release diff -Nru libsoup2.4-2.60.3/debian/libsoup2.4-1.symbols libsoup2.4-2.61.90/debian/libsoup2.4-1.symbols --- libsoup2.4-2.60.3/debian/libsoup2.4-1.symbols 2018-01-21 14:24:30.000000000 +0000 +++ libsoup2.4-2.61.90/debian/libsoup2.4-1.symbols 2018-02-05 17:42:17.000000000 +0000 @@ -412,6 +412,8 @@ soup_session_async_new@Base 2.4.0 soup_session_async_new_with_options@Base 2.4.0 soup_session_cancel_message@Base 2.4.0 + soup_session_connect_async@Base 2.61.90 + soup_session_connect_finish@Base 2.61.90 soup_session_feature_add_feature@Base 2.33.92 soup_session_feature_attach@Base 2.24.3 soup_session_feature_detach@Base 2.24.3 diff -Nru libsoup2.4-2.60.3/debian/watch libsoup2.4-2.61.90/debian/watch --- libsoup2.4-2.60.3/debian/watch 2018-01-21 14:24:30.000000000 +0000 +++ libsoup2.4-2.61.90/debian/watch 2018-02-05 17:42:17.000000000 +0000 @@ -1,3 +1,3 @@ version=4 -https://download.gnome.org/sources/libsoup/([\d\.]+[02468])/ \ +https://download.gnome.org/sources/libsoup/([\d\.]+)/ \ libsoup@ANY_VERSION@\.tar\.xz diff -Nru libsoup2.4-2.60.3/docs/reference/html/libsoup-2.4-Soup-Miscellaneous-Utilities.html libsoup2.4-2.61.90/docs/reference/html/libsoup-2.4-Soup-Miscellaneous-Utilities.html --- libsoup2.4-2.60.3/docs/reference/html/libsoup-2.4-Soup-Miscellaneous-Utilities.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/libsoup-2.4-Soup-Miscellaneous-Utilities.html 2018-02-05 16:16:32.000000000 +0000 @@ -352,7 +352,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupDate
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupCookie.html libsoup2.4-2.61.90/docs/reference/html/SoupCookie.html --- libsoup2.4-2.60.3/docs/reference/html/SoupCookie.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupCookie.html 2018-02-05 16:16:32.000000000 +0000 @@ -304,7 +304,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupCookie
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupMessageBody.html libsoup2.4-2.61.90/docs/reference/html/SoupMessageBody.html --- libsoup2.4-2.60.3/docs/reference/html/SoupMessageBody.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupMessageBody.html 2018-02-05 16:16:32.000000000 +0000 @@ -244,7 +244,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ├── SoupBuffer
     ╰── SoupMessageBody
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupMessageHeaders.html libsoup2.4-2.61.90/docs/reference/html/SoupMessageHeaders.html --- libsoup2.4-2.60.3/docs/reference/html/SoupMessageHeaders.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupMessageHeaders.html 2018-02-05 16:16:32.000000000 +0000 @@ -333,7 +333,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupMessageHeaders
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupMultipart.html libsoup2.4-2.61.90/docs/reference/html/SoupMultipart.html --- libsoup2.4-2.60.3/docs/reference/html/SoupMultipart.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupMultipart.html 2018-02-05 16:16:32.000000000 +0000 @@ -130,7 +130,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupMultipart
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupServer.html libsoup2.4-2.61.90/docs/reference/html/SoupServer.html --- libsoup2.4-2.60.3/docs/reference/html/SoupServer.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupServer.html 2018-02-05 16:16:32.000000000 +0000 @@ -419,7 +419,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupClientContext
     GObject
     ╰── SoupServer
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupSessionFeature.html libsoup2.4-2.61.90/docs/reference/html/SoupSessionFeature.html
--- libsoup2.4-2.60.3/docs/reference/html/SoupSessionFeature.html	2018-01-09 11:14:42.000000000 +0000
+++ libsoup2.4-2.61.90/docs/reference/html/SoupSessionFeature.html	2018-02-05 16:16:32.000000000 +0000
@@ -55,7 +55,7 @@
 

Object Hierarchy

-
    GInterface
+
    GInterface
     ╰── SoupSessionFeature
 
diff -Nru libsoup2.4-2.60.3/docs/reference/html/SoupURI.html libsoup2.4-2.61.90/docs/reference/html/SoupURI.html --- libsoup2.4-2.60.3/docs/reference/html/SoupURI.html 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/html/SoupURI.html 2018-02-05 16:16:32.000000000 +0000 @@ -345,7 +345,7 @@

Object Hierarchy

-
    GBoxed
+
    GBoxed
     ╰── SoupURI
 
diff -Nru libsoup2.4-2.60.3/docs/reference/libsoup-2.4-sections.txt libsoup2.4-2.61.90/docs/reference/libsoup-2.4-sections.txt --- libsoup2.4-2.60.3/docs/reference/libsoup-2.4-sections.txt 2018-01-09 11:14:42.000000000 +0000 +++ libsoup2.4-2.61.90/docs/reference/libsoup-2.4-sections.txt 2018-02-05 16:16:32.000000000 +0000 @@ -475,6 +475,10 @@ soup_session_steal_connection +SoupSessionConnectProgressCallback +soup_session_connect_async +soup_session_connect_finish + SOUP_SESSION_PROXY_URI SOUP_SESSION_PROXY_RESOLVER SOUP_SESSION_MAX_CONNS diff -Nru libsoup2.4-2.60.3/libsoup/soup-address.c libsoup2.4-2.61.90/libsoup/soup-address.c --- libsoup2.4-2.60.3/libsoup/soup-address.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-address.c 2018-01-29 15:03:31.000000000 +0000 @@ -1246,7 +1246,7 @@ SoupAddressPrivate *priv; addr_enum = g_object_new (SOUP_TYPE_ADDRESS_ADDRESS_ENUMERATOR, NULL); - addr_enum->addr = g_object_ref (connectable); + addr_enum->addr = g_object_ref (SOUP_ADDRESS (connectable)); priv = soup_address_get_instance_private (addr_enum->addr); addr_enum->orig_offset = priv->offset; diff -Nru libsoup2.4-2.60.3/libsoup/soup-cache.c libsoup2.4-2.61.90/libsoup/soup-cache.c --- libsoup2.4-2.60.3/libsoup/soup-cache.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-cache.c 2018-01-29 15:03:31.000000000 +0000 @@ -855,7 +855,7 @@ soup_cache_entry_remove (cache, entry, TRUE); request_time = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "request-time")); - response_time = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "request-time")); + response_time = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "response-time")); entry = soup_cache_entry_new (cache, msg, request_time, response_time); entry->hits = 1; entry->dirty = TRUE; @@ -928,7 +928,7 @@ priv = SOUP_CACHE (object)->priv; - // Cannot use g_hash_table_foreach as callbacks must not modify the hash table + /* Cannot use g_hash_table_foreach as callbacks must not modify the hash table */ entries = g_hash_table_get_values (priv->cache); g_list_foreach (entries, remove_cache_item, object); g_list_free (entries); @@ -1338,7 +1338,7 @@ g_return_if_fail (SOUP_IS_CACHE (cache)); g_return_if_fail (cache->priv->cache); - // Cannot use g_hash_table_foreach as callbacks must not modify the hash table + /* Cannot use g_hash_table_foreach as callbacks must not modify the hash table */ entries = g_hash_table_get_values (cache->priv->cache); g_list_foreach (entries, clear_cache_item, cache); g_list_free (entries); diff -Nru libsoup2.4-2.60.3/libsoup/soup-content-sniffer.c libsoup2.4-2.61.90/libsoup/soup-content-sniffer.c --- libsoup2.4-2.60.3/libsoup/soup-content-sniffer.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-content-sniffer.c 2018-01-29 15:03:31.000000000 +0000 @@ -854,7 +854,7 @@ { SoupMessagePrivate *priv = SOUP_MESSAGE_GET_PRIVATE (msg); - priv->sniffer = g_object_ref (feature); + priv->sniffer = g_object_ref (SOUP_CONTENT_SNIFFER (feature)); g_signal_connect (msg, "got-headers", G_CALLBACK (soup_content_sniffer_got_headers_cb), feature); diff -Nru libsoup2.4-2.60.3/libsoup/soup-cookie-jar.c libsoup2.4-2.61.90/libsoup/soup-cookie-jar.c --- libsoup2.4-2.60.3/libsoup/soup-cookie-jar.c 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-cookie-jar.c 2018-02-05 14:38:18.000000000 +0000 @@ -12,6 +12,7 @@ #include #include "soup-cookie-jar.h" +#include "soup-misc-private.h" #include "soup.h" /** @@ -509,6 +510,26 @@ soup_cookie_jar_changed (jar, NULL, cookie); } +static gboolean +incoming_cookie_is_third_party (SoupCookie *cookie, SoupURI *first_party) +{ + const char *cookie_base_domain; + const char *first_party_base_domain; + + if (first_party == NULL || first_party->host == NULL) + return TRUE; + + cookie_base_domain = soup_tld_get_base_domain (cookie->domain, NULL); + if (cookie_base_domain == NULL) + cookie_base_domain = cookie->domain; + + first_party_base_domain = soup_tld_get_base_domain (first_party->host, NULL); + if (first_party_base_domain == NULL) + first_party_base_domain = first_party->host; + + return !soup_host_matches_host (cookie_base_domain, first_party_base_domain); +} + /** * soup_cookie_jar_add_cookie_with_first_party: * @jar: a #SoupCookieJar @@ -542,7 +563,7 @@ } if (priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_ALWAYS || - soup_cookie_domain_matches (cookie, first_party->host)) { + !incoming_cookie_is_third_party (cookie, first_party)) { /* will steal or free soup_cookie */ soup_cookie_jar_add_cookie (jar, cookie); } else { @@ -644,8 +665,7 @@ SoupURI *first_party = soup_message_get_first_party (msg); if ((priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY && - first_party != NULL && first_party->host && - soup_cookie_domain_matches (nc->data, first_party->host)) || + !incoming_cookie_is_third_party (nc->data, first_party)) || priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_ALWAYS) soup_cookie_jar_add_cookie (jar, nc->data); else diff -Nru libsoup2.4-2.60.3/libsoup/soup-message-queue.h libsoup2.4-2.61.90/libsoup/soup-message-queue.h --- libsoup2.4-2.60.3/libsoup/soup-message-queue.h 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-message-queue.h 2018-02-05 08:54:58.000000000 +0000 @@ -50,6 +50,7 @@ guint async : 1; guint async_pending : 1; guint conn_is_dedicated : 1; + guint connect_only : 1; guint priority : 3; guint resend_count : 5; diff -Nru libsoup2.4-2.60.3/libsoup/soup-session.c libsoup2.4-2.61.90/libsoup/soup-session.c --- libsoup2.4-2.60.3/libsoup/soup-session.c 2018-01-09 09:48:59.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-session.c 2018-02-05 08:54:58.000000000 +0000 @@ -1976,6 +1976,11 @@ break; case SOUP_MESSAGE_READY: + if (item->connect_only) { + item->state = SOUP_MESSAGE_FINISHING; + break; + } + if (item->msg->status_code) { if (item->msg->status_code == SOUP_STATUS_TRY_AGAIN) { soup_message_cleanup_response (item->msg); @@ -4683,6 +4688,42 @@ return error; } +static GIOStream * +steal_connection (SoupSession *session, + SoupMessageQueueItem *item) +{ + SoupSessionPrivate *priv = soup_session_get_instance_private (session); + SoupConnection *conn; + SoupSocket *sock; + SoupSessionHost *host; + GIOStream *stream; + + conn = g_object_ref (item->conn); + soup_session_set_item_connection (session, item, NULL); + + g_mutex_lock (&priv->conn_lock); + host = get_host_for_message (session, item->msg); + g_hash_table_remove (priv->conns, conn); + drop_connection (session, host, conn); + g_mutex_unlock (&priv->conn_lock); + + sock = soup_connection_get_socket (conn); + g_object_set (sock, + SOUP_SOCKET_TIMEOUT, 0, + NULL); + + if (item->connect_only) + stream = g_object_ref (soup_socket_get_connection (sock)); + else + stream = soup_message_io_steal (item->msg); + g_object_set_data_full (G_OBJECT (stream), "GSocket", + soup_socket_steal_gsocket (sock), + g_object_unref); + g_object_unref (conn); + + return stream; +} + /** * soup_session_steal_connection: * @session: a #SoupSession @@ -4710,41 +4751,17 @@ { SoupSessionPrivate *priv = soup_session_get_instance_private (session); SoupMessageQueueItem *item; - SoupConnection *conn; - SoupSocket *sock; - SoupSessionHost *host; - GIOStream *stream; + GIOStream *stream = NULL; item = soup_message_queue_lookup (priv->queue, msg); if (!item) return NULL; - if (!item->conn || - soup_connection_get_state (item->conn) != SOUP_CONNECTION_IN_USE) { - soup_message_queue_item_unref (item); - return NULL; - } - - conn = g_object_ref (item->conn); - soup_session_set_item_connection (session, item, NULL); - - g_mutex_lock (&priv->conn_lock); - host = get_host_for_message (session, item->msg); - g_hash_table_remove (priv->conns, conn); - drop_connection (session, host, conn); - g_mutex_unlock (&priv->conn_lock); - sock = soup_connection_get_socket (conn); - g_object_set (sock, - SOUP_SOCKET_TIMEOUT, 0, - NULL); - - stream = soup_message_io_steal (item->msg); - g_object_set_data_full (G_OBJECT (stream), "GSocket", - soup_socket_steal_gsocket (sock), - g_object_unref); - g_object_unref (conn); + if (item->conn && soup_connection_get_state (item->conn) == SOUP_CONNECTION_IN_USE) + stream = steal_connection (session, item); soup_message_queue_item_unref (item); + return stream; } @@ -4881,3 +4898,157 @@ return g_task_propagate_pointer (G_TASK (result), error); } + +/** + * SoupSessionConnectProgressCallback: + * @session: the #SoupSession + * @event: a #GSocketClientEvent + * @connection: the current state of the network connection + * @user_data: the data passed to soup_session_connect_async(). + * + * Prototype for the progress callback passed to soup_session_connect_async(). + * + * Since: 2.62 + */ + +typedef struct { + SoupMessageQueueItem *item; + SoupSessionConnectProgressCallback progress_callback; + gpointer user_data; +} ConnectAsyncData; + +static ConnectAsyncData * +connect_async_data_new (SoupMessageQueueItem *item, + SoupSessionConnectProgressCallback progress_callback, + gpointer user_data) +{ + ConnectAsyncData *data; + + soup_message_queue_item_ref (item); + + data = g_slice_new (ConnectAsyncData); + data->item = item; + data->progress_callback = progress_callback; + data->user_data = user_data; + + return data; +} + +static void +connect_async_data_free (ConnectAsyncData *data) +{ + soup_message_queue_item_unref (data->item); + + g_slice_free (ConnectAsyncData, data); +} + +static void +connect_async_message_network_event (SoupMessage *msg, + GSocketClientEvent event, + GIOStream *connection, + GTask *task) +{ + ConnectAsyncData *data = g_task_get_task_data (task); + + if (data->progress_callback) + data->progress_callback (data->item->session, event, connection, data->user_data); +} + +static void +connect_async_message_finished (SoupMessage *msg, + GTask *task) +{ + ConnectAsyncData *data = g_task_get_task_data (task); + SoupMessageQueueItem *item = data->item; + + if (!item->conn || item->error) { + g_task_return_error (task, g_error_copy (item->error)); + } else { + g_task_return_pointer (task, + steal_connection (item->session, item), + g_object_unref); + } + g_object_unref (task); +} + +/** + * soup_session_connect_async: + * @session: a #SoupSession + * @uri: a #SoupURI to connect to + * @cancellable: a #GCancellable + * @progress_callback: (allow-none) (scope async): a #SoupSessionConnectProgressCallback which + * will be called for every network event that occurs during the connection. + * @callback: (allow-none) (scope async): the callback to invoke when the operation finishes + * @user_data: data for @progress_callback and @callback + * + * Start a connection to @uri. The operation can be monitored by providing a @progress_callback + * and finishes when the connection is done or an error ocurred. + * + * Call soup_session_connect_finish() to get the #GIOStream to communicate with the server. + * + * Since: 2.62 + */ +void +soup_session_connect_async (SoupSession *session, + SoupURI *uri, + GCancellable *cancellable, + SoupSessionConnectProgressCallback progress_callback, + GAsyncReadyCallback callback, + gpointer user_data) +{ + SoupSessionPrivate *priv; + SoupMessage *msg; + SoupMessageQueueItem *item; + ConnectAsyncData *data; + GTask *task; + + g_return_if_fail (SOUP_IS_SESSION (session)); + g_return_if_fail (!SOUP_IS_SESSION_SYNC (session)); + priv = soup_session_get_instance_private (session); + g_return_if_fail (priv->use_thread_context); + g_return_if_fail (uri != NULL); + + task = g_task_new (session, cancellable, callback, user_data); + + msg = soup_message_new_from_uri (SOUP_METHOD_HEAD, uri); + soup_message_set_flags (msg, SOUP_MESSAGE_NEW_CONNECTION); + g_signal_connect_object (msg, "finished", + G_CALLBACK (connect_async_message_finished), + task, 0); + if (progress_callback) { + g_signal_connect_object (msg, "network-event", + G_CALLBACK (connect_async_message_network_event), + task, 0); + } + + item = soup_session_append_queue_item (session, msg, TRUE, FALSE, NULL, NULL); + item->connect_only = TRUE; + data = connect_async_data_new (item, progress_callback, user_data); + g_task_set_task_data (task, data, (GDestroyNotify) connect_async_data_free); + soup_session_kick_queue (session); + soup_message_queue_item_unref (item); + g_object_unref (msg); +} + +/** + * soup_session_connect_finish: + * @session: a #SoupSession + * @result: the #GAsyncResult passed to your callback + * @error: return location for a #GError, or %NULL + * + * Gets the #GIOStream created for the connection to communicate with the server. + * + * Return value: (transfer full): a new #GIOStream, or %NULL on error. + * + * Since: 2.62 + */ +GIOStream * +soup_session_connect_finish (SoupSession *session, + GAsyncResult *result, + GError **error) +{ + g_return_val_if_fail (SOUP_IS_SESSION (session), NULL); + g_return_val_if_fail (g_task_is_valid (result, session), NULL); + + return g_task_propagate_pointer (G_TASK (result), error); +} diff -Nru libsoup2.4-2.60.3/libsoup/soup-session.h libsoup2.4-2.61.90/libsoup/soup-session.h --- libsoup2.4-2.60.3/libsoup/soup-session.h 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-session.h 2018-02-05 08:54:58.000000000 +0000 @@ -234,6 +234,24 @@ GAsyncResult *result, GError **error); +typedef void (*SoupSessionConnectProgressCallback) (SoupSession *session, + GSocketClientEvent event, + GIOStream *connection, + gpointer user_data); + +SOUP_AVAILABLE_IN_2_62 +void soup_session_connect_async (SoupSession *session, + SoupURI *uri, + GCancellable *cancellable, + SoupSessionConnectProgressCallback progress_callback, + GAsyncReadyCallback callback, + gpointer user_data); + +SOUP_AVAILABLE_IN_2_62 +GIOStream *soup_session_connect_finish (SoupSession *session, + GAsyncResult *result, + GError **error); + G_END_DECLS #endif /* SOUP_SESSION_H */ diff -Nru libsoup2.4-2.60.3/libsoup/soup-version.h.in libsoup2.4-2.61.90/libsoup/soup-version.h.in --- libsoup2.4-2.60.3/libsoup/soup-version.h.in 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-version.h.in 2018-02-05 08:54:58.000000000 +0000 @@ -65,6 +65,7 @@ #define SOUP_VERSION_2_54 (G_ENCODE_VERSION (2, 54)) #define SOUP_VERSION_2_56 (G_ENCODE_VERSION (2, 56)) #define SOUP_VERSION_2_58 (G_ENCODE_VERSION (2, 58)) +#define SOUP_VERSION_2_62 (G_ENCODE_VERSION (2, 62)) /* evaluates to the current stable version; for development cycles, * this means the next stable target @@ -359,6 +360,20 @@ # define SOUP_AVAILABLE_IN_2_58 _SOUP_EXTERN #endif +#if SOUP_VERSION_MIN_REQUIRED >= SOUP_VERSION_2_62 +# define SOUP_DEPRECATED_IN_2_62 G_DEPRECATED +# define SOUP_DEPRECATED_IN_2_62_FOR(f) G_DEPRECATED_FOR(f) +#else +# define SOUP_DEPRECATED_IN_2_62 +# define SOUP_DEPRECATED_IN_2_62_FOR(f) +#endif + +#if SOUP_VERSION_MAX_ALLOWED < SOUP_VERSION_2_62 +# define SOUP_AVAILABLE_IN_2_62 G_UNAVAILABLE(2, 62) _SOUP_EXTERN +#else +# define SOUP_AVAILABLE_IN_2_62 _SOUP_EXTERN +#endif + SOUP_AVAILABLE_IN_2_42 guint soup_get_major_version (void); diff -Nru libsoup2.4-2.60.3/libsoup/soup-websocket-connection.c libsoup2.4-2.61.90/libsoup/soup-websocket-connection.c --- libsoup2.4-2.60.3/libsoup/soup-websocket-connection.c 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/soup-websocket-connection.c 2018-02-05 08:54:58.000000000 +0000 @@ -96,11 +96,18 @@ static guint signals[NUM_SIGNALS] = { 0, }; +typedef enum { + SOUP_WEBSOCKET_QUEUE_NORMAL = 0, + SOUP_WEBSOCKET_QUEUE_URGENT = 1 << 0, + SOUP_WEBSOCKET_QUEUE_LAST = 1 << 1, +} SoupWebsocketQueueFlags; + typedef struct { GBytes *data; - gboolean last; gsize sent; gsize amount; + SoupWebsocketQueueFlags flags; + gboolean pending; } Frame; struct _SoupWebsocketConnectionPrivate { @@ -143,15 +150,11 @@ G_DEFINE_TYPE_WITH_PRIVATE (SoupWebsocketConnection, soup_websocket_connection, G_TYPE_OBJECT) -typedef enum { - SOUP_WEBSOCKET_QUEUE_NORMAL = 0, - SOUP_WEBSOCKET_QUEUE_URGENT = 1 << 0, - SOUP_WEBSOCKET_QUEUE_LAST = 1 << 1, -} SoupWebsocketQueueFlags; - static void queue_frame (SoupWebsocketConnection *self, SoupWebsocketQueueFlags flags, gpointer data, gsize len, gsize amount); +static void protocol_error_and_close (SoupWebsocketConnection *self); + static void frame_free (gpointer data) { @@ -358,11 +361,12 @@ outer = bytes->data; outer[0] = 0x80 | opcode; - /* If control message, truncate payload */ + /* If control message, check payload size */ if (opcode & 0x08) { if (length > 125) { - g_warning ("Truncating WebSocket control message payload"); - length = 125; + g_warning ("WebSocket control message payload exceeds size limit"); + protocol_error_and_close (self); + return; } buffered_amount = 0; @@ -574,7 +578,11 @@ } break; default: - g_debug ("Wrong closing code %d received", code); + if (code < 3000) { + g_debug ("Wrong closing code %d received", code); + protocol_error_and_close (self); + return; + } } g_signal_emit (self, signals[CLOSING], 0); @@ -601,17 +609,32 @@ pv->peer_close_data = NULL; pv->close_received = TRUE; - /* Store the code/data payload */ - if (len >= 2) { + switch (len) { + case 0: + /* Send a clean close when having an empty payload */ + close_connection (self, 1000, NULL); + return; + case 1: + /* Send a protocol error since the close code is incomplete */ + protocol_error_and_close (self); + return; + default: + /* Store the code/data payload */ pv->peer_close_code = (guint16)data[0] << 8 | data[1]; + break; } + if (len > 2) { data += 2; len -= 2; - if (g_utf8_validate ((char *)data, len, NULL)) - pv->peer_close_data = g_strndup ((char *)data, len); - else + + if (!g_utf8_validate ((char *)data, len, NULL)) { g_debug ("received non-UTF8 close data: %d '%.*s' %d", (int)len, (int)len, (char *)data, (int)data[0]); + protocol_error_and_close (self); + return; + } + + pv->peer_close_data = g_strndup ((char *)data, len); } /* Once we receive close response on server, close immediately */ @@ -620,7 +643,7 @@ if (pv->connection_type == SOUP_WEBSOCKET_CONNECTION_SERVER) close_io_stream (self); } else { - close_connection (self, pv->peer_close_code, NULL); + close_connection (self, pv->peer_close_code, pv->peer_close_data); } } @@ -688,7 +711,8 @@ break; default: g_debug ("received unsupported control frame: %d", (int)opcode); - break; + protocol_error_and_close (self); + return; } } else if (pv->close_received) { g_debug ("received message after close was received"); @@ -737,7 +761,22 @@ switch (pv->message_opcode) { case 0x01: - if (!g_utf8_validate ((char *)payload, payload_len, NULL)) { + case 0x02: + g_byte_array_append (pv->message_data, payload, payload_len); + break; + default: + g_debug ("received unknown data frame: %d", (int)opcode); + protocol_error_and_close (self); + return; + } + + /* Actually deliver the message? */ + if (fin) { + if (pv->message_opcode == 0x01 && + !g_utf8_validate((char *)pv->message_data->data, + pv->message_data->len, + NULL)) { + g_debug ("received invalid non-UTF8 text data"); /* Discard the entire message */ @@ -748,17 +787,7 @@ bad_data_error_and_close (self); return; } - /* fall through */ - case 0x02: - g_byte_array_append (pv->message_data, payload, payload_len); - break; - default: - g_debug ("received unknown data frame: %d", (int)opcode); - break; - } - /* Actually deliver the message? */ - if (fin) { /* Always null terminate, as a convenience */ g_byte_array_append (pv->message_data, (guchar *)"\0", 1); @@ -801,6 +830,11 @@ opcode = header[0] & 0x0f; masked = ((header[1] & 0x80) != 0); + /* We do not support extensions, reserved bits must be 0 */ + if (header[0] & 0x70) { + protocol_error_and_close (self); + } + switch (header[1] & 0x7f) { case 126: at = 4; @@ -957,6 +991,9 @@ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { g_clear_error (&error); count = 0; + + g_debug ("failed to send frame because it would block, marking as pending"); + frame->pending = TRUE; } else { emit_error_and_close (self, error, TRUE); return FALSE; @@ -968,7 +1005,7 @@ g_debug ("sent frame"); g_queue_pop_head (&pv->outgoing); - if (frame->last) { + if (frame->flags & SOUP_WEBSOCKET_QUEUE_LAST) { if (pv->connection_type == SOUP_WEBSOCKET_CONNECTION_SERVER) { close_io_stream (self); } else { @@ -1005,7 +1042,6 @@ { SoupWebsocketConnectionPrivate *pv = self->pv; Frame *frame; - Frame *prev; g_return_if_fail (SOUP_IS_WEBSOCKET_CONNECTION (self)); g_return_if_fail (pv->close_sent == FALSE); @@ -1015,21 +1051,22 @@ frame = g_slice_new0 (Frame); frame->data = g_bytes_new_take (data, len); frame->amount = amount; - frame->last = (flags & SOUP_WEBSOCKET_QUEUE_LAST) ? TRUE : FALSE; + frame->flags = flags; /* If urgent put at front of queue */ if (flags & SOUP_WEBSOCKET_QUEUE_URGENT) { - /* But we can't interrupt a message already partially sent */ - prev = g_queue_pop_head (&pv->outgoing); - if (prev == NULL) { - g_queue_push_head (&pv->outgoing, frame); - } else if (prev->sent > 0) { - g_queue_push_head (&pv->outgoing, frame); - g_queue_push_head (&pv->outgoing, prev); - } else { - g_queue_push_head (&pv->outgoing, prev); - g_queue_push_head (&pv->outgoing, frame); + GList *l; + + /* Find out the first frame that is not urgent or partially sent or pending */ + for (l = g_queue_peek_head_link (&pv->outgoing); l != NULL; l = l->next) { + Frame *prev = l->data; + + if (!(prev->flags & SOUP_WEBSOCKET_QUEUE_URGENT) && + prev->sent == 0 && !prev->pending) + break; } + + g_queue_insert_before (&pv->outgoing, l, frame); } else { g_queue_push_tail (&pv->outgoing, frame); } diff -Nru libsoup2.4-2.60.3/libsoup/tld-parser.py libsoup2.4-2.61.90/libsoup/tld-parser.py --- libsoup2.4-2.60.3/libsoup/tld-parser.py 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/libsoup/tld-parser.py 2018-01-09 14:16:29.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Generate tld rules # Copyright (C) 2012 Red Hat, Inc. diff -Nru libsoup2.4-2.60.3/Makefile.in libsoup2.4-2.61.90/Makefile.in --- libsoup2.4-2.60.3/Makefile.in 2018-01-09 11:05:47.000000000 +0000 +++ libsoup2.4-2.61.90/Makefile.in 2018-02-05 15:54:15.000000000 +0000 @@ -205,8 +205,7 @@ $(top_srcdir)/build-aux/ltmain.sh \ $(top_srcdir)/build-aux/missing AUTHORS COPYING NEWS README \ build-aux/compile build-aux/config.guess build-aux/config.sub \ - build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ - build-aux/missing + build-aux/install-sh build-aux/ltmain.sh build-aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) diff -Nru libsoup2.4-2.60.3/NEWS libsoup2.4-2.61.90/NEWS --- libsoup2.4-2.60.3/NEWS 2018-01-09 10:59:29.000000000 +0000 +++ libsoup2.4-2.61.90/NEWS 2018-02-05 15:54:00.000000000 +0000 @@ -1,13 +1,34 @@ -Changes in libsoup from 2.60.2 to 2.60.3: +Changes in libsoup from 2.61.2 to 2.61.90: - * heap-buffer-overflow in soup_ntlm_parse_challenge() - [#788037, Milan Crha] + * Various improvements to the WebSocket implementation + [#792113, Italo Guerrieri] + + * cookie-jar: use base domain to decide if cookie is third party + [#792130, Michael Catanzaro] + + * Add new API to create a new connection from a SoupSession + [#792212, Carlos Garcia Campos] + + * soup-headers: accept any 3 digit number as message status code + [#792124, Carlos Garcia Campos] + +Changes in libsoup from 2.61.1 to 2.61.2: * session: don't request Keep-Alive for upgraded connections [#788723, Lionel Landwerlin] - * soup-headers: accept any 3 digit number as message status code - [#792124, Carlos Garcia Campos] +Changes in libsoup from 2.60.2 to 2.61.1: + + * tld-parser: use Python 3 [#785735, Ross Burton] + + * Fix heap-buffer-overflow in soup_ntlm_parse_challenge() + [#788037, Milan Crha] + + * Fix possibly uninitialized value in ssl-test + [Tomas Popela] + + * SoupCache: fix the timestamp for responses [#791031, + Claudio Saavedra] Changes in libsoup from 2.60.1 to 2.60.2: diff -Nru libsoup2.4-2.60.3/tests/auth-test.c libsoup2.4-2.61.90/tests/auth-test.c --- libsoup2.4-2.60.3/tests/auth-test.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/tests/auth-test.c 2018-01-09 14:16:29.000000000 +0000 @@ -1132,7 +1132,8 @@ SoupSession *session; int counter; - g_test_bug ("https://bugzilla.redhat.com/show_bug.cgi?id=916224"); + g_test_bug_base ("https://bugzilla.redhat.com/"); + g_test_bug ("916224"); server = soup_test_server_new (FALSE); soup_server_add_handler (server, NULL, diff -Nru libsoup2.4-2.60.3/tests/chunk-test.c libsoup2.4-2.61.90/tests/chunk-test.c --- libsoup2.4-2.60.3/tests/chunk-test.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/tests/chunk-test.c 2018-01-09 14:16:29.000000000 +0000 @@ -314,7 +314,8 @@ char *client_md5; const char *server_md5; - g_test_bug ("https://bugs.webkit.org/show_bug.cgi?id=18343"); + g_test_bug_base ("https://bugs.webkit.org/"); + g_test_bug ("18343"); msg = soup_message_new_from_uri ("PUT", base_uri); soup_message_body_append (msg->request_body, SOUP_MEMORY_TEMPORARY, diff -Nru libsoup2.4-2.60.3/tests/connection-test.c libsoup2.4-2.61.90/tests/connection-test.c --- libsoup2.4-2.60.3/tests/connection-test.c 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/tests/connection-test.c 2018-02-05 08:54:58.000000000 +0000 @@ -914,6 +914,186 @@ soup_test_session_abort_unref (session); } +typedef struct { + GMainLoop *loop; + GIOStream *stream; + GError *error; + const char *events; +} ConnectTestData; + +static void +connect_progress (SoupSession *session, GSocketClientEvent event, GIOStream *connection, ConnectTestData *data) +{ + soup_test_assert (*data->events == event_abbrevs[event], + "Unexpected event: %s (expected %s)", + event_names[event], + event_name_from_abbrev (*data->events)); + data->events = data->events + 1; +} + +static void +connect_finished (SoupSession *session, GAsyncResult *result, ConnectTestData *data) +{ + data->stream = soup_session_connect_finish (session, result, &data->error); + g_main_loop_quit (data->loop); +} + +static void +do_one_connection_connect_test (SoupSession *session, SoupURI *uri, const char *response, const char *events) +{ + ConnectTestData data = { NULL, NULL, NULL, events }; + static const char *request = "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n"; + gsize bytes = 0; + char buffer[128]; + + data.loop = g_main_loop_new (NULL, FALSE); + soup_session_connect_async (session, uri, NULL, + (SoupSessionConnectProgressCallback)connect_progress, + (GAsyncReadyCallback)connect_finished, + &data); + g_main_loop_run (data.loop); + + g_assert (G_IS_IO_STREAM (data.stream)); + g_assert_no_error (data.error); + g_assert (g_output_stream_write_all (g_io_stream_get_output_stream (data.stream), + request, strlen (request), &bytes, NULL, NULL)); + g_assert (g_input_stream_read_all (g_io_stream_get_input_stream (data.stream), + buffer, sizeof (buffer), &bytes, NULL, NULL)); + buffer[strlen (response)] = '\0'; + g_assert_cmpstr (buffer, ==, response); + + while (*data.events) { + soup_test_assert (!*data.events, + "Expected %s", + event_name_from_abbrev (*data.events)); + data.events++; + } + + g_object_unref (data.stream); + g_main_loop_unref (data.loop); +} + +static void +do_one_connection_connect_fail_test (SoupSession *session, SoupURI *uri, GQuark domain, gint code, const char *events) +{ + ConnectTestData data = { NULL, NULL, NULL, events }; + + data.loop = g_main_loop_new (NULL, FALSE); + soup_session_connect_async (session, uri, NULL, + (SoupSessionConnectProgressCallback)connect_progress, + (GAsyncReadyCallback)connect_finished, + &data); + g_main_loop_run (data.loop); + + g_assert (!data.stream); + g_assert_error (data.error, domain, code); + + while (*data.events) { + soup_test_assert (!*data.events, + "Expected %s", + event_name_from_abbrev (*data.events)); + data.events++; + } +} + +static void +do_connection_connect_test (void) +{ + SoupSession *session; + SoupURI *http_uri; + SoupURI *https_uri = NULL; + SoupURI *ws_uri; + SoupURI *wss_uri = NULL; + SoupURI *file_uri; + SoupURI *wrong_http_uri; + SoupURI *proxy_uri; + + SOUP_TEST_SKIP_IF_NO_APACHE; + + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, + NULL); + + debug_printf (1, " http\n"); + http_uri = soup_uri_new (HTTP_SERVER); + do_one_connection_connect_test (session, http_uri, + "HTTP/1.1 200 OK", "rRcCx"); + + if (tls_available) { + debug_printf (1, " https\n"); + https_uri = soup_uri_new (HTTPS_SERVER); + do_one_connection_connect_test (session, https_uri, + "HTTP/1.1 200 OK", "rRcCtTx"); + } else + debug_printf (1, " https -- SKIPPING\n"); + + debug_printf (1, " ws\n"); + ws_uri = soup_uri_new (HTTP_SERVER); + ws_uri->scheme = SOUP_URI_SCHEME_WS; + do_one_connection_connect_test (session, ws_uri, + "HTTP/1.1 200 OK", "rRcCx"); + + if (tls_available) { + debug_printf (1, " wss\n"); + wss_uri = soup_uri_new (HTTPS_SERVER); + do_one_connection_connect_test (session, wss_uri, + "HTTP/1.1 200 OK", "rRcCtTx"); + } else + debug_printf (1, " wss -- SKIPPING\n"); + + debug_printf (1, " file\n"); + file_uri = soup_uri_new ("file:///foo/bar"); + do_one_connection_connect_fail_test (session, file_uri, + G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND, + "r"); + + debug_printf (1, " wrong http (invalid port)\n"); + wrong_http_uri = soup_uri_new (HTTP_SERVER); + wrong_http_uri->port = 1234; + do_one_connection_connect_fail_test (session, wrong_http_uri, + G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED, + "rRcr"); /* FIXME: why r again? GLib bug? */ + + proxy_uri = soup_uri_new (HTTP_PROXY); + g_object_set (G_OBJECT (session), + SOUP_SESSION_PROXY_URI, proxy_uri, + NULL); + + debug_printf (1, " http with proxy\n"); + do_one_connection_connect_test (session, http_uri, + "HTTP/1.1 403 Forbidden", "rRcCx"); + + if (tls_available) { + debug_printf (1, " https with proxy\n"); + do_one_connection_connect_test (session, https_uri, + "HTTP/1.1 200 OK", "rRcCpPtTx"); + } else + debug_printf (1, " https with proxy -- SKIPPING\n"); + + debug_printf (1, " ws with proxy\n"); + do_one_connection_connect_test (session, ws_uri, + "HTTP/1.1 403 Forbidden", "rRcCx"); + + if (tls_available) { + debug_printf (1, " wss with proxy\n"); + do_one_connection_connect_test (session, wss_uri, + "HTTP/1.1 200 OK", "rRcCpPtTx"); + } else + debug_printf (1, " wss with proxy -- SKIPPING\n"); + + soup_uri_free (http_uri); + if (https_uri) + soup_uri_free (https_uri); + soup_uri_free (ws_uri); + if (wss_uri) + soup_uri_free (wss_uri); + soup_uri_free (file_uri); + soup_uri_free (wrong_http_uri); + soup_uri_free (proxy_uri); + + soup_test_session_abort_unref (session); +} + int main (int argc, char **argv) { @@ -933,6 +1113,7 @@ g_test_add_func ("/connection/non-idempotent", do_non_idempotent_connection_test); g_test_add_func ("/connection/state", do_connection_state_test); g_test_add_func ("/connection/event", do_connection_event_test); + g_test_add_func ("/connection/connect", do_connection_connect_test); ret = g_test_run (); diff -Nru libsoup2.4-2.60.3/tests/cookies-test.c libsoup2.4-2.61.90/tests/cookies-test.c --- libsoup2.4-2.60.3/tests/cookies-test.c 2018-01-09 09:47:28.000000000 +0000 +++ libsoup2.4-2.61.90/tests/cookies-test.c 2018-02-05 14:38:18.000000000 +0000 @@ -94,6 +94,53 @@ soup_test_session_abort_unref (session); } +static void +do_cookies_subdomain_policy_test (void) +{ + SoupCookieJar *jar; + GSList *cookies; + SoupURI *uri1; + SoupURI *uri2; + + g_test_bug ("792130"); + + /* Only the base domain should be considered when deciding + * whether a cookie is a third-party cookie. + */ + uri1 = soup_uri_new ("https://www.gnome.org"); + uri2 = soup_uri_new ("https://foundation.gnome.org"); + + /* We can't check subdomains with a test server running on + * localhost, so we'll just check the cookie jar API itself. + */ + + /* Cookie should be accepted. One cookie in the jar. */ + jar = soup_cookie_jar_new (); + soup_cookie_jar_set_accept_policy (jar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); + soup_cookie_jar_set_cookie_with_first_party (jar, uri1, uri2, "1=foo"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 1); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* Cookie should be accepted. Two cookies in the jar. */ + soup_cookie_jar_set_cookie_with_first_party (jar, uri2, uri1, "2=foo"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 2); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + /* Third-party cookie should be rejected, so there are still + * only two cookies in the jar. + */ + soup_cookie_jar_set_cookie_with_first_party (jar, third_party_uri, uri1, "3=foo"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 2); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + + soup_uri_free (uri1); + soup_uri_free (uri2); + g_object_unref (jar); +} + /* FIXME: moar tests! */ static void do_cookies_parsing_test (void) @@ -182,6 +229,7 @@ soup_uri_set_port (third_party_uri, server_uri->port); g_test_add_func ("/cookies/accept-policy", do_cookies_accept_policy_test); + g_test_add_func ("/cookies/accept-policy-subdomains", do_cookies_subdomain_policy_test); g_test_add_func ("/cookies/parsing", do_cookies_parsing_test); ret = g_test_run (); diff -Nru libsoup2.4-2.60.3/tests/server-test.c libsoup2.4-2.61.90/tests/server-test.c --- libsoup2.4-2.60.3/tests/server-test.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/tests/server-test.c 2018-01-09 14:16:29.000000000 +0000 @@ -365,7 +365,7 @@ g_assert_cmpint (g_inet_socket_address_get_port (iaddr), ==, uri->port); - // FIXME ssl + /* FIXME ssl */ soup_message_set_response (msg, "text/plain", SOUP_MEMORY_TAKE, uristr, strlen (uristr)); diff -Nru libsoup2.4-2.60.3/tests/ssl-test.c libsoup2.4-2.61.90/tests/ssl-test.c --- libsoup2.4-2.60.3/tests/ssl-test.c 2018-01-09 09:48:08.000000000 +0000 +++ libsoup2.4-2.61.90/tests/ssl-test.c 2018-01-09 14:16:29.000000000 +0000 @@ -431,7 +431,7 @@ int main (int argc, char **argv) { - SoupServer *server; + SoupServer *server = NULL; int i, ret; GError *error = NULL; diff -Nru libsoup2.4-2.60.3/win32/vs10/soup-version-paths.props libsoup2.4-2.61.90/win32/vs10/soup-version-paths.props --- libsoup2.4-2.60.3/win32/vs10/soup-version-paths.props 2018-01-09 11:05:50.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs10/soup-version-paths.props 2018-02-05 15:55:59.000000000 +0000 @@ -7,8 +7,8 @@ ..\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) 2 - 60 - 3 + 61 + 90 2.4 lib -$(ApiVersion)-0 diff -Nru libsoup2.4-2.60.3/win32/vs11/soup-version-paths.props libsoup2.4-2.61.90/win32/vs11/soup-version-paths.props --- libsoup2.4-2.60.3/win32/vs11/soup-version-paths.props 2018-01-09 11:05:54.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs11/soup-version-paths.props 2018-02-05 15:56:22.000000000 +0000 @@ -7,8 +7,8 @@ ..\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) 2 - 60 - 3 + 61 + 90 2.4 lib -$(ApiVersion)-0 diff -Nru libsoup2.4-2.60.3/win32/vs12/soup-version-paths.props libsoup2.4-2.61.90/win32/vs12/soup-version-paths.props --- libsoup2.4-2.60.3/win32/vs12/soup-version-paths.props 2018-01-09 11:05:54.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs12/soup-version-paths.props 2018-02-05 15:56:22.000000000 +0000 @@ -7,8 +7,8 @@ ..\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) 2 - 60 - 3 + 61 + 90 2.4 lib -$(ApiVersion)-0 diff -Nru libsoup2.4-2.60.3/win32/vs14/soup-version-paths.props libsoup2.4-2.61.90/win32/vs14/soup-version-paths.props --- libsoup2.4-2.60.3/win32/vs14/soup-version-paths.props 2018-01-09 11:05:54.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs14/soup-version-paths.props 2018-02-05 15:56:22.000000000 +0000 @@ -7,8 +7,8 @@ ..\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) 2 - 60 - 3 + 61 + 90 2.4 lib -$(ApiVersion)-0 diff -Nru libsoup2.4-2.60.3/win32/vs15/soup-version-paths.props libsoup2.4-2.61.90/win32/vs15/soup-version-paths.props --- libsoup2.4-2.60.3/win32/vs15/soup-version-paths.props 2018-01-09 11:05:54.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs15/soup-version-paths.props 2018-02-05 15:56:22.000000000 +0000 @@ -7,8 +7,8 @@ ..\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) 2 - 60 - 3 + 61 + 90 2.4 lib -$(ApiVersion)-0 diff -Nru libsoup2.4-2.60.3/win32/vs9/soup-version-paths.vsprops libsoup2.4-2.61.90/win32/vs9/soup-version-paths.vsprops --- libsoup2.4-2.60.3/win32/vs9/soup-version-paths.vsprops 2018-01-09 11:05:50.000000000 +0000 +++ libsoup2.4-2.61.90/win32/vs9/soup-version-paths.vsprops 2018-02-05 15:55:59.000000000 +0000 @@ -22,11 +22,11 @@ />