commit libsoup for openSUSE:Factory
Hello community, here is the log from the commit of package libsoup for openSUSE:Factory checked in at 2013-08-30 16:33:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libsoup (Old) and /work/SRC/openSUSE:Factory/.libsoup.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libsoup" Changes: -------- --- /work/SRC/openSUSE:Factory/libsoup/libsoup.changes 2013-08-16 12:33:15.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libsoup.new/libsoup.changes 2013-08-30 16:33:21.000000000 +0200 @@ -1,0 +2,9 @@ +Mon Aug 19 21:13:32 UTC 2013 - dimstar@opensuse.org + +- Update to version 2.43.90: + + Fixed the handling of unsatisfiable range requests in + SoupServer. + + Fixed the handling of IPv6 address literals with scope IDs + (bgo#669724). + +------------------------------------------------------------------- Old: ---- libsoup-2.43.5.tar.xz New: ---- libsoup-2.43.90.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libsoup.spec ++++++ --- /var/tmp/diff_new_pack.RjjNoB/_old 2013-08-30 16:33:22.000000000 +0200 +++ /var/tmp/diff_new_pack.RjjNoB/_new 2013-08-30 16:33:22.000000000 +0200 @@ -20,7 +20,7 @@ Summary: HTTP client/server library for GNOME License: LGPL-2.1+ Group: Development/Libraries/GNOME -Version: 2.43.5 +Version: 2.43.90 Release: 0 Url: http://www.gnome.org Source: http://download.gnome.org/sources/libsoup/2.43/%{name}-%{version}.tar.xz ++++++ libsoup-2.43.5.tar.xz -> libsoup-2.43.90.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/NEWS new/libsoup-2.43.90/NEWS --- old/libsoup-2.43.5/NEWS 2013-07-29 23:34:56.000000000 +0200 +++ new/libsoup-2.43.90/NEWS 2013-08-19 21:45:18.000000000 +0200 @@ -1,3 +1,14 @@ +Changes in libsoup from 2.43.5 to 2.43.90: + + * Fixed the handling of unsatisfiable range requests in + SoupServer [pointed out on mailing list, Dan]. Also, added + more documentation clarifying that you don't need to handle + range requests yourself in many cases. + + * Fixed the handling of IPv6 address literals with scope IDs. + (Requires the latest glib as well for the complete fix.) + [#669724, Dan] + Changes in libsoup from 2.43.4 to 2.43.5: * SoupProxyURIResolver is now deprecated in favor of the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/configure new/libsoup-2.43.90/configure --- old/libsoup-2.43.5/configure 2013-07-29 23:37:46.000000000 +0200 +++ new/libsoup-2.43.90/configure 2013-08-19 21:45:36.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libsoup 2.43.5. +# Generated by GNU Autoconf 2.69 for libsoup 2.43.90. # # Report bugs to http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup. # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='libsoup' PACKAGE_TARNAME='libsoup' -PACKAGE_VERSION='2.43.5' -PACKAGE_STRING='libsoup 2.43.5' +PACKAGE_VERSION='2.43.90' +PACKAGE_STRING='libsoup 2.43.90' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup' PACKAGE_URL='' @@ -1443,7 +1443,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.43.5 to adapt to many kinds of systems. +\`configure' configures libsoup 2.43.90 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1513,7 +1513,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libsoup 2.43.5:";; + short | recursive ) echo "Configuration of libsoup 2.43.90:";; esac cat <<\_ACEOF @@ -1650,7 +1650,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libsoup configure 2.43.5 +libsoup configure 2.43.90 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1928,7 +1928,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.43.5, which was +It was created by libsoup $as_me 2.43.90, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2794,7 +2794,7 @@ # Define the identity of the package. PACKAGE='libsoup' - VERSION='2.43.5' + VERSION='2.43.90' cat >>confdefs.h <<_ACEOF @@ -2919,7 +2919,7 @@ SOUP_MAJOR_VERSION=2 SOUP_MINOR_VERSION=43 -SOUP_MICRO_VERSION=5 +SOUP_MICRO_VERSION=90 @@ -14423,7 +14423,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.43.5, which was +This file was extended by libsoup $as_me 2.43.90, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14489,7 +14489,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.43.5 +libsoup config.status 2.43.90 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/configure.ac new/libsoup-2.43.90/configure.ac --- old/libsoup-2.43.5/configure.ac 2013-07-29 23:21:58.000000000 +0200 +++ new/libsoup-2.43.90/configure.ac 2013-08-19 21:37:03.000000000 +0200 @@ -4,7 +4,7 @@ m4_define([soup_major_version], [2]) m4_define([soup_minor_version], [43]) -m4_define([soup_micro_version], [5]) +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]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/docs/reference/html/SoupMessageHeaders.html new/libsoup-2.43.90/docs/reference/html/SoupMessageHeaders.html --- old/libsoup-2.43.5/docs/reference/html/SoupMessageHeaders.html 2013-07-29 23:38:34.000000000 +0200 +++ new/libsoup-2.43.90/docs/reference/html/SoupMessageHeaders.html 2013-08-19 22:05:17.000000000 +0200 @@ -1198,6 +1198,33 @@ as described under <a class="link" href="SoupMessageHeaders.html#SoupRange" title="SoupRange"><span class="type">SoupRange</span></a>, and some of the ranges may be redundant. </p> +<p> +Beware that even if given a <em class="parameter"><code>total_length</code></em>, this function does not +check that the ranges are satisfiable. +</p> +<p> +</p> +<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> +<h3 class="title">Note</h3> +<p> +<a class="link" href="SoupServer.html" title="SoupServer"><span class="type">SoupServer</span></a> has built-in handling for range requests. If your +server handler returns a <a class="link" href="libsoup-2.4-soup-status.html#SOUP-STATUS-OK:CAPS"><code class="literal">SOUP_STATUS_OK</code></a> response containing the +complete response body (rather than pausing the message and +returning some of the response body later), and there is a Range +header in the request, then libsoup will automatically convert the +response to a <a class="link" href="libsoup-2.4-soup-status.html#SOUP-STATUS-PARTIAL-CONTENT:CAPS"><code class="literal">SOUP_STATUS_PARTIAL_CONTENT</code></a> response containing only +the range(s) requested by the client. +</p> +<p> +The only time you need to process the Range header yourself is if +either you need to stream the response body rather than returning +it all at once, or you do not already have the complete response +body available, and only want to generate the parts that were +actually requested by the client. +</p> +</div> +<p> +</p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> @@ -1225,9 +1252,9 @@ <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> -<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>hdrs</code></em> contained a "Range" header containing -byte ranges which could be parsed, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise (in which case -<em class="parameter"><code>range</code></em> and <em class="parameter"><code>length</code></em> will not be set).</td> +<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>hdrs</code></em> contained a syntactically-valid +"Range" header, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise (in which case <em class="parameter"><code>range</code></em> and <em class="parameter"><code>length</code></em> +will not be set).</td> </tr> </tbody> </table></div> @@ -1394,6 +1421,18 @@ (Note that <em class="parameter"><code>total_length</code></em> is the total length of the entire resource that this is a range of, not simply <em class="parameter"><code>end</code></em> - <em class="parameter"><code>start</code></em> + 1.) </p> +<p> +</p> +<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> +<h3 class="title">Note</h3> +<p> +<a class="link" href="SoupServer.html" title="SoupServer"><span class="type">SoupServer</span></a> has built-in handling for range requests, and you do +not normally need to call this function youself. See +<code class="function">soup_message_headers_get_range()</code> for more details. +</p> +</div> +<p> +</p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/docs/reference/html/SoupProxyResolverDefault.html new/libsoup-2.43.90/docs/reference/html/SoupProxyResolverDefault.html --- old/libsoup-2.43.5/docs/reference/html/SoupProxyResolverDefault.html 2013-07-29 23:38:34.000000000 +0200 +++ new/libsoup-2.43.90/docs/reference/html/SoupProxyResolverDefault.html 2013-08-19 22:05:17.000000000 +0200 @@ -60,7 +60,7 @@ <a name="SoupProxyResolverDefault.implemented-interfaces"></a><h2>Implemented Interfaces</h2> <p> SoupProxyResolverDefault implements - <a class="link" href="SoupSessionFeature.html" title="SoupSessionFeature">SoupSessionFeature</a> and <a href="/opt/jhbuild/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html">SoupProxyURIResolver</a>.</p> + <a class="link" href="SoupSessionFeature.html" title="SoupSessionFeature">SoupSessionFeature</a> and <a href="/usr/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html">SoupProxyURIResolver</a>.</p> </div> <div class="refsect1"> <a name="SoupProxyResolverDefault.properties"></a><h2>Properties</h2> @@ -71,7 +71,7 @@ <div class="refsect1"> <a name="SoupProxyResolverDefault.description"></a><h2>Description</h2> <p> -<a class="link" href="SoupProxyResolverDefault.html" title="SoupProxyResolverDefault"><span class="type">SoupProxyResolverDefault</span></a> is a <a href="/opt/jhbuild/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> implementation +<a class="link" href="SoupProxyResolverDefault.html" title="SoupProxyResolverDefault"><span class="type">SoupProxyResolverDefault</span></a> is a <a href="/usr/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> implementation that uses the default gio GProxyResolver to resolve proxies. </p> </div> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/docs/reference/html/SoupSession.html new/libsoup-2.43.90/docs/reference/html/SoupSession.html --- old/libsoup-2.43.5/docs/reference/html/SoupSession.html 2013-07-29 23:38:34.000000000 +0200 +++ new/libsoup-2.43.90/docs/reference/html/SoupSession.html 2013-08-19 22:05:17.000000000 +0200 @@ -1879,7 +1879,7 @@ <p> A <a href="http://library.gnome.org/devel/gio/unstable/GProxyResolver.html"><span class="type">GProxyResolver</span></a> to use with this session. Setting this will clear the <a class="link" href="SoupSession.html#SoupSession--proxy-uri" title='The "proxy-uri" property'><span class="type">"proxy-uri"</span></a> property, and remove -any <a href="/opt/jhbuild/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> features that have been added to +any <a href="/usr/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> features that have been added to the session. </p> <p> @@ -1899,7 +1899,7 @@ A proxy to use for all http and https requests in this session. Setting this will clear the <a class="link" href="SoupSession.html#SoupSession--proxy-resolver" title='The "proxy-resolver" property'><span class="type">"proxy-resolver"</span></a> property, and remove any -<a href="/opt/jhbuild/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> features that have been added to the +<a href="/usr/share/gtk-doc/html/libsoup-2.4/SoupProxyURIResolver.html"><span class="type">SoupProxyURIResolver</span></a> features that have been added to the session. Setting this property will also cancel all currently pending messages. </p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/examples/get.c new/libsoup-2.43.90/examples/get.c --- old/libsoup-2.43.5/examples/get.c 2013-07-13 17:21:08.000000000 +0200 +++ new/libsoup-2.43.90/examples/get.c 2013-08-18 17:23:04.000000000 +0200 @@ -35,9 +35,8 @@ g_object_ref (msg); soup_session_queue_message (session, msg, finished, loop); g_main_loop_run (loop); - } - - soup_session_send_message (session, msg); + } else + soup_session_send_message (session, msg); name = soup_message_get_uri (msg)->path; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-address.c new/libsoup-2.43.90/libsoup/soup-address.c --- old/libsoup-2.43.5/libsoup/soup-address.c 2013-07-13 15:59:26.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-address.c 2013-08-19 19:38:39.000000000 +0200 @@ -52,7 +52,6 @@ const char *protocol; GMutex lock; - GSList *async_lookups; } SoupAddressPrivate; #define SOUP_ADDRESS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_ADDRESS, SoupAddressPrivate)) @@ -561,6 +560,59 @@ } +/* Tries to resolve priv->name as an IP address, possibly including an + * IPv6 scope id. + */ +static void +maybe_resolve_ip (SoupAddress *addr) +{ + SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); + const char *pct, *ip; + char *tmp = NULL; + GSocketConnectable *gaddr; + GSocketAddressEnumerator *sa_enum; + GSocketAddress *saddr; + + if (priv->sockaddr || !priv->name) + return; + + pct = strchr (priv->name, '%'); + if (pct) + ip = tmp = g_strndup (priv->name, pct - priv->name); + else + ip = priv->name; + + if (!g_hostname_is_ip_address (ip)) { + g_free (tmp); + return; + } + g_free (tmp); + + gaddr = g_network_address_new (priv->name, priv->port); + if (!gaddr) + return; + + sa_enum = g_socket_connectable_enumerate (gaddr); + saddr = g_socket_address_enumerator_next (sa_enum, NULL, NULL); + if (saddr) { + priv->n_addrs = 1; + priv->sockaddr = g_new (struct sockaddr_storage, 1); + if (!g_socket_address_to_native (saddr, priv->sockaddr, + sizeof (struct sockaddr_storage), + NULL)) { + /* can't happen: We know the address format is supported + * and the buffer is large enough + */ + g_warn_if_reached (); + } + g_object_unref (saddr); + } + + g_object_unref (sa_enum); + g_object_unref (gaddr); +} + + static guint update_addrs (SoupAddress *addr, GList *addrs, GError *error) { @@ -621,55 +673,47 @@ } typedef struct { + SoupAddress *addr; SoupAddressCallback callback; gpointer callback_data; } SoupAddressResolveAsyncData; static void -complete_resolve_async (SoupAddress *addr, guint status) +complete_resolve_async (SoupAddressResolveAsyncData *res_data, guint status) { - SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); - SoupAddressResolveAsyncData *res_data; - GSList *lookups, *l; GSource *current_source; GMainContext *current_context; - lookups = priv->async_lookups; - priv->async_lookups = NULL; - - /* Awful hack; to make soup_socket_connect_async() with an - * non-default async_context work correctly, we need to ensure - * that the non-default context (which we're now running in) - * is the thread-default when the callbacks are run... - */ - current_source = g_main_current_source (); - if (current_source && !g_source_is_destroyed (current_source)) - current_context = g_source_get_context (current_source); - else - current_context = NULL; - g_main_context_push_thread_default (current_context); + if (res_data->callback) { + /* Awful hack; to make soup_socket_connect_async() + * with an non-default async_context work correctly, + * we need to ensure that the non-default context + * (which we're now running in) is the thread-default + * when the callbacks are run... + */ + current_source = g_main_current_source (); + if (current_source && !g_source_is_destroyed (current_source)) + current_context = g_source_get_context (current_source); + else + current_context = NULL; + g_main_context_push_thread_default (current_context); - for (l = lookups; l; l = l->next) { - res_data = l->data; + res_data->callback (res_data->addr, status, + res_data->callback_data); - if (res_data->callback) { - res_data->callback (addr, status, - res_data->callback_data); - } - g_slice_free (SoupAddressResolveAsyncData, res_data); + g_main_context_pop_thread_default (current_context); } - g_slist_free (lookups); - - g_main_context_pop_thread_default (current_context); - g_object_unref (addr); + g_object_unref (res_data->addr); + g_slice_free (SoupAddressResolveAsyncData, res_data); } static void lookup_resolved (GObject *source, GAsyncResult *result, gpointer user_data) { GResolver *resolver = G_RESOLVER (source); - SoupAddress *addr = user_data; + SoupAddressResolveAsyncData *res_data = user_data; + SoupAddress *addr = res_data->addr; SoupAddressPrivate *priv = SOUP_ADDRESS_GET_PRIVATE (addr); GError *error = NULL; guint status; @@ -695,7 +739,7 @@ g_object_ref (addr); g_object_set_data (G_OBJECT (addr), "async-resolved-error", error); - complete_resolve_async (addr, status); + complete_resolve_async (res_data, status); g_object_set_data (G_OBJECT (addr), "async-resolved-error", NULL); g_object_unref (addr); @@ -704,9 +748,9 @@ } static gboolean -idle_complete_resolve (gpointer addr) +idle_complete_resolve (gpointer res_data) { - complete_resolve_async (addr, SOUP_STATUS_OK); + complete_resolve_async (res_data, SOUP_STATUS_OK); return FALSE; } @@ -752,7 +796,6 @@ SoupAddressPrivate *priv; SoupAddressResolveAsyncData *res_data; GResolver *resolver; - gboolean already_started; g_return_if_fail (SOUP_IS_ADDRESS (addr)); priv = SOUP_ADDRESS_GET_PRIVATE (addr); @@ -762,47 +805,43 @@ * not intended to be thread-safe. */ + if (priv->name && !priv->sockaddr) + maybe_resolve_ip (addr); if (priv->name && priv->sockaddr && !callback) return; res_data = g_slice_new0 (SoupAddressResolveAsyncData); + res_data->addr = g_object_ref (addr); res_data->callback = callback; res_data->callback_data = user_data; - already_started = priv->async_lookups != NULL; - priv->async_lookups = g_slist_prepend (priv->async_lookups, res_data); - - if (already_started) - return; - - g_object_ref (addr); - - if (priv->name && priv->sockaddr) { - soup_add_completion (async_context, idle_complete_resolve, addr); - return; - } - - resolver = g_resolver_get_default (); if (async_context) g_main_context_push_thread_default (async_context); - if (priv->name) { - g_resolver_lookup_by_name_async (resolver, priv->name, - cancellable, - lookup_resolved, addr); - } else { - GInetAddress *gia; + if (priv->name && priv->sockaddr) + soup_add_completion (async_context, idle_complete_resolve, res_data); + else { + resolver = g_resolver_get_default (); - gia = soup_address_make_inet_address (addr); - g_resolver_lookup_by_address_async (resolver, gia, - cancellable, - lookup_resolved, addr); - g_object_unref (gia); + if (priv->name) { + g_resolver_lookup_by_name_async (resolver, priv->name, + cancellable, + lookup_resolved, res_data); + } else { + GInetAddress *gia; + + gia = soup_address_make_inet_address (addr); + g_resolver_lookup_by_address_async (resolver, gia, + cancellable, + lookup_resolved, res_data); + g_object_unref (gia); + } + + g_object_unref (resolver); } if (async_context) g_main_context_pop_thread_default (async_context); - g_object_unref (resolver); } static guint @@ -822,6 +861,10 @@ * blocking op, and then re-lock it to modify @addr. */ g_mutex_lock (&priv->lock); + + if (priv->name && !priv->sockaddr) + maybe_resolve_ip (addr); + if (!priv->sockaddr) { GList *addrs; @@ -847,6 +890,7 @@ g_free (name); } else status = SOUP_STATUS_OK; + g_mutex_unlock (&priv->lock); if (my_err) @@ -1145,8 +1189,9 @@ task = g_task_new (enumerator, cancellable, callback, user_data); if (!priv->sockaddr) { - soup_address_resolve_async (addr_enum->addr, NULL, cancellable, - got_addresses, task); + soup_address_resolve_async (addr_enum->addr, + g_main_context_get_thread_default (), + cancellable, got_addresses, task); } else { g_task_return_pointer (task, next_address (addr_enum), g_object_unref); g_object_unref (task); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-message-client-io.c new/libsoup-2.43.90/libsoup/soup-message-client-io.c --- old/libsoup-2.43.5/libsoup/soup-message-client-io.c 2013-06-01 19:28:15.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-message-client-io.c 2013-08-19 21:42:54.000000000 +0200 @@ -83,7 +83,7 @@ const char *name, *value; if (strchr (uri->host, ':')) - uri_host = g_strdup_printf ("[%s]", uri->host); + uri_host = g_strdup_printf ("[%.*s]", (int) strcspn (uri->host, "%"), uri->host); else if (g_hostname_is_non_ascii (uri->host)) uri_host = g_hostname_to_ascii (uri->host); else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-message-headers.c new/libsoup-2.43.90/libsoup/soup-message-headers.c --- old/libsoup-2.43.5/libsoup/soup-message-headers.c 2013-07-13 17:14:09.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-message-headers.c 2013-08-19 16:55:06.000000000 +0200 @@ -9,6 +9,7 @@ #include "soup-message-headers.h" #include "soup.h" +#include "soup-misc-private.h" /** * SECTION:soup-message-headers @@ -858,56 +859,40 @@ return ra->start - rb->start; } -/** - * soup_message_headers_get_ranges: - * @hdrs: a #SoupMessageHeaders - * @total_length: the total_length of the response body - * @ranges: (out): return location for an array of #SoupRange - * @length: the length of the returned array - * - * Parses @hdrs's Range header and returns an array of the requested - * byte ranges. The returned array must be freed with - * soup_message_headers_free_ranges(). - * - * If @total_length is non-0, its value will be used to adjust the - * returned ranges to have explicit start and end values, and the - * returned ranges will be sorted and non-overlapping. If - * @total_length is 0, then some ranges may have an end value of -1, - * as described under #SoupRange, and some of the ranges may be - * redundant. - * - * Return value: %TRUE if @hdrs contained a "Range" header containing - * byte ranges which could be parsed, %FALSE otherwise (in which case - * @range and @length will not be set). - * - * Since: 2.26 - **/ -gboolean -soup_message_headers_get_ranges (SoupMessageHeaders *hdrs, - goffset total_length, - SoupRange **ranges, - int *length) +/* like soup_message_headers_get_ranges(), except it returns: + * SOUP_STATUS_OK if there is no Range or it should be ignored. + * SOUP_STATUS_PARTIAL_CONTENT if there is at least one satisfiable range. + * SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE if @check_satisfiable + * is %TRUE and the request is not satisfiable given @total_length. + */ +guint +soup_message_headers_get_ranges_internal (SoupMessageHeaders *hdrs, + goffset total_length, + gboolean check_satisfiable, + SoupRange **ranges, + int *length) { const char *range = soup_message_headers_get_one (hdrs, "Range"); GSList *range_list, *r; GArray *array; char *spec, *end; int i; + guint status = SOUP_STATUS_OK; if (!range || strncmp (range, "bytes", 5) != 0) - return FALSE; + return status; range += 5; while (g_ascii_isspace (*range)) range++; if (*range++ != '=') - return FALSE; + return status; while (g_ascii_isspace (*range)) range++; range_list = soup_header_parse_list (range); if (!range_list) - return FALSE; + return status; array = g_array_new (FALSE, FALSE, sizeof (SoupRange)); for (r = range_list; r; r = r->next) { @@ -921,22 +906,34 @@ cur.start = g_ascii_strtoull (spec, &end, 10); if (*end == '-') end++; - if (*end) + if (*end) { cur.end = g_ascii_strtoull (end, &end, 10); - else + if (cur.end < cur.start) { + status = SOUP_STATUS_OK; + break; + } + } else cur.end = total_length - 1; } if (*end) { - g_array_free (array, TRUE); - soup_header_free_list (range_list); - return FALSE; + status = SOUP_STATUS_OK; + break; + } else if (check_satisfiable && cur.start >= total_length) { + if (status == SOUP_STATUS_OK) + status = SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE; + continue; } g_array_append_val (array, cur); + status = SOUP_STATUS_PARTIAL_CONTENT; } - soup_header_free_list (range_list); + if (status != SOUP_STATUS_PARTIAL_CONTENT) { + g_array_free (array, TRUE); + return status; + } + if (total_length) { g_array_sort (array, sort_ranges); for (i = 1; i < array->len; i++) { @@ -954,7 +951,62 @@ *length = array->len; g_array_free (array, FALSE); - return TRUE; + return SOUP_STATUS_PARTIAL_CONTENT; +} + +/** + * soup_message_headers_get_ranges: + * @hdrs: a #SoupMessageHeaders + * @total_length: the total_length of the response body + * @ranges: (out): return location for an array of #SoupRange + * @length: the length of the returned array + * + * Parses @hdrs's Range header and returns an array of the requested + * byte ranges. The returned array must be freed with + * soup_message_headers_free_ranges(). + * + * If @total_length is non-0, its value will be used to adjust the + * returned ranges to have explicit start and end values, and the + * returned ranges will be sorted and non-overlapping. If + * @total_length is 0, then some ranges may have an end value of -1, + * as described under #SoupRange, and some of the ranges may be + * redundant. + * + * Beware that even if given a @total_length, this function does not + * check that the ranges are satisfiable. + * + * <note><para> + * #SoupServer has built-in handling for range requests. If your + * server handler returns a %SOUP_STATUS_OK response containing the + * complete response body (rather than pausing the message and + * returning some of the response body later), and there is a Range + * header in the request, then libsoup will automatically convert the + * response to a %SOUP_STATUS_PARTIAL_CONTENT response containing only + * the range(s) requested by the client. + * + * The only time you need to process the Range header yourself is if + * either you need to stream the response body rather than returning + * it all at once, or you do not already have the complete response + * body available, and only want to generate the parts that were + * actually requested by the client. + * </para></note> + * + * Return value: %TRUE if @hdrs contained a syntactically-valid + * "Range" header, %FALSE otherwise (in which case @range and @length + * will not be set). + * + * Since: 2.26 + **/ +gboolean +soup_message_headers_get_ranges (SoupMessageHeaders *hdrs, + goffset total_length, + SoupRange **ranges, + int *length) +{ + guint status; + + status = soup_message_headers_get_ranges_internal (hdrs, total_length, FALSE, ranges, length); + return status == SOUP_STATUS_PARTIAL_CONTENT; } /** @@ -1104,6 +1156,12 @@ * (Note that @total_length is the total length of the entire resource * that this is a range of, not simply @end - @start + 1.) * + * <note><para> + * #SoupServer has built-in handling for range requests, and you do + * not normally need to call this function youself. See + * soup_message_headers_get_range() for more details. + * </para></note> + * * Since: 2.26 **/ void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-message-server-io.c new/libsoup-2.43.90/libsoup/soup-message-server-io.c --- old/libsoup-2.43.5/libsoup/soup-message-server-io.c 2013-06-24 19:51:14.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-message-server-io.c 2013-08-05 01:09:44.000000000 +0200 @@ -119,6 +119,7 @@ SoupRange *ranges; int nranges; SoupBuffer *full_response; + guint status; /* Make sure the message is set up right for us to return a * partial response; it has to be a GET, the status must be @@ -137,9 +138,15 @@ /* Oh, and there has to have been a valid Range header on the * request, of course. */ - if (!soup_message_headers_get_ranges (msg->request_headers, - msg->response_body->length, - &ranges, &nranges)) + status = soup_message_headers_get_ranges_internal (msg->request_headers, + msg->response_body->length, + TRUE, + &ranges, &nranges); + if (status == SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE) { + soup_message_set_status (msg, status); + soup_message_body_truncate (msg->response_body); + return; + } else if (status != SOUP_STATUS_PARTIAL_CONTENT) return; full_response = soup_message_body_flatten (msg->response_body); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-misc-private.h new/libsoup-2.43.90/libsoup/soup-misc-private.h --- old/libsoup-2.43.5/libsoup/soup-misc-private.h 2013-07-13 17:19:07.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-misc-private.h 2013-08-05 01:09:44.000000000 +0200 @@ -8,6 +8,7 @@ #define SOUP_MISC_PRIVATE_H 1 #include "soup-socket.h" +#include "soup-message-headers.h" char *uri_decoded_copy (const char *str, int length, int *decoded_length); char *soup_uri_to_string_internal (SoupURI *uri, gboolean just_path_and_query, @@ -47,4 +48,10 @@ GSourceFunc function, gpointer data); +guint soup_message_headers_get_ranges_internal (SoupMessageHeaders *hdrs, + goffset total_length, + gboolean check_satisfiable, + SoupRange **ranges, + int *length); + #endif /* SOUP_MISC_PRIVATE_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/libsoup/soup-uri.c new/libsoup-2.43.90/libsoup/soup-uri.c --- old/libsoup-2.43.5/libsoup/soup-uri.c 2013-07-13 17:56:23.000000000 +0200 +++ new/libsoup-2.43.90/libsoup/soup-uri.c 2013-08-19 22:02:03.000000000 +0200 @@ -308,6 +308,8 @@ /* Find host and port. */ if (*uri_string == '[') { + const char *pct; + uri_string++; hostend = strchr (uri_string, ']'); if (!hostend || hostend > path) { @@ -318,13 +320,18 @@ colon = hostend + 1; else colon = NULL; + + pct = memchr (uri_string, '%', hostend - uri_string); + if (!pct || (pct[1] == '2' && pct[2] == '5')) + uri->host = uri_decoded_copy (uri_string, hostend - uri_string, NULL); + else + uri->host = g_strndup (uri_string, hostend - uri_string); } else { colon = memchr (uri_string, ':', path - uri_string); hostend = colon ? colon : path; + uri->host = uri_decoded_copy (uri_string, hostend - uri_string, NULL); } - uri->host = uri_decoded_copy (uri_string, hostend - uri_string, NULL); - if (colon && colon != path - 1) { char *portend; uri->port = strtoul (colon + 1, &portend, 10); @@ -513,8 +520,16 @@ g_string_append_c (str, '@'); } if (strchr (uri->host, ':')) { + const char *pct; + g_string_append_c (str, '['); - g_string_append (str, uri->host); + pct = strchr (uri->host, '%'); + if (pct) { + g_string_append_printf (str, "%.*s%%25%s", + (int) (pct - uri->host), + uri->host, pct + 1); + } else + g_string_append (str, uri->host); g_string_append_c (str, ']'); } else append_uri_encoded (str, uri->host, ":/"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/tests/range-test.c new/libsoup-2.43.90/tests/range-test.c --- old/libsoup-2.43.5/tests/range-test.c 2013-06-24 19:51:14.000000000 +0200 +++ new/libsoup-2.43.90/tests/range-test.c 2013-08-05 01:09:44.000000000 +0200 @@ -78,7 +78,7 @@ static void do_single_range (SoupSession *session, SoupMessage *msg, - int start, int end) + int start, int end, gboolean succeed) { const char *content_type; @@ -87,11 +87,31 @@ soup_session_send_message (session, msg); - if (msg->status_code != SOUP_STATUS_PARTIAL_CONTENT) { - debug_printf (1, " Unexpected status %d %s\n", - msg->status_code, msg->reason_phrase); + if (succeed) { + if (msg->status_code != SOUP_STATUS_PARTIAL_CONTENT) { + debug_printf (1, " Unexpected status %d %s\n", + msg->status_code, msg->reason_phrase); + g_object_unref (msg); + errors++; + return; + } + } else { + if (msg->status_code == SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE) { + debug_printf (1, " Got expected %d %s\n", + msg->status_code, msg->reason_phrase); + } else { + const char *content_range; + + debug_printf (1, " Unexpected status %d %s\n", + msg->status_code, msg->reason_phrase); + content_range = soup_message_headers_get_one (msg->response_headers, + "Content-Range"); + if (content_range) + debug_printf (1, " Content-Range: %s\n", content_range); + errors++; + } + g_object_unref (msg); - errors++; return; } @@ -111,13 +131,13 @@ static void request_single_range (SoupSession *session, const char *uri, - int start, int end) + int start, int end, gboolean succeed) { SoupMessage *msg; msg = soup_message_new ("GET", uri); soup_message_headers_set_range (msg->request_headers, start, end); - do_single_range (session, msg, start, end); + do_single_range (session, msg, start, end, succeed); } static void @@ -198,7 +218,8 @@ if (expected_return_ranges == 1) { do_single_range (session, msg, MIN (first_start, second_start), - MAX (first_end, second_end)); + MAX (first_end, second_end), + TRUE); } else do_multi_range (session, msg, expected_return_ranges); } @@ -225,12 +246,34 @@ if (expected_return_ranges == 1) { do_single_range (session, msg, MIN (first_start, MIN (second_start, third_start)), - MAX (first_end, MAX (second_end, third_end))); + MAX (first_end, MAX (second_end, third_end)), + TRUE); } else do_multi_range (session, msg, expected_return_ranges); } static void +request_semi_invalid_range (SoupSession *session, const char *uri, + int first_good_start, int first_good_end, + int bad_start, int bad_end, + int second_good_start, int second_good_end) +{ + SoupMessage *msg; + SoupRange ranges[3]; + + msg = soup_message_new ("GET", uri); + ranges[0].start = first_good_start; + ranges[0].end = first_good_end; + ranges[1].start = bad_start; + ranges[1].end = bad_end; + ranges[2].start = second_good_start; + ranges[2].end = second_good_end; + soup_message_headers_set_ranges (msg->request_headers, ranges, 3); + + do_multi_range (session, msg, 2); +} + +static void do_range_test (SoupSession *session, const char *uri, gboolean expect_coalesce, gboolean expect_partial_coalesce) { @@ -258,7 +301,8 @@ /* A: 0, simple request */ debug_printf (1, "Requesting %d-%d\n", 0 * twelfths, 1 * twelfths); request_single_range (session, uri, - 0 * twelfths, 1 * twelfths); + 0 * twelfths, 1 * twelfths, + TRUE); /* B: 11, end-relative request. These two are mostly redundant * in terms of data coverage, but they may still catch @@ -266,10 +310,12 @@ */ debug_printf (1, "Requesting %d-\n", 11 * twelfths); request_single_range (session, uri, - 11 * twelfths, -1); + 11 * twelfths, -1, + TRUE); debug_printf (1, "Requesting -%d\n", 1 * twelfths); request_single_range (session, uri, - -1 * twelfths, -1); + -1 * twelfths, -1, + TRUE); /* C: 2 and 5 */ debug_printf (1, "Requesting %d-%d,%d-%d\n", @@ -318,6 +364,21 @@ debug_printf (1, "\nfull_response and test_response don't match\n"); errors++; } + + debug_printf (1, "Requesting (invalid) %d-%d\n", + (int) full_response->length + 1, + (int) full_response->length + 100); + request_single_range (session, uri, + full_response->length + 1, full_response->length + 100, + FALSE); + + debug_printf (1, "Requesting (semi-invalid) 1-10,%d-%d,20-30\n", + (int) full_response->length + 1, + (int) full_response->length + 100); + request_semi_invalid_range (session, uri, + 1, 10, + full_response->length + 1, full_response->length + 100, + 20, 30); } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsoup-2.43.5/tests/uri-parsing.c new/libsoup-2.43.90/tests/uri-parsing.c --- old/libsoup-2.43.5/tests/uri-parsing.c 2013-07-13 17:57:56.000000000 +0200 +++ new/libsoup-2.43.90/tests/uri-parsing.c 2013-08-19 21:50:17.000000000 +0200 @@ -144,6 +144,14 @@ { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL } }, { "+http://host/path", NULL, { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL } }, + + /* IPv6 scope ID parsing (both correct and incorrect) */ + { "http://[fe80::dead:beef%em1]/", "http://[fe80::dead:beef%25em1]/", + { "http", NULL, NULL, "fe80::dead:beef%em1", 80, "/", NULL, NULL } }, + { "http://[fe80::dead:beef%25em1]/", "http://[fe80::dead:beef%25em1]/", + { "http", NULL, NULL, "fe80::dead:beef%em1", 80, "/", NULL, NULL } }, + { "http://[fe80::dead:beef%10]/", "http://[fe80::dead:beef%2510]/", + { "http", NULL, NULL, "fe80::dead:beef%10", 80, "/", NULL, NULL } } }; static int num_abs_tests = G_N_ELEMENTS(abs_tests); -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de