Projects
Mega:23.09
libsoup3
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:libsoup3.spec
Changed
@@ -1,12 +1,12 @@ %global glib2_version 2.69.1 Name: libsoup3 -Version: 3.2.2 +Version: 3.4.4 Release: 1 Summary: Soup, an HTTP library implementation License: LGPLv2 URL: https://wiki.gnome.org/Projects/libsoup -Source0: https://download.gnome.org/sources/libsoup/3.2/libsoup-%{version}.tar.xz +Source0: https://download.gnome.org/sources/libsoup/3.4/libsoup-%{version}.tar.xz BuildRequires: gcc meson gettext vala krb5-devel samba-winbind-clients BuildRequires: gi-docgen >= 2021.1 @@ -53,6 +53,7 @@ %install %meson_install +install -m 644 -D tests/libsoup.supp %{buildroot}%{_datadir}/libsoup-3.0/libsoup.supp %find_lang libsoup-3.0 @@ -68,12 +69,16 @@ %{_datadir}/gir-1.0/Soup*3.0.gir %{_datadir}/vala/vapi/libsoup-3.0.deps %{_datadir}/vala/vapi/libsoup-3.0.vapi +%{_datadir}/libsoup-3.0/libsoup.supp %files help %doc README NEWS AUTHORS %{_datadir}/doc %changelog +* Fri Nov 17 2023 lwg <liweiganga@uniontech.com> - 3.4.4-1 +- update to version 3.4.4 + * Mon Jan 2 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 3.2.2-1 - Update 3.2.2
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/libsoup3.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/.gitlab-ci.yml -> _service:tar_scm:libsoup-3.4.4.tar.xz/.gitlab-ci.yml
Changed
@@ -1,4 +1,4 @@ -image: registry.gitlab.gnome.org/gnome/libsoup/master:v17 +image: registry.gitlab.gnome.org/gnome/libsoup/master:v20 stages: - build @@ -20,10 +20,13 @@ - meson _build -Db_coverage=true --auto-features=enabled - meson compile -C _build - meson test --no-suite autobahn-quick --no-suite autobahn -C _build --verbose - - ninja -C _build coverage-html + - ninja -C _build coverage-html coverage-xml artifacts: reports: - junit: "_build/${CI_JOB_NAME}-report.xml" + junit: "_build/meson-logs/testlog.junit.xml" + coverage_report: + coverage_format: cobertura + path: "_build/meson-logs/coverage.xml" name: "libsoup-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" when: always paths: @@ -50,6 +53,8 @@ - ninja -C _build scan-build - bash -c 'if -n "$(ls -A _build/meson-logs/scanbuild/)" ; then echo "Scan build log found, assuming defects exist"; exit 1; fi' artifacts: + reports: + junit: "_build/meson-logs/testlog.junit.xml" when: on_failure paths: - _build/meson-logs/scanbuild @@ -66,6 +71,8 @@ - meson _build --auto-features=enabled -Db_sanitize=address -Dintrospection=disabled -Dvapi=disabled -Dntlm=disabled -Ddocs=disabled - meson test --no-suite autobahn-quick --no-suite autobahn -C _build --verbose --timeout-multiplier=10 artifacts: + reports: + junit: "_build/meson-logs/testlog.junit.xml" when: on_failure paths: - "_build/meson-logs/testlog.txt" @@ -98,7 +105,8 @@ - mv _build/docs/reference/libsoup-3.0/* _reference/libsoup-3.0 # Add libsoup-2.4 docs. - cp -R /usr/share/gtk-doc/html/{glib,gio,gobject,libsoup-2.4} _reference/ - - cp .gitlab-ci/index.html _reference/ + - gtkdoc-rebase --relative --html-dir=_reference/{glib,gio,gobject,libsoup-2.4} --verbose + - cp .gitlab-ci/{index.html,robots.txt} _reference/ artifacts: paths: - _reference
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/.gitlab-ci/Dockerfile -> _service:tar_scm:libsoup-3.4.4.tar.xz/.gitlab-ci/Dockerfile
Changed
@@ -1,12 +1,14 @@ -FROM fedora:34 +FROM fedora:36 +# NOTE: We set tsflags to empty so docs actually install... RUN dnf update -y \ - && dnf install -y \ - autoconf-archive \ + && dnf install --setopt=tsflags='' -y \ brotli-devel \ clang-analyzer \ 'dnf-command(builddep)' \ + gcovr \ git \ + gi-docgen \ glib2-doc \ gnutls-devel \ gobject-introspection-devel \ @@ -15,10 +17,10 @@ krb5-devel \ lcov \ libasan \ - libpsl-devel \ libnghttp2-devel \ + libpsl-devel \ + libsoup-doc \ lsof \ - make \ meson \ mod_ssl \ python2.7 \ @@ -29,47 +31,11 @@ vala \ valgrind \ which \ - && dnf builddep -y glib2 nghttp2 vala \ + && dnf builddep -y nghttp2 \ && dnf clean all \ && python2.7 -m ensurepip \ - && pip2.7 install virtualenv autobahntestsuite \ - && pip3 install gi-docgen - -# We need glib 2.70 -RUN git clone https://gitlab.gnome.org/GNOME/glib.git \ - && pushd glib \ - && git checkout 2.69.1 \ - && meson _build --prefix=/usr -Dgtk_doc=true \ - && ninja -C _build install \ - && popd \ - && rm -rf glib - -RUN git clone https://gitlab.gnome.org/GNOME/glib-networking.git \ - && pushd glib-networking \ - && git checkout f7b3250d3e3fce4ea02b00610d9f2148ade4a6ce \ - && meson _build --prefix=/usr \ - && ninja -C _build install \ - && popd \ - && rm -rf glib-networking - -# Fedora 34 has a really outdated vala -RUN git clone https://gitlab.gnome.org/GNOME/vala.git \ - && pushd vala \ - && git checkout 0.50.10 \ - && ./autogen.sh --prefix=/usr \ - && make install \ - && popd \ - && rm -rf vala - -# We install the docs for libsoup2 to host (idk why libsoup-docs package doesn't work) -RUN git clone https://gitlab.gnome.org/GNOME/libsoup.git \ - && pushd libsoup \ - && git checkout libsoup-2-74 \ - && meson _build --prefix=/usr -Dgtk_doc=true \ - && ninja -C _build libsoup-2.4-doc \ - && cp -R _build/docs/reference/html /usr/share/gtk-doc/html/libsoup-2.4 \ - && popd \ - && rm -rf libsoup + && pip2.7 install --upgrade pip \ + && pip2.7 install virtualenv wsaccel==0.6.3 autobahntestsuite # Update libnghttp2 for do_invalid_header_rfc9113_received_test() RUN git clone https://github.com/nghttp2/nghttp2.git \
View file
_service:tar_scm:libsoup-3.4.4.tar.xz/.gitlab-ci/robots.txt
Added
@@ -0,0 +1,5 @@ +# Disable crawling of GLib's documentation, so official documentation is preferred. +User-agent: * +Disallow: /glib/ +Disallow: /gio/ +Disallow: /gobject/
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/.gitlab-ci/run-docker.sh -> _service:tar_scm:libsoup-3.4.4.tar.xz/.gitlab-ci/run-docker.sh
Changed
@@ -2,7 +2,7 @@ set -e -TAG="registry.gitlab.gnome.org/gnome/libsoup/master:v17" +TAG="registry.gitlab.gnome.org/gnome/libsoup/master:v20" SUDO_CMD="sudo" if docker -v |& grep -q podman; then
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/NEWS -> _service:tar_scm:libsoup-3.4.4.tar.xz/NEWS
Changed
@@ -1,3 +1,58 @@ +Changes in libsoup from 3.4.3 to 3.4.4: + +* Improve HTTP/2 performance when a lot of buffering happens Keyu Tao +* Support building libnghttp2 as a subproject hrxi + +Changes in libsoup from 3.4.2 to 3.4.3: + +* Fix incorrect UTF-8 encoding for params in headers Leo Zi-You Assini +* Numerous HTTP/2 fixes and improvements Carlos Garcia Campos +* Fix possible crashes in connection management Michael Catanzaro +* Fix small leak in SoupServer Emil Ljungdahl +* Fix the possibility of empty HTTP/2 frames being sent Pawel Lampe + +Changes in libsoup from 3.4.1 to 3.4.2: + +* Revert changes to request cancellation Patrick Griffis + +Changes in libsoup from 3.4.0 to 3.4.1: + +* Fix HTTP/2 on platforms with unsigned char Patrick Griffis +* Change request cancellation to be handled earlier Carlos Garcia Campos +* Add names to GSources and source tags to GTasks to aid debugging Philip Withnall + +Changes in libsoup from 3.3.1 to 3.4.0: + +* Fix possible crash in SoupContentSniffer Patrick Griffis +* Fix socket leak Alessandro Bono +* Add missing annotation to soup_header_g_string_append_param_quoted() Lukáš Tyrychtr + +Changes in libsoup from 3.3.0 to 3.3.1: + +* Fix regression in `SoupCookieJar` not handling valid Secure cookies Patrick Griffis +* Fix crash when skipping HTTP/1 response stream with chunked enconding Carlos Garcia Campos +* Change Session to unqueue finished items earlier without an extra MainContext iteration Carlos Garcia Campos + +Changes in libsoup from 3.2.2 to 3.3.0: + +* Add `SoupMessage::got-body-data` signal to monitor progress of reads Carlos Garcia Campos +* Add `soup_session_send_and_splice()` and `soup_session_send_and_splice_async()` convenience APIs Carlos Garcia Campos +* Add `soup_message_set_force_http1()` and `soup_message_get_force_http1()` APIs Milan Crha +* Change `soup_cookie_copy()` to not retain default ports Patrick Griffis +* Ensure `SoupServerMessage` socket is available in websocket handler Carlos Garcia Campos +* Fix `soup_message_new()` not erroring when URI has an empty host Guillaume Desmottes +* Fix thread-saftey issues in `SoupConnectionAuth` Milan Crha +* Fix various connection leaks Biagio Festa, Carlos Garcia Campos +* Fix the possibility of sending invalid empty `Sec-WebSocket-Protocol` header Lukáš Tyrychtr +* Fix IO errors not being handled on `CONNECT` messages Carlos Garcia Campos +* Numerous improvements to cookies: + * Add support for cookie prefixes (`__Secure-` and `__Host-`) Siwei Li + * Reject cookies with control characters in name or value Siwei Li + * Reject `SameSite=None` cookies without `Secure` Siwei Li + * Change `soup_cookie_parse()` to be more strict about what is considered whitespace Siwei Li + * Change default SameSite value to `Lax` Amanda Falke + * Fix `soup_cookie_equal()` with `NULL` path Patrick Griffis + Changes in libsoup from 3.2.1 to 3.2.2: * Various HTTP/2 Fixes: Carlos Garcia Campos
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/docs/reference/libsoup.toml.in -> _service:tar_scm:libsoup-3.4.4.tar.xz/docs/reference/libsoup.toml.in
Changed
@@ -23,7 +23,7 @@ docs_url = "https://docs.gtk.org/glib/" dependencies."Gio-2.0" -name = "GIO" +name = "Gio" description = "GObject Interfaces and Objects, Networking, IPC, and I/O" docs_url = "https://docs.gtk.org/gio/"
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/examples/get.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/examples/get.c
Changed
@@ -28,17 +28,13 @@ #define OUTPUT_BUFFER_SIZE 8192 static void -on_stream_splice (GObject *source, GAsyncResult *result, gpointer user_data) +on_request_spliced (GObject *source, GAsyncResult *result, gpointer user_data) { GError *error = NULL; - g_output_stream_splice_finish (G_OUTPUT_STREAM (source), - result, - &error); - if (error) { - g_printerr ("Failed to download: %s\n", error->message); + + if (soup_session_send_and_splice_finish (SOUP_SESSION (source), result, &error) == -1) { + g_printerr ("Failed to send request: %s\n", error->message); g_error_free (error); - g_main_loop_quit (loop); - return; } g_main_loop_quit (loop); @@ -76,6 +72,7 @@ static void on_request_sent (GObject *source, GAsyncResult *result, gpointer user_data) { + char *output_buffer; GError *error = NULL; GInputStream *in = soup_session_send_finish (SOUP_SESSION (source), result, &error); @@ -86,34 +83,9 @@ return; } - if (output_file_path) { - GFile *output_file = g_file_new_for_commandline_arg (output_file_path); - GOutputStream *out = G_OUTPUT_STREAM (g_file_create (output_file, G_FILE_CREATE_NONE, - NULL, &error)); - if (error) { - g_print ("Failed to create \"%s\": %s\n", output_file_path, error->message); - g_error_free (error); - g_object_unref (in); - g_object_unref (output_file); - g_main_loop_quit (loop); - return; - } - - /* Start downloading to the file */ - g_output_stream_splice_async (G_OUTPUT_STREAM (out), in, - G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - G_PRIORITY_DEFAULT, - NULL, - on_stream_splice, - NULL); - - g_object_unref (out); - } else { - char *output_buffer = g_new (char, OUTPUT_BUFFER_SIZE); - g_input_stream_read_all_async (in, output_buffer, OUTPUT_BUFFER_SIZE, - G_PRIORITY_DEFAULT, NULL, on_read_ready, output_buffer); - } - + output_buffer = g_new (char, OUTPUT_BUFFER_SIZE); + g_input_stream_read_all_async (in, output_buffer, OUTPUT_BUFFER_SIZE, + G_PRIORITY_DEFAULT, NULL, on_read_ready, output_buffer); g_object_unref (in); } @@ -334,8 +306,30 @@ /* Send the request */ soup_message_set_tls_client_certificate (msg, client_cert); - soup_session_send_async (session, msg, G_PRIORITY_DEFAULT, NULL, - on_request_sent, NULL); + if (output_file_path) { + GFile *output_file = g_file_new_for_commandline_arg (output_file_path); + GOutputStream *out = G_OUTPUT_STREAM (g_file_create (output_file, G_FILE_CREATE_NONE, + NULL, &error)); + + if (error) { + g_print ("Failed to create \"%s\": %s\n", output_file_path, error->message); + g_error_free (error); + g_object_unref (output_file); + g_object_unref (msg); + g_object_unref (session); + exit (1); + } + soup_session_send_and_splice_async (session, msg, out, + G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | + G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, + G_PRIORITY_DEFAULT, + NULL, on_request_spliced, NULL); + g_object_unref (output_file); + g_object_unref (out); + } else { + soup_session_send_async (session, msg, G_PRIORITY_DEFAULT, NULL, + on_request_sent, NULL); + } g_object_unref (msg); /* Run the loop */
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/examples/simple-httpd.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/examples/simple-httpd.c
Changed
@@ -88,6 +88,8 @@ if (g_file_test (path, G_FILE_TEST_IS_DIR)) { GString *listing; char *index_path; + char *listing_str; + gsize listing_len; slash = strrchr (path, '/'); if (!slash || slash1) { @@ -109,11 +111,12 @@ g_free (index_path); listing = get_directory_listing (path); + listing_len = listing->len; + listing_str = g_string_free (g_steal_pointer (&listing), FALSE); soup_server_message_set_response (msg, "text/html", SOUP_MEMORY_TAKE, - listing->str, listing->len); + g_steal_pointer (&listing_str), listing_len); soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); - g_string_free (listing, FALSE); return; }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/auth/soup-connection-auth.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/auth/soup-connection-auth.c
Changed
@@ -20,6 +20,7 @@ typedef struct { GHashTable *conns; + GMutex lock; } SoupConnectionAuthPrivate; G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (SoupConnectionAuth, soup_connection_auth, SOUP_TYPE_AUTH) @@ -29,6 +30,7 @@ { SoupConnectionAuthPrivate *priv = soup_connection_auth_get_instance_private (auth); + g_mutex_init (&priv->lock); priv->conns = g_hash_table_new (NULL, NULL); } @@ -50,8 +52,10 @@ SoupConnectionAuthPrivate *priv = soup_connection_auth_get_instance_private (auth); gpointer state; + g_mutex_lock (&priv->lock); state = g_hash_table_lookup (priv->conns, conn); g_hash_table_remove (priv->conns, conn); + g_mutex_unlock (&priv->lock); soup_connection_auth_free_connection_state (auth, conn, state); } @@ -63,12 +67,15 @@ GHashTableIter iter; gpointer conn, state; + g_mutex_lock (&priv->lock); g_hash_table_iter_init (&iter, priv->conns); while (g_hash_table_iter_next (&iter, &conn, &state)) { soup_connection_auth_free_connection_state (auth, conn, state); g_hash_table_iter_remove (&iter); } g_hash_table_destroy (priv->conns); + g_mutex_unlock (&priv->lock); + g_mutex_clear (&priv->lock); G_OBJECT_CLASS (soup_connection_auth_parent_class)->finalize (object); } @@ -99,16 +106,19 @@ g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL); conn = soup_message_get_connection (msg); + g_mutex_lock (&priv->lock); state = g_hash_table_lookup (priv->conns, conn); if (!state) { state = SOUP_CONNECTION_AUTH_GET_CLASS (auth)->create_connection_state (auth); + g_hash_table_insert (priv->conns, conn, state); + g_mutex_unlock (&priv->lock); if (conn) { - g_signal_connect (conn, "disconnected", - G_CALLBACK (connection_disconnected), auth); + g_signal_connect_object (conn, "disconnected", + G_CALLBACK (connection_disconnected), auth, 0); } - - g_hash_table_insert (priv->conns, conn, state); - } + } else { + g_mutex_unlock (&priv->lock); + } g_clear_object (&conn); return state;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/auth/soup-tls-interaction.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/auth/soup-tls-interaction.c
Changed
@@ -34,6 +34,7 @@ SoupConnection *conn = g_weak_ref_get (&priv->conn); task = g_task_new (tls_interaction, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_tls_interaction_request_certificate_async); if (conn) { soup_connection_request_tls_certificate (conn, connection, task); g_object_unref (conn); @@ -66,6 +67,7 @@ SoupConnection *conn = g_weak_ref_get (&priv->conn); task = g_task_new (tls_interaction, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_tls_interaction_ask_password_async); if (conn) { soup_connection_request_tls_certificate_password (conn, password, task); g_object_unref (conn);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/content-sniffer/soup-content-sniffer.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/content-sniffer/soup-content-sniffer.c
Changed
@@ -229,6 +229,15 @@ }; static gboolean +data_has_prefix (const char *data, const char *prefix, gsize max_length) +{ + if (strlen (prefix) > max_length) + return FALSE; + + return memcmp (data, prefix, strlen (prefix)) == 0; +} + +static gboolean sniff_mp4 (SoupContentSniffer *sniffer, GBytes *buffer) { gsize resource_length; @@ -247,14 +256,14 @@ if (resource_length < 12 || resource_length < box_size || box_size % 4 != 0) return FALSE; - if (!g_str_has_prefix (resource + 4, "ftyp")) + if (!data_has_prefix (resource + 4, "ftyp", resource_length - 4)) return FALSE; - if (!g_str_has_prefix (resource + 8, "mp4")) + if (!data_has_prefix (resource + 8, "mp4", resource_length - 8)) return FALSE; for (i = 16; i < box_size && i < resource_length; i = i + 4) { - if (g_str_has_prefix (resource + i, "mp4")) + if (data_has_prefix (resource + i, "mp4", resource_length - i)) return TRUE; } @@ -670,13 +679,13 @@ goto text_html; /* Skip comments. */ - if (g_str_has_prefix (resource + pos, "!--")) { + if (data_has_prefix (resource + pos, "!--", resource_length - pos)) { pos = pos + 3; if ((pos + 2) > resource_length) goto text_html; - while (!g_str_has_prefix (resource + pos, "-->")) { + while (!data_has_prefix (resource + pos, "-->", resource_length - pos)) { pos++; if ((pos + 2) > resource_length) @@ -708,7 +717,7 @@ if ((pos + 1) > resource_length) goto text_html; - } while (!g_str_has_prefix (resource + pos, "?>")); + } while (!data_has_prefix (resource + pos, "?>", resource_length - pos)); pos = pos + 2; @@ -718,19 +727,19 @@ if ((pos + 3) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "rss")) + if (data_has_prefix (resource + pos, "rss", resource_length - pos)) return g_strdup ("application/rss+xml"); if ((pos + 4) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "feed")) + if (data_has_prefix (resource + pos, "feed", resource_length - pos)) return g_strdup ("application/atom+xml"); if ((pos + 7) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "rdf:RDF")) { + if (data_has_prefix (resource + pos, "rdf:RDF", resource_length - pos)) { pos = pos + 7; if (skip_insignificant_space (resource, &pos, resource_length)) @@ -739,7 +748,7 @@ if ((pos + 32) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "xmlns=\"http://purl.org/rss/1.0/\"")) { + if (data_has_prefix (resource + pos, "xmlns=\"http://purl.org/rss/1.0/\"", resource_length - pos)) { pos = pos + 32; if (skip_insignificant_space (resource, &pos, resource_length)) @@ -748,14 +757,14 @@ if ((pos + 55) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"")) + if (data_has_prefix (resource + pos, "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", resource_length - pos)) return g_strdup ("application/rss+xml"); } if ((pos + 55) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"")) { + if (data_has_prefix (resource + pos, "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", resource_length - pos)) { pos = pos + 55; if (skip_insignificant_space (resource, &pos, resource_length)) @@ -764,7 +773,7 @@ if ((pos + 32) > resource_length) goto text_html; - if (g_str_has_prefix (resource + pos, "xmlns=\"http://purl.org/rss/1.0/\"")) + if (data_has_prefix (resource + pos, "xmlns=\"http://purl.org/rss/1.0/\"", resource_length - pos)) return g_strdup ("application/rss+xml"); } }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/cookies/soup-cookie-jar-text.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/cookies/soup-cookie-jar-text.c
Changed
@@ -137,7 +137,7 @@ else if (strcmp (string, "None") == 0) return SOUP_SAME_SITE_POLICY_NONE; else - g_return_val_if_reached (SOUP_SAME_SITE_POLICY_NONE); + g_return_val_if_reached (SOUP_SAME_SITE_POLICY_LAX); } static const char * @@ -152,7 +152,7 @@ return "None"; } - g_return_val_if_reached ("None"); + g_return_val_if_reached ("Lax"); } static SoupCookie*
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/cookies/soup-cookie-jar.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/cookies/soup-cookie-jar.c
Changed
@@ -564,6 +564,21 @@ return retval; } +static gboolean +string_contains_ctrlcode (const char *s) +{ + const char *p; + + p = s; + while (*p != '\0') { + if (g_ascii_iscntrl (*p) && *p != 0x09) + return TRUE; + + p++; + } + return FALSE; +} + /** * soup_cookie_jar_add_cookie_full: * @jar: a #SoupCookieJar @@ -618,6 +633,48 @@ return; } + /* SameSite=None cookies are rejected unless the Secure attribute is set. */ + if (soup_cookie_get_same_site_policy (cookie) == SOUP_SAME_SITE_POLICY_NONE && !soup_cookie_get_secure (cookie)) { + soup_cookie_free (cookie); + return; + } + + /* See https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00 for handling the prefixes, + * which has been implemented by Firefox and Chrome. */ +#define MATCH_PREFIX(name, prefix) (!g_ascii_strncasecmp (name, prefix, strlen(prefix))) + + /* Cookies with a "__Secure-" prefix should have Secure attribute set and it must be for a secure host. */ + if (MATCH_PREFIX (soup_cookie_get_name (cookie), "__Secure-") && !soup_cookie_get_secure (cookie) ) { + soup_cookie_free (cookie); + return; + } + /* Path=/ and Secure attributes are required; Domain attribute must not be present. + Note that SoupCookie always sets the domain so we ensure its not a subdomain match. */ + if (MATCH_PREFIX (soup_cookie_get_name (cookie), "__Host-")) { + if (!soup_cookie_get_secure (cookie) || + strcmp (soup_cookie_get_path (cookie), "/") != 0 || + soup_cookie_get_domain (cookie)0 == '.') { + soup_cookie_free (cookie); + return; + } + } + + /* Cookies should not take control characters %x00-1F / %x7F (defined by RFC 5234) in names or values, + * with the exception of %x09 (the tab character). + */ + const char *name, *value; + name = soup_cookie_get_name (cookie); + value = soup_cookie_get_value (cookie); + if (string_contains_ctrlcode (name) || string_contains_ctrlcode (value)) { + soup_cookie_free (cookie); + return; + } + + if (strlen(name) > 4096 || strlen(value) > 4096) { + soup_cookie_free (cookie); + return; + } + g_mutex_lock (&priv->mutex); old_cookies = g_hash_table_lookup (priv->domains, soup_cookie_get_domain (cookie));
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/cookies/soup-cookie.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/cookies/soup-cookie.c
Changed
@@ -56,6 +56,7 @@ GDateTime *expires; gboolean secure; gboolean http_only; + SoupSameSitePolicy same_site_policy; }; G_DEFINE_BOXED_TYPE (SoupCookie, soup_cookie, soup_cookie_copy, soup_cookie_free) @@ -81,7 +82,7 @@ copy->expires = g_date_time_ref (cookie->expires); copy->secure = cookie->secure; copy->http_only = cookie->http_only; - soup_cookie_set_same_site_policy (copy, soup_cookie_get_same_site_policy (cookie)); + copy->same_site_policy = cookie->same_site_policy; return copy; } @@ -107,10 +108,16 @@ return soup_host_matches_host (cookie->domain, host); } +static inline gboolean +is_white_space (char c) +{ + return (c == ' ' || c == '\t'); +} + static inline const char * skip_lws (const char *s) { - while (g_ascii_isspace (*s)) + while (is_white_space (*s)) s++; return s; } @@ -118,13 +125,13 @@ static inline const char * unskip_lws (const char *s, const char *start) { - while (s > start && g_ascii_isspace (*(s - 1))) + while (s > start && is_white_space (*(s - 1))) s--; return s; } -#define is_attr_ender(ch) ((ch) < ' ' || (ch) == ';' || (ch) == ',' || (ch) == '=') -#define is_value_ender(ch) ((ch) < ' ' || (ch) == ';') +#define is_attr_ender(ch) ((ch) == '\0' || (ch) == ';' || (ch) == ',' || (ch) == '=') +#define is_value_ender(ch) ((ch) == '\0' || (ch) == ';') static char * parse_value (const char **val_p, gboolean copy) @@ -169,6 +176,7 @@ SoupCookie *cookie; cookie = g_slice_new0 (SoupCookie); + soup_cookie_set_same_site_policy (cookie, SOUP_SAME_SITE_POLICY_LAX); /* Parse the NAME */ start = skip_lws (header); @@ -232,15 +240,15 @@ } else if (MATCH_NAME ("samesite")) { if (has_value) { char *policy = parse_value (&p, TRUE); - if (g_ascii_strcasecmp (policy, "Lax") == 0) - soup_cookie_set_same_site_policy (cookie, SOUP_SAME_SITE_POLICY_LAX); + if (g_ascii_strcasecmp (policy, "None") == 0) + soup_cookie_set_same_site_policy (cookie, SOUP_SAME_SITE_POLICY_NONE); else if (g_ascii_strcasecmp (policy, "Strict") == 0) soup_cookie_set_same_site_policy (cookie, SOUP_SAME_SITE_POLICY_STRICT); - /* There is an explicit "None" value which is the default. */ + /* There is an explicit "Lax" value which is the default */ g_free (policy); } /* Note that earlier versions of the same-site RFC treated invalid values as strict but - the latest revision simply ignores them. */ + the latest revision assigns invalid SameSite values to Lax. */ } else { /* Ignore unknown attributes, but we still have * to skip over the value. @@ -327,6 +335,7 @@ cookie->domain = g_strdup (domain); cookie->path = g_strdup (path); soup_cookie_set_max_age (cookie, max_age); + cookie->same_site_policy = SOUP_SAME_SITE_POLICY_LAX; return cookie; } @@ -358,6 +367,9 @@ * about setting the exact time that the cookie will expire, use * method@Cookie.set_expires.) * + * As of version 3.4.0 the default value of a cookie's same-site-policy + * is %SOUP_SAME_SITE_POLICY_LAX. + * * Returns: a new #SoupCookie. **/ SoupCookie * @@ -396,6 +408,9 @@ * appropriate string for the domain if you want to actually make use * of the cookie. * + * As of version 3.4.0 the default value of a cookie's same-site-policy + * is %SOUP_SAME_SITE_POLICY_LAX. + * * Returns: (nullable): a new #SoupCookie, or %NULL if it could * not be parsed, or contained an illegal "domain" attribute for a * cookie originating from @origin. @@ -741,10 +756,6 @@ g_string_append (header, "; HttpOnly"); } -static GQuark soup_same_site_policy_quark (void); -G_DEFINE_QUARK (soup-same-site-policy, soup_same_site_policy) -#define SAME_SITE_POLICY_QUARK (soup_same_site_policy_quark()) - /** * soup_cookie_set_same_site_policy: * @cookie: a #SoupCookie @@ -762,7 +773,7 @@ case SOUP_SAME_SITE_POLICY_NONE: case SOUP_SAME_SITE_POLICY_STRICT: case SOUP_SAME_SITE_POLICY_LAX: - g_dataset_id_set_data (cookie, SAME_SITE_POLICY_QUARK, GUINT_TO_POINTER (policy)); + cookie->same_site_policy = policy; break; default: g_return_if_reached (); @@ -780,7 +791,7 @@ SoupSameSitePolicy soup_cookie_get_same_site_policy (SoupCookie *cookie) { - return GPOINTER_TO_UINT (g_dataset_id_get_data (cookie, SAME_SITE_POLICY_QUARK)); + return cookie->same_site_policy; } /** @@ -1080,5 +1091,5 @@ return (!strcmp (cookie1->name, cookie2->name) && !strcmp (cookie1->value, cookie2->value) && - !strcmp (cookie1->path, cookie2->path)); + !g_strcmp0 (cookie1->path, cookie2->path)); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/http1/soup-body-input-stream.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/http1/soup-body-input-stream.c
Changed
@@ -226,12 +226,12 @@ case SOUP_BODY_INPUT_STREAM_STATE_TRAILERS: nread = soup_filter_input_stream_read_line ( - fstream, buffer, count, blocking, + fstream, metabuf, sizeof (metabuf), blocking, &got_line, cancellable, error); if (nread <= 0) return nread; - if (strncmp (buffer, "\r\n", nread) || strncmp (buffer, "\n", nread)) { + if (strncmp (metabuf, "\r\n", nread) || strncmp (metabuf, "\n", nread)) { priv->chunked_state = SOUP_BODY_INPUT_STREAM_STATE_DONE; priv->eof = TRUE; }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/http1/soup-client-message-io-http1.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/http1/soup-client-message-io-http1.c
Changed
@@ -36,6 +36,7 @@ SoupMessageQueueItem *item; + gint64 response_header_bytes_received; SoupMessageMetrics *metrics; /* Request body logger */ @@ -495,10 +496,17 @@ { SoupClientMessageIOHTTP1 *client_io = (SoupClientMessageIOHTTP1 *)soup_message_get_io_data (msg); - if (client_io->msg_io->base.read_state < SOUP_MESSAGE_IO_STATE_BODY_START) - client_io->msg_io->metrics->response_header_bytes_received += count; - else + if (client_io->msg_io->base.read_state < SOUP_MESSAGE_IO_STATE_BODY_START) { + client_io->msg_io->response_header_bytes_received += count; + if (client_io->msg_io->metrics) + client_io->msg_io->metrics->response_header_bytes_received += count; + return; + } + + if (client_io->msg_io->metrics) client_io->msg_io->metrics->response_body_bytes_received += count; + + soup_message_got_body_data (msg, count); } /* Attempts to push forward the reading side of @msg's I/O. Returns @@ -518,6 +526,7 @@ gboolean succeeded; gboolean is_first_read; gushort extra_bytes; + gsize response_body_bytes_received = 0; switch (io->read_state) { case SOUP_MESSAGE_IO_STATE_HEADERS: @@ -531,16 +540,17 @@ if (!succeeded) return FALSE; - if (client_io->msg_io->metrics) { - /* Adjust the header and body bytes received, since we might - * have read part of the body already that is queued by the stream. - */ - if (client_io->msg_io->metrics->response_header_bytes_received > io->read_header_buf->len + extra_bytes) { - client_io->msg_io->metrics->response_body_bytes_received = - client_io->msg_io->metrics->response_header_bytes_received - io->read_header_buf->len - extra_bytes; - client_io->msg_io->metrics->response_header_bytes_received -= client_io->msg_io->metrics->response_body_bytes_received; + /* Adjust the header and body bytes received, since we might + * have read part of the body already that is queued by the stream. + */ + if (client_io->msg_io->response_header_bytes_received > io->read_header_buf->len + extra_bytes) { + response_body_bytes_received = client_io->msg_io->response_header_bytes_received - io->read_header_buf->len - extra_bytes; + if (client_io->msg_io->metrics) { + client_io->msg_io->metrics->response_body_bytes_received = response_body_bytes_received; + client_io->msg_io->metrics->response_header_bytes_received -= response_body_bytes_received; } } + client_io->msg_io->response_header_bytes_received = 0; succeeded = parse_headers (msg, (char *)io->read_header_buf->data, @@ -616,6 +626,9 @@ io->read_length = -1; soup_message_got_headers (msg); + + if (response_body_bytes_received > 0) + soup_message_got_body_data (msg, response_body_bytes_received); break; case SOUP_MESSAGE_IO_STATE_BODY_START: @@ -960,6 +973,7 @@ GTask *task; task = g_task_new (msg, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_client_message_io_http1_run_until_read_async); g_task_set_priority (task, io_priority); io_run_until_read_async (io, task); } @@ -1043,11 +1057,9 @@ msg_io->base.read_state = SOUP_MESSAGE_IO_STATE_NOT_STARTED; msg_io->base.write_state = SOUP_MESSAGE_IO_STATE_HEADERS; msg_io->metrics = soup_message_get_metrics (msg_io->item->msg); - if (msg_io->metrics) { - g_signal_connect_object (io->istream, "read-data", - G_CALLBACK (response_network_stream_read_data_cb), - msg_io->item->msg, G_CONNECT_SWAPPED); - } + g_signal_connect_object (io->istream, "read-data", + G_CALLBACK (response_network_stream_read_data_cb), + msg_io->item->msg, G_CONNECT_SWAPPED); #ifdef HAVE_SYSPROF msg_io->begin_time_nsec = SYSPROF_CAPTURE_CURRENT_TIME;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/http1/soup-message-io-data.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/http1/soup-message-io-data.c
Changed
@@ -177,6 +177,11 @@ base_source = g_timeout_source_new (0); source = soup_message_io_source_new (base_source, msg, io && io->paused, message_io_source_check); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (source, "SoupMessageIOData"); +#else + g_source_set_name (source, "SoupMessageIOData"); +#endif g_source_set_callback (source, (GSourceFunc) callback, user_data, NULL); return source; }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/http2/soup-body-input-stream-http2.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/http2/soup-body-input-stream-http2.c
Changed
@@ -42,7 +42,7 @@ }; typedef struct { - GSList *chunks; + GQueue *chunks; gsize start_offset; gsize len; gsize pos; @@ -72,7 +72,7 @@ * Returns: a new #GInputStream */ GInputStream * -soup_body_input_stream_http2_new () +soup_body_input_stream_http2_new (void) { return G_INPUT_STREAM (g_object_new (SOUP_TYPE_BODY_INPUT_STREAM_HTTP2, NULL)); } @@ -89,7 +89,7 @@ priv = soup_body_input_stream_http2_get_instance_private (stream); - priv->chunks = g_slist_append (priv->chunks, g_bytes_new (data, size)); + g_queue_push_tail (priv->chunks, g_bytes_new (data, size)); priv->len += size; if (priv->need_more_data_cancellable) { g_cancellable_cancel (priv->need_more_data_cancellable); @@ -118,7 +118,7 @@ { SoupBodyInputStreamHttp2 *memory_stream; SoupBodyInputStreamHttp2Private *priv; - GSList *l; + GList *l; GBytes *chunk; gsize len; gsize offset, start, rest, size; @@ -135,7 +135,7 @@ count = MIN (read_count, priv->len - priv->pos); offset = priv->start_offset; - for (l = priv->chunks; l; l = l->next) { + for (l = g_queue_peek_head_link(priv->chunks); l; l = l->next) { chunk = (GBytes *)l->data; len = g_bytes_get_size (chunk); @@ -150,7 +150,7 @@ rest = count; while (l && rest > 0) { - GSList *next = l->next; + GList *next = l->next; const guint8 *chunk_data; chunk = (GBytes *)l->data; @@ -165,7 +165,7 @@ /* Remove fully read chunk from list, note that we are always near the start of the list */ if (start + size == len) { priv->start_offset += len; - priv->chunks = g_slist_delete_link (priv->chunks, l); + g_queue_delete_link (priv->chunks, l); g_bytes_unref (chunk); } @@ -256,12 +256,12 @@ /* Remove all skipped chunks */ gsize offset = priv->start_offset; - for (GSList *l = priv->chunks; l; l = l->next) { + for (GList *l = g_queue_peek_head_link(priv->chunks); l; l = l->next) { GBytes *chunk = (GBytes *)l->data; gsize chunk_len = g_bytes_get_size (chunk); if (offset + chunk_len <= priv->pos) { - priv->chunks = g_slist_delete_link (priv->chunks, l); + g_queue_delete_link (priv->chunks, l); g_bytes_unref (chunk); offset += chunk_len; } @@ -383,7 +383,7 @@ SoupBodyInputStreamHttp2 *stream = SOUP_BODY_INPUT_STREAM_HTTP2 (object); SoupBodyInputStreamHttp2Private *priv = soup_body_input_stream_http2_get_instance_private (stream); - g_slist_free_full (priv->chunks, (GDestroyNotify)g_bytes_unref); + g_queue_free_full (priv->chunks, (GDestroyNotify)g_bytes_unref); G_OBJECT_CLASS (soup_body_input_stream_http2_parent_class)->finalize (object); } @@ -399,6 +399,10 @@ static void soup_body_input_stream_http2_init (SoupBodyInputStreamHttp2 *stream) { + SoupBodyInputStreamHttp2Private *priv; + + priv = soup_body_input_stream_http2_get_instance_private (stream); + priv->chunks = g_queue_new (); } static void
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/http2/soup-client-message-io-http2.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/http2/soup-client-message-io-http2.c
Changed
@@ -61,6 +61,7 @@ GError *error; GSource *read_source; GSource *write_source; + GSource *write_idle_source; GHashTable *messages; GHashTable *closed_messages; @@ -91,8 +92,9 @@ GTask *task; gboolean in_io_try_sniff_content; - /* Request body logger */ + /* Request body */ SoupLogger *logger; + gssize request_body_bytes_to_write; /* Pollable data sources */ GSource *data_source_poll; @@ -354,6 +356,8 @@ return G_SOURCE_REMOVE; } +static gboolean io_write_idle_cb (SoupClientMessageIOHTTP2* io); + static void io_try_write (SoupClientMessageIOHTTP2 *io, gboolean blocking) @@ -366,19 +370,44 @@ if (io->in_callback) { if (blocking || !nghttp2_session_want_write (io->session)) return; - } else { - while (!error && nghttp2_session_want_write (io->session)) - io_write (io, blocking, NULL, &error); + + if (io->write_idle_source) + return; + + io->write_idle_source = g_idle_source_new (); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->write_idle_source, "Soup HTTP/2 write idle source"); +#else + g_source_set_name (io->write_idle_source, "Soup HTTP/2 write idle source"); +#endif + /* Give write more priority than read */ + g_source_set_priority (io->write_idle_source, G_PRIORITY_DEFAULT - 1); + g_source_set_callback (io->write_idle_source, (GSourceFunc)io_write_idle_cb, io, NULL); + g_source_attach (io->write_idle_source, g_main_context_get_thread_default ()); + return; } - if (!blocking && (io->in_callback || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))) { + if (io->write_idle_source) { + g_source_destroy (io->write_idle_source); + g_clear_pointer (&io->write_idle_source, g_source_unref); + } + + while (!error && nghttp2_session_want_write (io->session)) + io_write (io, blocking, NULL, &error); + + if (!blocking && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { g_clear_error (&error); io->write_source = g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM (io->ostream), NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->write_source, "Soup HTTP/2 write source"); +#else g_source_set_name (io->write_source, "Soup HTTP/2 write source"); +#endif /* Give write more priority than read */ g_source_set_priority (io->write_source, G_PRIORITY_DEFAULT - 1); g_source_set_callback (io->write_source, (GSourceFunc)io_write_ready, io, NULL); g_source_attach (io->write_source, g_main_context_get_thread_default ()); + return; } if (error) @@ -386,12 +415,20 @@ } static gboolean +io_write_idle_cb (SoupClientMessageIOHTTP2* io) +{ + g_clear_pointer (&io->write_idle_source, g_source_unref); + io_try_write (io, FALSE); + return G_SOURCE_REMOVE; +} + +static gboolean io_read (SoupClientMessageIOHTTP2 *io, gboolean blocking, GCancellable *cancellable, GError **error) { - guint8 buffer8192; + guint8 buffer16384; gssize read; int ret; @@ -709,6 +746,8 @@ data_provider.source.ptr = soup_message_get_request_body_stream (data->msg); data_provider.read_callback = on_data_source_read_callback; + goffset content_length = soup_message_headers_get_content_length (soup_message_get_request_headers (data->msg)); + data->request_body_bytes_to_write = content_length > 0 ? content_length : -1; nghttp2_submit_data (io->session, NGHTTP2_FLAG_END_STREAM, frame->hd.stream_id, &data_provider); io_try_write (io, !data->item->async); } @@ -738,8 +777,11 @@ break; } case NGHTTP2_DATA: + h2_debug (io, data, "RECV DATA window=%d/%d", nghttp2_session_get_stream_effective_recv_data_length (session, frame->hd.stream_id), + nghttp2_session_get_stream_effective_local_window_size (session, frame->hd.stream_id)); if (data->metrics) data->metrics->response_body_bytes_received += frame->data.hd.length + FRAME_HEADER_SIZE; + soup_message_got_body_data (data->msg, frame->data.hd.length + FRAME_HEADER_SIZE); if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { if (data->body_istream) { soup_body_input_stream_http2_complete (SOUP_BODY_INPUT_STREAM_HTTP2 (data->body_istream)); @@ -749,8 +791,7 @@ soup_http2_message_data_check_status (data); } } - } else { - /* Try to write after every data frame, since nghttp2 might need to send a window update. */ + } else if (nghttp2_session_get_stream_effective_recv_data_length (session, frame->hd.stream_id) == 0) { io_try_write (io, !data->item->async); } break; @@ -916,7 +957,11 @@ /* Close in idle to ensure all pending io is finished first */ source = g_idle_source_new (); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (source, "Soup HTTP/2 close source"); +#else g_source_set_name (source, "Soup HTTP/2 close source"); +#endif g_source_set_callback (source, (GSourceFunc)close_in_idle_cb, io, NULL); g_source_attach (source, g_task_get_context (io->close_task)); g_source_unref (source); @@ -1046,8 +1091,14 @@ } else if (read == 0) { g_byte_array_set_size (data->data_source_buffer, 0); data->data_source_eof = TRUE; - } else + } else { + if (data->request_body_bytes_to_write > 0) { + data->request_body_bytes_to_write -= read; + if (data->request_body_bytes_to_write == 0) + data->data_source_eof = TRUE; + } g_byte_array_set_size (data->data_source_buffer, read); + } h2_debug (data->io, data, "SEND_BODY Resuming send"); NGCHECK (nghttp2_session_resume_data (data->io->session, data->stream_id)); @@ -1095,7 +1146,12 @@ read = g_input_stream_read (source->ptr, buf, length, data->item->cancellable, &error); if (read) { - h2_debug (data->io, data, "SEND_BODY Read %zd", read); + if (data->request_body_bytes_to_write > 0) { + data->request_body_bytes_to_write -= read; + if (data->request_body_bytes_to_write == 0) + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + } + h2_debug (data->io, data, "SEND_BODY Read %zd%s", read, *data_flags & NGHTTP2_DATA_FLAG_EOF ? ", EOF" : ""); log_request_data (data, buf, read); } @@ -1123,7 +1179,12 @@ gssize read = g_pollable_input_stream_read_nonblocking (in_stream, buf, length, data->item->cancellable, &error); if (read) { - h2_debug (data->io, data, "SEND_BODY Read %zd", read); + if (data->request_body_bytes_to_write > 0) { + data->request_body_bytes_to_write -= read; + if (data->request_body_bytes_to_write == 0) + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + } + h2_debug (data->io, data, "SEND_BODY Read %zd%s", read, *data_flags & NGHTTP2_DATA_FLAG_EOF ? ", EOF" : ""); log_request_data (data, buf, read); } @@ -1133,6 +1194,11 @@ h2_debug (data->io, data, "SEND_BODY Polling"); data->data_source_poll = g_pollable_input_stream_create_source (in_stream, data->item->cancellable); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (data->data_source_poll, "Soup HTTP/2 data polling"); +#else + g_source_set_name (data->data_source_poll, "Soup HTTP/2 data polling"); +#endif g_source_set_callback (data->data_source_poll, (GSourceFunc)on_data_readable, data, NULL); g_source_set_priority (data->data_source_poll, get_data_io_priority (data)); g_source_attach (data->data_source_poll, g_main_context_get_thread_default ()); @@ -1165,7 +1231,11 @@ guint buffer_len = data->data_source_buffer->len; if (buffer_len) { - h2_debug (data->io, data, "SEND_BODY Sending %zu", buffer_len); + if (data->data_source_eof) { + h2_debug (data->io, data, "SEND_BODY Sending %zu, EOF", buffer_len); + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + } else + h2_debug (data->io, data, "SEND_BODY Sending %zu", buffer_len); g_assert (buffer_len <= length); /* QUESTION: Maybe not reliable */ memcpy (buf, data->data_source_buffer->data, buffer_len); log_request_data (data, buf, buffer_len); @@ -1243,6 +1313,7 @@ data->item = soup_message_queue_item_ref (item); data->msg = item->msg; data->metrics = soup_message_get_metrics (data->msg); + data->request_body_bytes_to_write = -1; data->completion_cb = completion_cb; data->completion_data = completion_data; data->stream_id = 0; @@ -1351,9 +1422,10 @@ g_array_append_val (headers, pseudo_headersi); } + SoupMessageHeaders *request_headers = soup_message_get_request_headers (msg); SoupMessageHeadersIter iter; const char *name, *value; - soup_message_headers_iter_init (&iter, soup_message_get_request_headers (msg)); + soup_message_headers_iter_init (&iter, request_headers); while (soup_message_headers_iter_next (&iter, &name, &value)) { if (!request_header_is_valid (name)) continue; @@ -1371,7 +1443,7 @@ nghttp2_priority_spec_init (&priority_spec, 0, message_priority_to_weight (msg), 0); int32_t stream_id; - if (body_stream && soup_message_headers_get_expectations (soup_message_get_request_headers (msg)) & SOUP_EXPECTATION_CONTINUE) { + if (body_stream && soup_message_headers_get_expectations (request_headers) & SOUP_EXPECTATION_CONTINUE) { data->expect_continue = TRUE; stream_id = nghttp2_submit_headers (io->session, 0, -1, &priority_spec, (const nghttp2_nv *)headers->data, headers->len, data); } else { @@ -1379,6 +1451,8 @@ if (body_stream) { data_provider.source.ptr = body_stream; data_provider.read_callback = on_data_source_read_callback; + goffset content_length = soup_message_headers_get_content_length (request_headers); + data->request_body_bytes_to_write = content_length > 0 ? content_length : -1; } stream_id = nghttp2_submit_request (io->session, &priority_spec, (const nghttp2_nv *)headers->data, headers->len, body_stream ? &data_provider : NULL, data); } @@ -1743,6 +1817,7 @@ SoupHTTP2MessageData *data = get_data_for_message (io, msg); data->task = g_task_new (msg, cancellable, callback, user_data); + g_task_set_source_tag (data->task, soup_client_message_io_http2_run_until_read_async); g_task_set_priority (data->task, io_priority); io->pending_io_messages = g_list_prepend (io->pending_io_messages, data); if (data->error) @@ -1758,6 +1833,7 @@ io->owner = owner; g_assert (!io->write_source); + g_assert (!io->write_idle_source); if (io->read_source) { g_source_destroy (io->read_source); g_source_unref (io->read_source); @@ -1769,7 +1845,11 @@ return; io->read_source = g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM (io->istream), NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->read_source, "Soup HTTP/2 read source"); +#else g_source_set_name (io->read_source, "Soup HTTP/2 read source"); +#endif g_source_set_priority (io->read_source, G_PRIORITY_DEFAULT); g_source_set_callback (io->read_source, (GSourceFunc)io_read_ready, io, NULL); g_source_attach (io->read_source, g_main_context_get_thread_default ()); @@ -1789,6 +1869,7 @@ if (io->async) { g_assert (!io->close_task); io->close_task = g_task_new (conn, NULL, callback, NULL); + g_task_set_source_tag (io->close_task, soup_client_message_io_http2_close_async); } soup_client_message_io_http2_terminate_session (io); @@ -1813,6 +1894,10 @@ g_source_destroy (io->write_source); g_source_unref (io->write_source); } + if (io->write_idle_source) { + g_source_destroy (io->write_idle_source); + g_source_unref (io->write_idle_source); + } g_weak_ref_clear (&io->conn); g_clear_object (&io->stream); @@ -1891,7 +1976,6 @@ io->iface.funcs = &io_funcs; } -#define INITIAL_WINDOW_SIZE (32 * 1024 * 1024) /* 32MB matches other implementations */ #define MAX_HEADER_TABLE_SIZE 65536 /* Match size used by Chromium/Firefox */ SoupClientMessageIO * @@ -1909,14 +1993,14 @@ soup_client_message_io_http2_set_owner (io, soup_connection_get_owner (conn)); - NGCHECK (nghttp2_session_set_local_window_size (io->session, NGHTTP2_FLAG_NONE, 0, INITIAL_WINDOW_SIZE)); - + int stream_window_size = soup_connection_get_http2_initial_stream_window_size (conn); const nghttp2_settings_entry settings = { - { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, INITIAL_WINDOW_SIZE }, + { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, stream_window_size }, { NGHTTP2_SETTINGS_HEADER_TABLE_SIZE, MAX_HEADER_TABLE_SIZE }, { NGHTTP2_SETTINGS_ENABLE_PUSH, 0 }, }; NGCHECK (nghttp2_submit_settings (io->session, NGHTTP2_FLAG_NONE, settings, G_N_ELEMENTS (settings))); + NGCHECK (nghttp2_session_set_local_window_size (io->session, NGHTTP2_FLAG_NONE, 0, soup_connection_get_http2_initial_window_size (conn))); io_try_write (io, !io->async); return (SoupClientMessageIO *)io;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/http1/soup-server-message-io-http1.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/http1/soup-server-message-io-http1.c
Changed
@@ -122,21 +122,22 @@ g_object_ref (msg); g_clear_pointer (&io->msg_io, soup_message_io_http1_free); - if (completion_cb) - completion_cb (G_OBJECT (msg), completion, completion_data); conn = soup_server_message_get_connection (msg); - if (completion == SOUP_MESSAGE_IO_COMPLETE && - soup_server_connection_is_connected (conn) && - soup_server_message_is_keepalive (msg)) { - io->msg_io = soup_message_io_http1_new (soup_server_message_new (conn)); - io->msg_io->base.io_source = soup_message_io_data_get_source (&io->msg_io->base, - G_OBJECT (io->msg_io->msg), - io->istream, - io->ostream, - NULL, - (SoupMessageIOSourceFunc)io_run_ready, - NULL); - g_source_attach (io->msg_io->base.io_source, io->msg_io->async_context); + if (completion_cb) { + completion_cb (G_OBJECT (msg), completion, completion_data); + if (soup_server_connection_is_connected (conn)) { + io->msg_io = soup_message_io_http1_new (soup_server_message_new (conn)); + io->msg_io->base.io_source = soup_message_io_data_get_source (&io->msg_io->base, + G_OBJECT (io->msg_io->msg), + io->istream, + io->ostream, + NULL, + (SoupMessageIOSourceFunc)io_run_ready, + NULL); + g_source_attach (io->msg_io->base.io_source, io->msg_io->async_context); + } + } else { + soup_server_connection_disconnect (conn); } g_object_unref (msg); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/http2/soup-server-message-io-http2.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/http2/soup-server-message-io-http2.c
Changed
@@ -54,6 +54,7 @@ GSource *read_source; GSource *write_source; + GSource *write_idle_source; nghttp2_session *session; @@ -153,6 +154,10 @@ g_source_destroy (io->write_source); g_source_unref (io->write_source); } + if (io->write_idle_source) { + g_source_destroy (io->write_idle_source); + g_source_unref (io->write_idle_source); + } g_clear_object (&io->iostream); g_clear_pointer (&io->session, nghttp2_session_del); @@ -364,16 +369,24 @@ return G_SOURCE_CONTINUE; } - if (error && soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) - h2_debug (io, NULL, "SESSION IO error: %s", error->message); + if (soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) { + if (error) + h2_debug (io, NULL, "SESSION IO error: %s", error->message); + + g_clear_pointer (&io->write_source, g_source_unref); + + if (error || (!nghttp2_session_want_read (io->session) && !nghttp2_session_want_write (io->session))) + soup_server_connection_disconnect (conn); + } g_clear_error (&error); g_object_unref (conn); - g_clear_pointer (&io->write_source, g_source_unref); return G_SOURCE_REMOVE; } +static gboolean io_write_idle_cb (SoupServerMessageIOHTTP2* io); + static void io_try_write (SoupServerMessageIOHTTP2 *io) { @@ -383,31 +396,72 @@ if (io->write_source) return; + if (io->in_callback && soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) { + if (!nghttp2_session_want_write (io->session)) + return; + + if (io->write_idle_source) + return; + + io->write_idle_source = g_idle_source_new (); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->write_idle_source, "Soup server HTTP/2 write idle source"); +#else + g_source_set_name (io->write_idle_source, "Soup server HTTP/2 write idle source"); +#endif + g_source_set_priority (io->write_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (io->write_idle_source, (GSourceFunc)io_write_idle_cb, io, NULL); + g_source_attach (io->write_idle_source, g_main_context_get_thread_default ()); + return; + } + + if (io->write_idle_source) { + g_source_destroy (io->write_idle_source); + g_clear_pointer (&io->write_idle_source, g_source_unref); + } + g_object_ref (conn); while (!error && soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io && !io->in_callback && nghttp2_session_want_write (io->session)) io_write (io, &error); - if (io->in_callback || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { - g_clear_error (&error); - io->write_source = g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM (io->ostream), NULL); - g_source_set_name (io->write_source, "Soup server HTTP/2 write source"); - g_source_set_callback (io->write_source, (GSourceFunc)io_write_ready, io, NULL); - g_source_attach (io->write_source, g_main_context_get_thread_default ()); - } + if (soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) { + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { + g_clear_error (&error); + io->write_source = g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM (io->ostream), NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->write_source, "Soup server HTTP/2 write source"); +#else + g_source_set_name (io->write_source, "Soup server HTTP/2 write source"); +#endif + g_source_set_callback (io->write_source, (GSourceFunc)io_write_ready, io, NULL); + g_source_attach (io->write_source, g_main_context_get_thread_default ()); + } - if (error && soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) - h2_debug (io, NULL, "SESSION IO error: %s", error->message); + if (error) + h2_debug (io, NULL, "SESSION IO error: %s", error->message); + + if (error || (!nghttp2_session_want_read (io->session) && !nghttp2_session_want_write (io->session))) + soup_server_connection_disconnect (conn); + } g_clear_error (&error); g_object_unref (conn); } static gboolean +io_write_idle_cb (SoupServerMessageIOHTTP2* io) +{ + g_clear_pointer (&io->write_idle_source, g_source_unref); + io_try_write (io); + return G_SOURCE_REMOVE; +} + +static gboolean io_read (SoupServerMessageIOHTTP2 *io, GError **error) { - guint8 buffer8192; + guint8 buffer16384; gssize read; int ret; @@ -450,8 +504,13 @@ return G_SOURCE_CONTINUE; } - if (error && soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) - h2_debug (io, NULL, "SESSION IO error: %s", error->message); + if (soup_server_connection_get_io_data (conn) == (SoupServerMessageIO *)io) { + if (error) + h2_debug (io, NULL, "SESSION IO error: %s", error->message); + + if (error || (!nghttp2_session_want_read (io->session) && !nghttp2_session_want_write (io->session))) + soup_server_connection_disconnect (conn); + } g_clear_error (&error); g_object_unref (conn); @@ -731,6 +790,16 @@ break; } case NGHTTP2_DATA: + h2_debug (io, msg_io, "RECV DATA window=%d/%d", nghttp2_session_get_stream_effective_recv_data_length (session, frame->hd.stream_id), + nghttp2_session_get_stream_effective_local_window_size (session, frame->hd.stream_id)); + if (nghttp2_session_get_stream_effective_recv_data_length (session, frame->hd.stream_id) == 0) + io_try_write (io); + break; + case NGHTTP2_WINDOW_UPDATE: + h2_debug (io, msg_io, "RECV WINDOW_UPDATE increment=%d, total=%d", frame->window_update.window_size_increment, + nghttp2_session_get_stream_remote_window_size (session, frame->hd.stream_id)); + if (nghttp2_session_get_stream_remote_window_size (session, frame->hd.stream_id) > 0) + io_try_write (io); break; default: io->in_callback--; @@ -844,7 +913,11 @@ soup_server_message_io_http2_init (io); io->read_source = g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM (io->istream), NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (io->read_source, "Soup server HTTP/2 read source"); +#else g_source_set_name (io->read_source, "Soup server HTTP/2 read source"); +#endif g_source_set_callback (io->read_source, (GSourceFunc)io_read_ready, io, NULL); g_source_attach (io->read_source, g_main_context_get_thread_default ());
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/soup-listener.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/soup-listener.c
Changed
@@ -77,6 +77,8 @@ return G_SOURCE_REMOVE; conn = soup_server_connection_new (socket, priv->tls_certificate, priv->tls_database, priv->tls_auth_mode); + g_object_unref (socket); + g_signal_emit (listener, signalsNEW_CONNECTION, 0, conn); g_object_unref (conn); @@ -94,6 +96,11 @@ priv->conn = (GIOStream *)g_socket_connection_factory_create_connection (priv->socket); priv->iostream = soup_io_stream_new (priv->conn, FALSE); priv->source = g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM (g_io_stream_get_input_stream (priv->iostream)), NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->source, "SoupListener"); +#else + g_source_set_name (priv->source, "SoupListener"); +#endif g_source_set_callback (priv->source, (GSourceFunc)listen_watch, listener, NULL); g_source_attach (priv->source, g_main_context_get_thread_default ()); @@ -113,6 +120,7 @@ g_clear_object (&priv->socket); g_clear_object (&priv->iostream); + g_clear_object (&priv->local_addr); g_clear_object (&priv->tls_certificate); g_clear_object (&priv->tls_database);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/soup-server-connection.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/soup-server-connection.c
Changed
@@ -98,6 +98,7 @@ g_io_stream_close (priv->conn, NULL, NULL); g_signal_handlers_disconnect_by_data (priv->conn, conn); g_clear_object (&priv->conn); + g_clear_object (&priv->initial_msg); g_clear_pointer (&priv->io_data, soup_server_message_io_destroy); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/soup-server-message.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/soup-server-message.c
Changed
@@ -605,9 +605,9 @@ soup_server_message_unpause (SoupServerMessage *msg) { g_return_if_fail (SOUP_IS_SERVER_MESSAGE (msg)); - g_return_if_fail (msg->io_data != NULL); - soup_server_message_io_unpause (msg->io_data, msg); + if (msg->io_data) + soup_server_message_io_unpause (msg->io_data, msg); } gboolean
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/soup-server-private.h -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/soup-server-private.h
Changed
@@ -10,5 +10,6 @@ void soup_server_set_http2_enabled (SoupServer *server, gboolean enabled); +GSList *soup_server_get_clients (SoupServer *server); #endif /* __SOUP_SERVER_PRIVATE_H__ */
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/server/soup-server.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/server/soup-server.c
Changed
@@ -759,6 +759,14 @@ return listeners; } +GSList * +soup_server_get_clients (SoupServer *server) +{ + SoupServerPrivate *priv = soup_server_get_instance_private (server); + + return priv->clients; +} + /* "" was never documented as meaning the same thing as "/", but it * effectively was. We have to special case it now or otherwise it * would match "*" too.
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-client-input-stream.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-client-input-stream.c
Changed
@@ -225,6 +225,7 @@ GSource *source; task = g_task_new (stream, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_client_input_stream_close_async); g_task_set_priority (task, priority); if (close_async_ready (priv->msg, task) == G_SOURCE_CONTINUE) {
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-connection-manager.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-connection-manager.c
Changed
@@ -33,27 +33,31 @@ typedef struct { GUri *uri; + GMutex *mutex; GHashTable *owner_map; GNetworkAddress *addr; GList *conns; guint num_conns; + GMainContext *context; GSource *keep_alive_src; - SoupConnectionManager *conn_manager; } SoupHost; #define HOST_KEEP_ALIVE 5 * 60 * 1000 /* 5 min in msecs */ static SoupHost * -soup_host_new (GUri *uri, - GHashTable *owner_map) +soup_host_new (GUri *uri, + GHashTable *owner_map, + GMutex *mutex, + GMainContext *context) { SoupHost *host; const char *scheme = g_uri_get_scheme (uri); host = g_new0 (SoupHost, 1); host->owner_map = owner_map; + host->mutex = mutex; if (g_strcmp0 (scheme, "http") != 0 && g_strcmp0 (scheme, "https") != 0) { host->uri = soup_uri_copy (uri, SOUP_URI_SCHEME, soup_uri_is_https (uri) ? "https" : "http", @@ -67,6 +71,8 @@ "scheme", g_uri_get_scheme (host->uri), NULL); + host->context = context; + g_hash_table_insert (host->owner_map, host->uri, host); return host; @@ -123,14 +129,20 @@ free_unused_host (gpointer user_data) { SoupHost *host = (SoupHost *)user_data; + GMutex *mutex = host->mutex; - if (host->conns) - return FALSE; + g_mutex_lock (mutex); - /* This will free the host in addition to removing it from the hash table */ - g_hash_table_remove (host->owner_map, host->uri); + g_clear_pointer (&host->keep_alive_src, g_source_unref); - return FALSE; + if (!host->conns) { + /* This will free the host in addition to removing it from the hash table */ + g_hash_table_remove (host->owner_map, host->uri); + } + + g_mutex_unlock (mutex); + + return G_SOURCE_REMOVE; } static void @@ -160,7 +172,7 @@ */ if (host->num_conns == 0) { g_assert (host->keep_alive_src == NULL); - host->keep_alive_src = soup_add_timeout (g_main_context_get_thread_default (), + host->keep_alive_src = soup_add_timeout (host->context, HOST_KEEP_ALIVE, free_unused_host, host); @@ -172,17 +184,48 @@ SoupMessage *msg) { GUri *uri = soup_message_get_uri (msg); - SoupHost *host; GHashTable *map; map = soup_uri_is_https (uri) ? manager->https_hosts : manager->http_hosts; + return g_hash_table_lookup (map, uri); +} + +static SoupHost * +soup_connection_manager_get_or_create_host_for_item (SoupConnectionManager *manager, + SoupMessageQueueItem *item) +{ + GUri *uri = soup_message_get_uri (item->msg); + GHashTable *map; + SoupHost *host; + + map = soup_uri_is_https (uri) ? manager->https_hosts : manager->http_hosts; host = g_hash_table_lookup (map, uri); if (!host) - host = soup_host_new (uri, map); + host = soup_host_new (uri, map, &manager->mutex, soup_session_get_context (item->session)); return host; } +static void +soup_connection_manager_drop_connection (SoupConnectionManager *manager, + SoupConnection *conn) +{ + g_signal_handlers_disconnect_by_data (conn, manager); + manager->num_conns--; + g_object_unref (conn); + + g_cond_broadcast (&manager->cond); +} + +static void +remove_connection (gpointer key, + gpointer value, + gpointer user_data) +{ + SoupConnectionManager *manager = user_data; + soup_connection_manager_drop_connection (manager, key); +} + SoupConnectionManager * soup_connection_manager_new (SoupSession *session, guint max_conns, @@ -212,6 +255,9 @@ void soup_connection_manager_free (SoupConnectionManager *manager) { + g_hash_table_foreach (manager->conns, remove_connection, manager); + g_assert (manager->num_conns == 0); + g_clear_object (&manager->remote_connectable); g_hash_table_destroy (manager->http_hosts); g_hash_table_destroy (manager->https_hosts); @@ -271,17 +317,6 @@ } static void -soup_connection_manager_drop_connection (SoupConnectionManager *manager, - SoupConnection *conn) -{ - g_signal_handlers_disconnect_by_data (conn, manager); - manager->num_conns--; - g_object_unref (conn); - - g_cond_broadcast (&manager->cond); -} - -static void soup_connection_list_disconnect_all (GList *conns) { GList *c; @@ -355,6 +390,7 @@ soup_connection_manager_get_connection_locked (SoupConnectionManager *manager, SoupMessageQueueItem *item) { + static int env_force_http1 = -1; SoupMessage *msg = item->msg; gboolean need_new_connection; SoupConnection *conn; @@ -365,15 +401,18 @@ GSocketConnectable *remote_connectable; gboolean try_cleanup = TRUE; + if (env_force_http1 == -1) + env_force_http1 = g_getenv ("SOUP_FORCE_HTTP1") != NULL ? 1 : 0; + need_new_connection = (soup_message_query_flags (msg, SOUP_MESSAGE_NEW_CONNECTION)) || (soup_message_is_misdirected_retry (msg)) || (!soup_message_query_flags (msg, SOUP_MESSAGE_IDEMPOTENT) && !SOUP_METHOD_IS_IDEMPOTENT (soup_message_get_method (msg))); - host = soup_connection_manager_get_host_for_message (manager, msg); + host = soup_connection_manager_get_or_create_host_for_item (manager, item); - force_http_version = g_getenv ("SOUP_FORCE_HTTP1") ? SOUP_HTTP_1_1 : soup_message_get_force_http_version (msg); + force_http_version = env_force_http1 ? SOUP_HTTP_1_1 : soup_message_get_force_http_version (msg); while (TRUE) { for (l = host->conns; l && l->data; l = g_list_next (l)) { SoupHTTPVersion http_version;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-connection.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-connection.c
Changed
@@ -48,6 +48,9 @@ GCancellable *cancellable; GThread *owner; + + int window_size; + int stream_window_size; } SoupConnectionPrivate; G_DEFINE_FINAL_TYPE_WITH_PRIVATE (SoupConnection, soup_connection, G_TYPE_OBJECT) @@ -91,6 +94,9 @@ */ #define SOUP_CONNECTION_UNUSED_TIMEOUT 3 +#define HTTP2_INITIAL_WINDOW_SIZE (15 * 1024 * 1024) /* 15MB */ +#define HTTP2_INITIAL_STREAM_WINDOW_SIZE (6 * 1024 * 1024) /* 6MB */ + static void soup_connection_init (SoupConnection *conn) { @@ -99,6 +105,8 @@ priv->http_version = SOUP_HTTP_1_1; priv->force_http_version = G_MAXUINT8; priv->owner = g_thread_self (); + priv->window_size = HTTP2_INITIAL_WINDOW_SIZE; + priv->stream_window_size = HTTP2_INITIAL_STREAM_WINDOW_SIZE; } static void @@ -170,7 +178,11 @@ case PROP_CONTEXT: priv->idle_timeout_src = g_timeout_source_new (0); g_source_set_ready_time (priv->idle_timeout_src, -1); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->idle_timeout_src, "Soup connection idle timeout"); +#else g_source_set_name (priv->idle_timeout_src, "Soup connection idle timeout"); +#endif g_source_set_callback (priv->idle_timeout_src, idle_timeout, object, NULL); g_source_attach (priv->idle_timeout_src, g_value_get_pointer (value)); break; @@ -794,6 +806,7 @@ priv->cancellable = cancellable ? g_object_ref (cancellable) : g_cancellable_new (); task = g_task_new (conn, priv->cancellable, callback, user_data); + g_task_set_source_tag (task, soup_connection_connect_async); g_task_set_priority (task, io_priority); client = new_socket_client (conn); @@ -919,6 +932,7 @@ priv->cancellable = cancellable ? g_object_ref (cancellable) : g_cancellable_new (); task = g_task_new (conn, priv->cancellable, callback, user_data); + g_task_set_source_tag (task, soup_connection_tunnel_handshake_async); g_task_set_priority (task, io_priority); tls_connection = new_tls_connection (conn, G_SOCKET_CONNECTION (priv->connection), &error); @@ -1377,3 +1391,37 @@ return priv->owner; } + +void +soup_connection_set_http2_initial_window_size (SoupConnection *conn, + int window_size) +{ + SoupConnectionPrivate *priv = soup_connection_get_instance_private (conn); + + priv->window_size = window_size; +} + +int +soup_connection_get_http2_initial_window_size (SoupConnection *conn) +{ + SoupConnectionPrivate *priv = soup_connection_get_instance_private (conn); + + return priv->window_size; +} + +void +soup_connection_set_http2_initial_stream_window_size (SoupConnection *conn, + int window_size) +{ + SoupConnectionPrivate *priv = soup_connection_get_instance_private (conn); + + priv->stream_window_size = window_size; +} + +int +soup_connection_get_http2_initial_stream_window_size (SoupConnection *conn) +{ + SoupConnectionPrivate *priv = soup_connection_get_instance_private (conn); + + return priv->stream_window_size; +}
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-connection.h -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-connection.h
Changed
@@ -87,6 +87,13 @@ gboolean soup_connection_is_reusable (SoupConnection *conn); GThread *soup_connection_get_owner (SoupConnection *conn); +void soup_connection_set_http2_initial_window_size (SoupConnection *conn, + int window_size); +int soup_connection_get_http2_initial_window_size (SoupConnection *conn); +void soup_connection_set_http2_initial_stream_window_size (SoupConnection *conn, + int window_size); +int soup_connection_get_http2_initial_stream_window_size (SoupConnection *conn); + G_END_DECLS #endif /* __SOUP_CONNECTION_H__ */
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-headers.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-headers.c
Changed
@@ -902,7 +902,7 @@ g_string_append (string, name); g_string_append (string, "*=UTF-8''"); - encoded = g_uri_escape_string (value, "*'%()<>@,;:\\\"/?=", FALSE); + encoded = g_uri_escape_string (value, "!#$&+-.^_`|~", FALSE); g_string_append (string, encoded); g_free (encoded); } @@ -986,7 +986,7 @@ * soup_header_g_string_append_param: * @string: a #GString being used to construct an HTTP header value * @name: a parameter name - * @value: a parameter value, or %NULL + * @value: (nullable): a parameter value, or %NULL * * Appends something like `name=value` to @string, taking care to quote @value * if needed, and if so, to escape any quotes or backslashes in @value.
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-io-stream.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-io-stream.c
Changed
@@ -178,6 +178,7 @@ SoupIOStreamPrivate *priv = soup_io_stream_get_instance_private (siostream); task = g_task_new (stream, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_io_stream_close_async); g_io_stream_close_async (priv->base_iostream, io_priority, cancellable, close_async_complete, task);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-message-metrics.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-message-metrics.c
Changed
@@ -25,7 +25,7 @@ * An event can be 0 because it hasn't happened yet, because it's optional or * because the load failed before the event reached. * - * Size metrics are expressed in bytes and aree updated while the class@Message is + * Size metrics are expressed in bytes and are updated while the class@Message is * being loaded. You can connect to different class@Message signals to get the * final result of every value. */
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-message-private.h -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-message-private.h
Changed
@@ -80,6 +80,8 @@ void soup_message_wrote_body (SoupMessage *msg); void soup_message_got_informational (SoupMessage *msg); void soup_message_got_headers (SoupMessage *msg); +void soup_message_got_body_data (SoupMessage *msg, + gsize chunk_size); void soup_message_got_body (SoupMessage *msg); void soup_message_content_sniffed (SoupMessage *msg, const char *content_type,
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-message.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-message.c
Changed
@@ -111,6 +111,7 @@ GOT_INFORMATIONAL, GOT_HEADERS, + GOT_BODY_DATA, GOT_BODY, CONTENT_SNIFFED, @@ -436,6 +437,26 @@ NULL, G_TYPE_NONE, 0); + /** + * SoupMessage::got-body-data: + * @msg: the message + * @chunk_size: the number of bytes read + * + * Emitted after reading a portion of the message + * body from the network. + * + * Since: 3.4 + */ + signalsGOT_BODY_DATA = + g_signal_new ("got-body-data", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + NULL, + G_TYPE_NONE, 1, + G_TYPE_UINT); + /** * SoupMessage::got-body: * @msg: the message @@ -955,7 +976,7 @@ uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, NULL); if (!uri) return NULL; - if (!g_uri_get_host (uri)) { + if (!SOUP_URI_IS_VALID (uri)) { g_uri_unref (uri); return NULL; } @@ -1213,6 +1234,13 @@ } void +soup_message_got_body_data (SoupMessage *msg, + gsize chunk_size) +{ + g_signal_emit (msg, signalsGOT_BODY_DATA, 0, chunk_size); +} + +void soup_message_got_body (SoupMessage *msg) { g_signal_emit (msg, signalsGOT_BODY, 0); @@ -3288,3 +3316,42 @@ return priv->is_misdirected_retry; } + +/** + * soup_message_set_force_http1: + * @msg: The #SoupMessage + * @value: value to set + * + * Sets whether HTTP/1 version should be used when sending this message. + * Some connections can still override it, if needed. + * + * Note the value is unset after the message send is finished. + * + * Since: 3.4 + */ +void +soup_message_set_force_http1 (SoupMessage *msg, + gboolean value) +{ + g_return_if_fail (SOUP_IS_MESSAGE (msg)); + + soup_message_set_force_http_version (msg, value ? SOUP_HTTP_1_1 : G_MAXUINT8); +} + +/** + * soup_message_get_force_http1: + * @msg: The #SoupMessage + * + * Returns whether HTTP/1 version is currently demanded for the @msg send. + * + * Returns: %TRUE, when HTTP/1 is demanded, %FALSE otherwise. + * + * Since: 3.4 + */ +gboolean +soup_message_get_force_http1 (SoupMessage *msg) +{ + g_return_val_if_fail (SOUP_IS_MESSAGE (msg), FALSE); + + return soup_message_get_force_http_version (msg) == SOUP_HTTP_1_1; +}
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-message.h -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-message.h
Changed
@@ -195,5 +195,10 @@ SOUP_AVAILABLE_IN_ALL SoupMessageMetrics *soup_message_get_metrics (SoupMessage *msg); +SOUP_AVAILABLE_IN_3_4 +void soup_message_set_force_http1 (SoupMessage *msg, + gboolean value); +SOUP_AVAILABLE_IN_3_4 +gboolean soup_message_get_force_http1 (SoupMessage *msg); G_END_DECLS
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-misc.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-misc.c
Changed
@@ -61,6 +61,11 @@ { GSource *source = g_idle_source_new (); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (source, "SoupCompletion"); +#else + g_source_set_name (source, "SoupCompletion"); +#endif g_source_set_priority (source, G_PRIORITY_DEFAULT); g_source_set_callback (source, function, data, dnotify); g_source_attach (source, async_context); @@ -109,6 +114,11 @@ GSourceFunc function, gpointer data) { GSource *source = g_timeout_source_new (interval); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (source, "SoupTimeout"); +#else + g_source_set_name (source, "SoupTimeout"); +#endif g_source_set_callback (source, function, data, NULL); g_source_attach (source, async_context); return source;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-multipart-input-stream.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-multipart-input-stream.c
Changed
@@ -539,6 +539,7 @@ g_return_if_fail (SOUP_IS_MULTIPART_INPUT_STREAM (multipart)); task = g_task_new (multipart, cancellable, callback, data); + g_task_set_source_tag (task, soup_multipart_input_stream_next_part_async); g_task_set_priority (task, io_priority); if (!g_input_stream_set_pending (stream, &error)) {
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-multipart.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-multipart.c
Changed
@@ -330,8 +330,8 @@ * soup_multipart_append_form_file: * @multipart: a multipart (presumably of type "multipart/form-data") * @control_name: the name of the control associated with this file - * @filename: the name of the file, or %NULL if not known - * @content_type: the MIME type of the file, or %NULL if not known + * @filename: (nullable): the name of the file, or %NULL if not known + * @content_type: (nullable): the MIME type of the file, or %NULL if not known * @body: the file data * * Adds a new MIME part containing @body to @multipart
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-session.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-session.c
Changed
@@ -1198,7 +1198,7 @@ * request, then @msg will be modified accordingly. * * If @msg has already been redirected too many times, this will - * cause it to fail with %SOUP_STATUS_TOO_MANY_REDIRECTS. + * cause it to fail with %SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS. * * Returns: %TRUE if a redirection was applied, %FALSE if not * (eg, because there was no Location header, or it could not be @@ -1471,9 +1471,7 @@ if (item->state != SOUP_MESSAGE_RESTARTING) { item->state = SOUP_MESSAGE_FINISHING; - - if (!item->async) - soup_session_process_queue_item (item->session, item, TRUE); + soup_session_process_queue_item (item->session, item, !item->async); } } @@ -3037,6 +3035,7 @@ SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE, _("Message is already in session queue")); task = g_task_new (session, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_session_return_error_if_message_already_in_queue); g_task_set_task_data (task, item, (GDestroyNotify)soup_message_queue_item_unref); g_task_return_error (task, g_error_copy (item->error)); g_object_unref (task); @@ -3085,6 +3084,7 @@ G_CALLBACK (async_send_request_finished), item); item->task = g_task_new (session, item->cancellable, callback, user_data); + g_task_set_source_tag (item->task, soup_session_send_async); g_task_set_priority (item->task, io_priority); g_task_set_task_data (item->task, item, (GDestroyNotify) soup_message_queue_item_unref); if (async_respond_from_cache (session, item)) @@ -3272,54 +3272,28 @@ } static void -send_and_read_splice_ready_cb (GOutputStream *ostream, - GAsyncResult *result, - GTask *task) -{ - GError *error = NULL; - - if (g_output_stream_splice_finish (ostream, result, &error) != -1) { - g_task_return_pointer (task, - g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (ostream)), - (GDestroyNotify)g_bytes_unref); - } else { - g_task_return_error (task, error); - } - g_object_unref (task); -} - -static void -send_and_read_stream_ready_cb (SoupSession *session, +send_and_read_splice_ready_cb (SoupSession *session, GAsyncResult *result, GTask *task) { - GInputStream *stream; GOutputStream *ostream; GError *error = NULL; + ostream = g_task_get_task_data (task); + // In order for soup_session_get_async_result_message() to work it must // have the task data for the task it wrapped SoupMessageQueueItem *item = g_task_get_task_data (G_TASK (result)); g_task_set_task_data (task, soup_message_queue_item_ref (item), (GDestroyNotify)soup_message_queue_item_unref); - stream = soup_session_send_finish (session, result, &error); - if (!stream) { - g_task_return_error (task, error); - g_object_unref (task); - return; - } - - ostream = g_memory_output_stream_new_resizable (); - g_output_stream_splice_async (ostream, - stream, - G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | - G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - g_task_get_priority (task), - g_task_get_cancellable (task), - (GAsyncReadyCallback)send_and_read_splice_ready_cb, - task); - g_object_unref (ostream); - g_object_unref (stream); + if (soup_session_send_and_splice_finish (session, result, &error) != -1) { + g_task_return_pointer (task, + g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (ostream)), + (GDestroyNotify)g_bytes_unref); + } else { + g_task_return_error (task, error); + } + g_object_unref (task); } /** @@ -3350,18 +3324,24 @@ gpointer user_data) { GTask *task; + GOutputStream *ostream; g_return_if_fail (SOUP_IS_SESSION (session)); g_return_if_fail (SOUP_IS_MESSAGE (msg)); + ostream = g_memory_output_stream_new_resizable (); task = g_task_new (session, cancellable, callback, user_data); + g_task_set_source_tag (task, soup_session_send_and_read_async); g_task_set_priority (task, io_priority); + g_task_set_task_data (task, ostream, g_object_unref); - soup_session_send_async (session, msg, - g_task_get_priority (task), - g_task_get_cancellable (task), - (GAsyncReadyCallback)send_and_read_stream_ready_cb, - task); + soup_session_send_and_splice_async (session, msg, ostream, + G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | + G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, + g_task_get_priority (task), + g_task_get_cancellable (task), + (GAsyncReadyCallback)send_and_read_splice_ready_cb, + task); } /** @@ -3410,28 +3390,194 @@ GCancellable *cancellable, GError **error) { - GInputStream *stream; GOutputStream *ostream; GBytes *bytes = NULL; - stream = soup_session_send (session, msg, cancellable, error); - if (!stream) - return NULL; - - ostream = g_memory_output_stream_new_resizable (); - if (g_output_stream_splice (ostream, - stream, - G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | - G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, - cancellable, error) != -1) { - bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (ostream)); - } - g_object_unref (ostream); - g_object_unref (stream); + ostream = g_memory_output_stream_new_resizable (); + if (soup_session_send_and_splice (session, msg, ostream, + G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | + G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, + cancellable, error) != -1) + bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (ostream)); + g_object_unref (ostream); return bytes; } +typedef struct { + GOutputStream *out_stream; + GOutputStreamSpliceFlags flags; + GTask *task; +} SendAndSpliceAsyncData; + +static void +send_and_splice_async_data_free (SendAndSpliceAsyncData *data) +{ + g_clear_object (&data->out_stream); + g_clear_object (&data->task); + + g_free (data); +} + +static void +send_and_splice_ready_cb (GOutputStream *ostream, + GAsyncResult *result, + GTask *task) +{ + GError *error = NULL; + gssize retval; + + retval = g_output_stream_splice_finish (ostream, result, &error); + if (retval != -1) + g_task_return_int (task, retval); + else + g_task_return_error (task, error); + g_object_unref (task); +} + +static void +send_and_splice_stream_ready_cb (SoupSession *session, + GAsyncResult *result, + SendAndSpliceAsyncData *data) +{ + GInputStream *stream; + GTask *task; + GError *error = NULL; + + // In order for soup_session_get_async_result_message() to work it must + // have the task data for the task it wrapped + SoupMessageQueueItem *item = g_task_get_task_data (G_TASK (result)); + g_task_set_task_data (data->task, soup_message_queue_item_ref (item), (GDestroyNotify)soup_message_queue_item_unref); + + stream = soup_session_send_finish (session, result, &error); + if (!stream) { + g_task_return_error (data->task, error); + send_and_splice_async_data_free (data); + return; + } + + task = g_steal_pointer (&data->task); + g_output_stream_splice_async (data->out_stream, stream, data->flags, + g_task_get_priority (task), + g_task_get_cancellable (task), + (GAsyncReadyCallback)send_and_splice_ready_cb, + task); + g_object_unref (stream); + send_and_splice_async_data_free (data); +} + +/** + * soup_session_send_and_splice_async: + * @session: a #SoupSession + * @msg: (transfer none): a #SoupMessage + * @out_stream: (transfer none): a #GOutputStream + * @flags: a set of #GOutputStreamSpliceFlags + * @io_priority: the I/O priority of the request + * @cancellable: (nullable): a #GCancellable + * @callback: (scope async): the callback to invoke + * @user_data: data for @callback + * + * Asynchronously sends @msg and splices the response body stream into @out_stream. + * When @callback is called, then either @msg has been sent and its response body + * spliced, or else an error has occurred. + * + * See method@Session.send for more details on the general semantics. + * + * Since: 3.4 + */ +void +soup_session_send_and_splice_async (SoupSession *session, + SoupMessage *msg, + GOutputStream *out_stream, + GOutputStreamSpliceFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + SendAndSpliceAsyncData *data; + + g_return_if_fail (SOUP_IS_SESSION (session)); + g_return_if_fail (SOUP_IS_MESSAGE (msg)); + g_return_if_fail (G_IS_OUTPUT_STREAM (out_stream)); + + data = g_new (SendAndSpliceAsyncData, 1); + data->out_stream = g_object_ref (out_stream); + data->flags = flags; + data->task = g_task_new (session, cancellable, callback, user_data); + g_task_set_source_tag (data->task, soup_session_send_and_splice_async); + g_task_set_priority (data->task, io_priority); + + soup_session_send_async (session, msg, + g_task_get_priority (data->task), + g_task_get_cancellable (data->task), + (GAsyncReadyCallback)send_and_splice_stream_ready_cb, + data); +} + +/** + * soup_session_send_and_splice_finish: + * @session: a #SoupSession + * @result: the #GAsyncResult passed to your callback + * @error: return location for a #GError, or %NULL + * + * Gets the response to a method@Session.send_and_splice_async. + * + * Returns: a #gssize containing the size of the data spliced, or -1 if an error occurred. + * + * Since: 3.4 + */ +gssize +soup_session_send_and_splice_finish (SoupSession *session, + GAsyncResult *result, + GError **error) +{ + g_return_val_if_fail (SOUP_IS_SESSION (session), -1); + g_return_val_if_fail (g_task_is_valid (result, session), -1); + + return g_task_propagate_int (G_TASK (result), error); +} + +/** + * soup_session_send_and_splice: + * @session: a #SoupSession + * @msg: (transfer none): a #SoupMessage + * @out_stream: (transfer none): a #GOutputStream + * @flags: a set of #GOutputStreamSpliceFlags + * @cancellable: (nullable): a #GCancellable + * @error: return location for a #GError, or %NULL + * + * Synchronously sends @msg and splices the response body stream into @out_stream. + * + * See method@Session.send for more details on the general semantics. + * + * Returns: a #gssize containing the size of the data spliced, or -1 if an error occurred. + * + * Since: 3.4 + */ +gssize +soup_session_send_and_splice (SoupSession *session, + SoupMessage *msg, + GOutputStream *out_stream, + GOutputStreamSpliceFlags flags, + GCancellable *cancellable, + GError **error) +{ + GInputStream *stream; + gssize retval; + + g_return_val_if_fail (G_IS_OUTPUT_STREAM (out_stream), -1); + + stream = soup_session_send (session, msg, cancellable, error); + if (!stream) + return -1; + + retval = g_output_stream_splice (out_stream, stream, flags, cancellable, error); + g_object_unref (stream); + + return retval; +} + /** * soup_session_get_async_result_message: * @session: a #SoupSession @@ -3499,8 +3645,6 @@ return soup_websocket_extension_manager_get_supported_extensions (SOUP_WEBSOCKET_EXTENSION_MANAGER (extension_manager)); } -static void websocket_connect_async_stop (SoupMessage *msg, gpointer user_data); - static void websocket_connect_async_complete (SoupMessage *msg, gpointer user_data) { @@ -3533,11 +3677,10 @@ GList *accepted_extensions = NULL; GError *error = NULL; - g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, task); - supported_extensions = soup_session_get_supported_websocket_extensions_for_message (session, msg); if (soup_websocket_client_verify_handshake (item->msg, supported_extensions, &accepted_extensions, &error)) { + g_signal_handlers_disconnect_matched (msg, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, task); stream = soup_session_steal_connection (item->session, item->msg); client = soup_websocket_connection_new (stream, soup_message_get_uri (item->msg), @@ -3552,9 +3695,9 @@ return; } - soup_message_io_finished (item->msg); - g_task_return_error (task, error); - g_object_unref (task); + g_assert (!item->error); + item->error = error; + soup_message_io_finished (item->msg); } /** @@ -3627,6 +3770,7 @@ item->io_priority = io_priority; task = g_task_new (session, item->cancellable, callback, user_data); + g_task_set_source_tag (task, soup_session_websocket_connect_async); g_task_set_task_data (task, item, (GDestroyNotify) soup_message_queue_item_unref); soup_message_add_status_code_handler (msg, "got-informational", @@ -3737,6 +3881,7 @@ soup_message_set_is_preconnect (msg, TRUE); task = g_task_new (session, item->cancellable, callback, user_data); + g_task_set_source_tag (task, soup_session_preconnect_async); g_task_set_priority (task, io_priority); g_task_set_task_data (task, item, (GDestroyNotify)soup_message_queue_item_unref);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-session.h -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-session.h
Changed
@@ -166,6 +166,29 @@ GCancellable *cancellable, GError **error); +SOUP_AVAILABLE_IN_3_4 +void soup_session_send_and_splice_async(SoupSession *session, + SoupMessage *msg, + GOutputStream *out_stream, + GOutputStreamSpliceFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +SOUP_AVAILABLE_IN_3_4 +gssize soup_session_send_and_splice_finish(SoupSession *session, + GAsyncResult *result, + GError **error); + +SOUP_AVAILABLE_IN_3_4 +gssize soup_session_send_and_splice (SoupSession *session, + SoupMessage *msg, + GOutputStream *out_stream, + GOutputStreamSpliceFlags flags, + GCancellable *cancellable, + GError **error); + SOUP_AVAILABLE_IN_ALL SoupMessage *soup_session_get_async_result_message (SoupSession *session, GAsyncResult *result);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/soup-uri-utils.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/soup-uri-utils.c
Changed
@@ -363,6 +363,26 @@ * the URI that should be updated with the given values. */ +static int +get_maybe_default_port (GUri *uri) +{ + const char *scheme = g_uri_get_scheme (uri); + int port = g_uri_get_port (uri); + + switch (port) { + case 80: + if (!strcmp (scheme, "http") || !strcmp (scheme, "ws")) + return -1; + break; + case 443: + if (!strcmp (scheme, "https") || !strcmp (scheme, "wss")) + return -1; + break; + } + + return port; +} + /** * soup_uri_copy: (skip) * @uri: the #GUri to copy @@ -370,6 +390,11 @@ * @...: value of @first_component followed by additional * components and values, terminated by %SOUP_URI_NONE * + * As of 3.4.0 this will detect the default ports of HTTP(s) and WS(S) + * URIs when copying and set it to the default port of the new scheme. + * So for example copying `http://localhost:80` while changing the scheme to https + * will result in `https://localhost:443`. + * * Return a copy of @uri with the given components updated. * * Returns: (transfer full): a new #GUri @@ -417,7 +442,7 @@ values_to_setSOUP_URI_PASSWORD ? valuesSOUP_URI_PASSWORD : g_uri_get_password (uri), values_to_setSOUP_URI_AUTH_PARAMS ? valuesSOUP_URI_AUTH_PARAMS : g_uri_get_auth_params (uri), values_to_setSOUP_URI_HOST ? valuesSOUP_URI_HOST : g_uri_get_host (uri), - values_to_setSOUP_URI_PORT ? GPOINTER_TO_INT (valuesSOUP_URI_PORT) : g_uri_get_port (uri), + values_to_setSOUP_URI_PORT ? GPOINTER_TO_INT (valuesSOUP_URI_PORT) : get_maybe_default_port (uri), values_to_setSOUP_URI_PATH ? valuesSOUP_URI_PATH : g_uri_get_path (uri), values_to_setSOUP_URI_QUERY ? valuesSOUP_URI_QUERY : g_uri_get_query (uri), values_to_setSOUP_URI_FRAGMENT ? valuesSOUP_URI_FRAGMENT : g_uri_get_fragment (uri)
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/websocket/soup-websocket-connection.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/websocket/soup-websocket-connection.c
Changed
@@ -299,6 +299,11 @@ return; priv->input_source = g_pollable_input_stream_create_source (priv->input, NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->input_source, "SoupWebsocketConnection input"); +#else + g_source_set_name (priv->input_source, "SoupWebsocketConnection input"); +#endif g_source_set_callback (priv->input_source, (GSourceFunc)on_web_socket_input, self, NULL); g_source_attach (priv->input_source, g_main_context_get_thread_default ()); } @@ -325,6 +330,11 @@ return; priv->output_source = g_pollable_output_stream_create_source (priv->output, NULL); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->output_source, "SoupWebsocketConnection output"); +#else + g_source_set_name (priv->output_source, "SoupWebsocketConnection output"); +#endif g_source_set_callback (priv->output_source, (GSourceFunc)on_web_socket_output, self, NULL); g_source_attach (priv->output_source, g_main_context_get_thread_default ()); } @@ -437,6 +447,11 @@ g_debug ("waiting %d seconds for peer to close io", timeout); priv->close_timeout = g_timeout_source_new_seconds (timeout); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->close_timeout, "SoupWebsocketConnection close timeout"); +#else + g_source_set_name (priv->close_timeout, "SoupWebsocketConnection close timeout"); +#endif g_source_set_callback (priv->close_timeout, on_timeout_close_io, self, NULL); g_source_attach (priv->close_timeout, g_main_context_get_thread_default ()); } @@ -2153,6 +2168,11 @@ if (interval > 0) { priv->keepalive_timeout = g_timeout_source_new_seconds (interval); +#if GLIB_CHECK_VERSION(2, 70, 0) + g_source_set_static_name (priv->keepalive_timeout, "SoupWebsocketConnection keepalive timeout"); +#else + g_source_set_name (priv->keepalive_timeout, "SoupWebsocketConnection keepalive timeout"); +#endif g_source_set_callback (priv->keepalive_timeout, on_queue_ping, self, NULL); g_source_attach (priv->keepalive_timeout, g_main_context_get_thread_default ()); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/libsoup/websocket/soup-websocket.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/libsoup/websocket/soup-websocket.c
Changed
@@ -209,7 +209,7 @@ client_protocols = g_strsplit_set (client_protocols_str, ", ", -1); if (!client_protocols || !client_protocols0) { g_strfreev (client_protocols); - return TRUE; + return FALSE; } for (i = 0; server_protocolsi != NULL; i++) { @@ -273,12 +273,13 @@ if (origin) soup_message_headers_replace_common (soup_message_get_request_headers (msg), SOUP_HEADER_ORIGIN, origin); - if (protocols) { + if (protocols && *protocols) { char *protocols_str; protocols_str = g_strjoinv (", ", protocols); - soup_message_headers_replace_common (soup_message_get_request_headers (msg), - SOUP_HEADER_SEC_WEBSOCKET_PROTOCOL, protocols_str); + if (*protocols_str) + soup_message_headers_replace_common (soup_message_get_request_headers (msg), + SOUP_HEADER_SEC_WEBSOCKET_PROTOCOL, protocols_str); g_free (protocols_str); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/meson.build -> _service:tar_scm:libsoup-3.4.4.tar.xz/meson.build
Changed
@@ -1,5 +1,5 @@ project('libsoup', 'c', - version: '3.2.2', + version: '3.4.4', meson_version : '>= 0.54', license : 'LGPL-2.0-or-later', default_options : @@ -18,7 +18,7 @@ # - If binary compatibility has been broken (eg removed or changed interfaces) # change to C+1, 0, 0 # - If the interface is the same as the previous version, use C, R+1, A. -soup_version_info = 6, 0, 6 +soup_version_info = 7, 1, 7 # Turn C, R, A into an actual usable *soversion*. soup_soversion_major = soup_version_info0 - soup_version_info2 # Current-Age @@ -113,7 +113,7 @@ cdata = configuration_data() libnghttp2_dep = dependency('libnghttp2') -if cc.has_function('nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation', prefix : '#include <nghttp2/nghttp2.h>', dependencies : libnghttp2_dep) +if (libnghttp2_dep.version() == 'unknown' and (libnghttp2_dep.type_name() == 'internal' or cc.has_function('nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation', prefix : '#include <nghttp2/nghttp2.h>', dependencies : libnghttp2_dep))) or libnghttp2_dep.version().version_compare('>=1.50') cdata.set('HAVE_NGHTTP2_OPTION_SET_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION', '1') endif
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/po/be.po -> _service:tar_scm:libsoup-3.4.4.tar.xz/po/be.po
Changed
@@ -1,17 +1,18 @@ msgid "" msgstr "" -"Project-Id-Version: 98e6872775a91bf27122ff608b6db605\n" +"Project-Id-Version: libsoup master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/libsoup/issues\n" -"POT-Creation-Date: 2020-12-28 13:11+0000\n" -"PO-Revision-Date: 2020-12-28 13:37\n" -"Last-Translator: Stephan Woidowski <swoidowski@t-online.de>\n" +"POT-Creation-Date: 2022-10-12 07:32+0000\n" +"PO-Revision-Date: 2023-01-23 21:29+0300\n" +"Last-Translator: Yuras Shumovich <shumovichy@gmail.com>\n" "Language-Team: Belarusian\n" "Language: be_BY\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || n%10>=5 && n%10<=9 || n%100>=11 && n%100<=14 ? 2 : 3);\n" -"X-Generator: Poedit 2.4.1\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Generator: Poedit 3.2.2\n" "X-Project-Style: gnome\n" "X-Crowdin-Project: 98e6872775a91bf27122ff608b6db605\n" "X-Crowdin-Project-ID: 2\n" @@ -19,183 +20,196 @@ "X-Crowdin-File: /Gnome 4.0/libsoup.master.be.po\n" "X-Crowdin-File-ID: 2270\n" -#: libsoup/cache/soup-cache-input-stream.c:79 +#: libsoup/cache/soup-cache-input-stream.c:70 msgid "Network stream unexpectedly closed" msgstr "Сеткавы струмень нечакана закрыўся" -#: libsoup/cache/soup-cache-input-stream.c:295 +#: libsoup/cache/soup-cache-input-stream.c:252 msgid "Failed to completely cache the resource" -msgstr "Не атрымалася цалкам размясціць рэсурс у кэшы" +msgstr "Не ўдалося цалкам размясціць рэсурс у кэшы" -#: libsoup/content-decoder/soup-converter-wrapper.c:193 +#: libsoup/content-decoder/soup-converter-wrapper.c:197 #, c-format msgid "Output buffer is too small" -msgstr "Выходны буфер занадта малы" - -#: libsoup/server/soup-server.c:1166 -msgid "Can’t create a TLS server without a TLS certificate" -msgstr "Немагчыма стварыць сервер TLS без сертыфіката TLS" - -#: libsoup/server/soup-server.c:1185 -#, c-format -msgid "Could not listen on address %s, port %d: " -msgstr "Не атрымалася праслухаць адрас %s, порт %d: " - -#: libsoup/server/soup-server-io.c:344 libsoup/server/soup-server-io.c:809 -#: libsoup/soup-message-io.c:327 libsoup/soup-message-io.c:726 -msgid "Operation would block" -msgstr "Аперацыя заблакаваная" - -#: libsoup/server/soup-socket.c:116 -msgid "Could not import existing socket: " -msgstr "Не атрымалася імпартаваць існы сокет: " - -#: libsoup/server/soup-socket.c:125 -msgid "Can’t import unconnected socket" -msgstr "Нельга імпартаваць непадлучаны сокет" - -#: libsoup/soup-body-input-stream.c:148 libsoup/soup-body-input-stream.c:180 -#: libsoup/soup-body-input-stream.c:213 libsoup/soup-message-io-data.c:76 +msgstr "Выхадны буфер занадта малы" + +#: libsoup/http1/soup-body-input-stream.c:155 +#: libsoup/http1/soup-body-input-stream.c:187 +#: libsoup/http1/soup-body-input-stream.c:220 +#: libsoup/http1/soup-message-io-data.c:77 +#: libsoup/http2/soup-client-message-io-http2.c:406 +#: libsoup/server/http2/soup-server-message-io-http2.c:420 msgid "Connection terminated unexpectedly" -msgstr "Злучэнне нечакана знішчана" +msgstr "Злучэнне нечакана перарвалася" -#: libsoup/soup-body-input-stream.c:474 +#: libsoup/http1/soup-body-input-stream.c:471 msgid "Invalid seek request" msgstr "Хібны запыт на пошук" -#: libsoup/soup-body-input-stream.c:502 +#: libsoup/http1/soup-body-input-stream.c:499 msgid "Cannot truncate SoupBodyInputStream" msgstr "Немагчыма абрэзаць SoupBodyInputStream" -#: libsoup/soup-message-io.c:467 +#: libsoup/http1/soup-client-message-io-http1.c:321 +#: libsoup/http1/soup-client-message-io-http1.c:762 +#: libsoup/http2/soup-body-input-stream-http2.c:221 +#: libsoup/server/http1/soup-server-message-io-http1.c:416 +#: libsoup/server/http1/soup-server-message-io-http1.c:889 +msgid "Operation would block" +msgstr "Аперацыя заблакавана" + +#: libsoup/http1/soup-client-message-io-http1.c:462 msgid "Could not parse HTTP response" -msgstr "Не атрымалася разабраць адказ HTTP" +msgstr "Не ўдалося разабраць адказ HTTP" -#: libsoup/soup-message-io.c:490 +#: libsoup/http1/soup-client-message-io-http1.c:485 msgid "Unrecognized HTTP response encoding" msgstr "Невядомае кадаванне адказу HTTP" -#: libsoup/soup-message-io.c:687 libsoup/soup-message-io.c:711 +#: libsoup/http1/soup-client-message-io-http1.c:721 +#: libsoup/http1/soup-client-message-io-http1.c:747 +#: libsoup/http2/soup-client-message-io-http2.c:1624 +#: libsoup/http2/soup-client-message-io-http2.c:1650 msgid "Operation was cancelled" -msgstr "Аперацыя была скасаваная" +msgstr "Аперацыя скасавана" -#: libsoup/soup-message-io-data.c:100 +#: libsoup/http1/soup-message-io-data.c:105 msgid "Header too big" msgstr "Загаловак занадта вялікі" -#: libsoup/soup-session.c:788 +#: libsoup/server/soup-listener.c:261 +msgid "Could not import existing socket: " +msgstr "Не ўдалося імпартаваць існы сокет: " + +#: libsoup/server/soup-listener.c:267 +msgid "Can’t import unconnected socket" +msgstr "Нельга імпартаваць непадлучаны сокет" + +#: libsoup/server/soup-server.c:1209 +msgid "Can’t create a TLS server without a TLS certificate" +msgstr "Нельга стварыць сервер TLS без сертыфіката TLS" + +#: libsoup/soup-session.c:1116 msgid "Location header is missing or empty in response headers" -msgstr "Загаловак месцазнаходжання адсутнічае альбо не пазначаны ў загалоўках адказаў" +msgstr "" +"Загаловак месцазнаходжання адсутнічае або не пазначаны ў загалоўках адказаў" -#: libsoup/soup-session.c:804 +#: libsoup/soup-session.c:1130 #, c-format msgid "Invalid URI “%s” in Location response header" -msgstr "Хібны URI “%s” у загалоўку адказу ад месцазнаходжання" +msgstr "Хібны URI «%s» у загалоўку адказу ад месцазнаходжання" -#: libsoup/soup-session.c:824 +#: libsoup/soup-session.c:1150 msgid "Too many redirects" msgstr "Занадта шмат перанакіраванняў" -#: libsoup/soup-session.c:829 +#: libsoup/soup-session.c:1155 msgid "Message was restarted too many times" msgstr "Паведамленне перазапускалася занадта шмат разоў" -#: libsoup/soup-session.c:3258 libsoup/soup-session.c:3391 -#| msgid "Could not parse URI “%s”" -msgid "Could not parse URI “%s”: %s" -msgstr "Не атрымалася разабраць адрас URI \"%s\": %s" - -#: libsoup/soup-session.c:3273 libsoup/soup-session.c:3406 -#, c-format -msgid "Unsupported URI scheme “%s”" -msgstr "Схема URI \"%s\" не падтрымліваецца" - -#: libsoup/soup-session.c:3284 libsoup/soup-session.c:3417 -#, c-format -msgid "Invalid “%s” URI: %s" -msgstr "Хібны адрас URI \"%s\": %s" +#: libsoup/soup-session.c:3014 libsoup/soup-session.c:3162 +msgid "Message is already in session queue" +msgstr "Паведамленне ўжо ў чарзе сеанса" -#: libsoup/soup-session.c:3726 +#: libsoup/soup-session.c:3494 msgid "The server did not accept the WebSocket handshake." msgstr "Сервер не ўхваліў вітанне WebSocket." -#: libsoup/soup-tld.c:146 +#: libsoup/soup-tld.c:129 msgid "No public-suffix list available." msgstr "Не даступна ніводнага спіса публічных суфіксаў." -#: libsoup/soup-tld.c:156 libsoup/soup-tld.c:172 +#: libsoup/soup-tld.c:139 libsoup/soup-tld.c:155 msgid "Invalid hostname" msgstr "Хібная назва хоста" -#: libsoup/soup-tld.c:163 +#: libsoup/soup-tld.c:146 msgid "Hostname is an IP address" msgstr "Назва хоста - адрас IP" -#: libsoup/soup-tld.c:184 +#: libsoup/soup-tld.c:167 msgid "Hostname has no base domain" msgstr "Назва хоста не мае базавага дамена" -#: libsoup/soup-tld.c:192 +#: libsoup/soup-tld.c:175 msgid "Not enough domains" -msgstr "Не стае даменаў" +msgstr "Недастаткова даменаў" -#: libsoup/websocket/soup-websocket.c:405 -#: libsoup/websocket/soup-websocket.c:449 -#: libsoup/websocket/soup-websocket.c:465 +#: libsoup/websocket/soup-websocket.c:390 +#: libsoup/websocket/soup-websocket.c:434 +#: libsoup/websocket/soup-websocket.c:450 msgid "Server requested unsupported extension" -msgstr "Сервер запытаў непадтрымліваемае пашырэнне" +msgstr "Запытанае серверам пашырэнне не падтрымліваецца" -#: libsoup/websocket/soup-websocket.c:428 -#: libsoup/websocket/soup-websocket.c:620 +#: libsoup/websocket/soup-websocket.c:413 +#: libsoup/websocket/soup-websocket.c:605 #, c-format msgid "Incorrect WebSocket “%s” header" -msgstr "Хібны загаловак WebSocket \"%s\"" +msgstr "Хібны загаловак WebSocket «%s»" -#: libsoup/websocket/soup-websocket.c:429 -#: libsoup/websocket/soup-websocket.c:884 +#: libsoup/websocket/soup-websocket.c:414 +#: libsoup/websocket/soup-websocket.c:869 #, c-format msgid "Server returned incorrect “%s” key" -msgstr "Сервер вярнуў хібны ключ \"%s\"" +msgstr "Сервер вярнуў няправільны ключ «%s»" -#: libsoup/websocket/soup-websocket.c:492 +#: libsoup/websocket/soup-websocket.c:477 #, c-format msgid "Duplicated parameter in “%s” WebSocket extension header" -msgstr "Прадубляваны параметр \"%s\" у загалоўку пашырэння WebSocket" +msgstr "Прадубляваны параметр «%s» у загалоўку пашырэння WebSocket" -#: libsoup/websocket/soup-websocket.c:493 +#: libsoup/websocket/soup-websocket.c:478 #, c-format -msgid "Server returned a duplicated parameter in “%s” WebSocket extension header" -msgstr "Сервер вярнуў прадубляваны параметр \"%s\" у загалоўку пашырэння WebSocket" +msgid "" +"Server returned a duplicated parameter in “%s” WebSocket extension header" +msgstr "" +"Сервер вярнуў прадубляваны параметр «%s» у загалоўку пашырэння WebSocket" -#: libsoup/websocket/soup-websocket.c:583 -#: libsoup/websocket/soup-websocket.c:593 +#: libsoup/websocket/soup-websocket.c:568 +#: libsoup/websocket/soup-websocket.c:578 msgid "WebSocket handshake expected" msgstr "Чакаецца вітанне WebSocket" -#: libsoup/websocket/soup-websocket.c:601 +#: libsoup/websocket/soup-websocket.c:586 msgid "Unsupported WebSocket version" msgstr "Версія WebSocket не падтрымліваецца" -#: libsoup/websocket/soup-websocket.c:610 +#: libsoup/websocket/soup-websocket.c:595 msgid "Invalid WebSocket key" msgstr "Хібны ключ WebSocket" -#: libsoup/websocket/soup-websocket.c:629 +#: libsoup/websocket/soup-websocket.c:614 msgid "Unsupported WebSocket subprotocol" msgstr "Падпратакол WebSocket не падтрымліваецца" -#: libsoup/websocket/soup-websocket.c:835 +#: libsoup/websocket/soup-websocket.c:820 msgid "Server rejected WebSocket handshake" msgstr "Сервер адхіліў вітанне WebSocket" -#: libsoup/websocket/soup-websocket.c:843 -#: libsoup/websocket/soup-websocket.c:852 +#: libsoup/websocket/soup-websocket.c:828 +#: libsoup/websocket/soup-websocket.c:837 msgid "Server ignored WebSocket handshake" msgstr "Сервер праігнараваў вітанне WebSocket" -#: libsoup/websocket/soup-websocket.c:864 +#: libsoup/websocket/soup-websocket.c:849 msgid "Server requested unsupported protocol" -msgstr "Сервер запытаў непадтрымліваемы пратакол" +msgstr "Запытаны серверам пратакол не падтрымліваецца" + +#, c-format +#~ msgid "Could not listen on address %s, port %d: " +#~ msgstr "Не атрымалася праслухаць адрас %s, порт %d: " + +#~| msgid "Could not parse URI “%s”" +#~ msgid "Could not parse URI “%s”: %s" +#~ msgstr "Не атрымалася разабраць адрас URI \"%s\": %s" + +#, c-format +#~ msgid "Unsupported URI scheme “%s”" +#~ msgstr "Схема URI \"%s\" не падтрымліваецца" + +#, c-format +#~ msgid "Invalid “%s” URI: %s" +#~ msgstr "Хібны адрас URI \"%s\": %s" #~ msgid "Name" #~ msgstr "Назва" @@ -217,4 +231,3 @@ #~ msgid "Can’t import non-socket as SoupSocket" #~ msgstr "Толькі сокет можна імпартаваць як SoupSocket" -
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/po/bg.po -> _service:tar_scm:libsoup-3.4.4.tar.xz/po/bg.po
Changed
@@ -51,7 +51,7 @@ #: libsoup/http2/soup-body-input-stream-http2.c:221 #: libsoup/server/soup-server-io.c:363 libsoup/server/soup-server-io.c:828 msgid "Operation would block" -msgstr "Операцията ще блокира" +msgstr "Действието ще блокира" #: libsoup/http1/soup-client-message-io-http1.c:456 msgid "Could not parse HTTP response" @@ -66,7 +66,7 @@ #: libsoup/http2/soup-client-message-io-http2.c:1521 #: libsoup/http2/soup-client-message-io-http2.c:1545 msgid "Operation was cancelled" -msgstr "Операцията е отменена" +msgstr "Действието е отменено" #: libsoup/http1/soup-message-io-data.c:105 msgid "Header too big" @@ -120,15 +120,15 @@ #: libsoup/soup-tld.c:152 libsoup/soup-tld.c:168 msgid "Invalid hostname" -msgstr "Неправилно име на машина" +msgstr "Неправилно име на хост" #: libsoup/soup-tld.c:159 msgid "Hostname is an IP address" -msgstr "Името на машината е адрес по IP" +msgstr "Името на хоста е адрес по IP" #: libsoup/soup-tld.c:180 msgid "Hostname has no base domain" -msgstr "Името на машината не съдържа домейн" +msgstr "Името на хоста не съдържа домейн" #: libsoup/soup-tld.c:188 msgid "Not enough domains"
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/po/eo.po -> _service:tar_scm:libsoup-3.4.4.tar.xz/po/eo.po
Changed
@@ -1,180 +1,216 @@ # Esperanto translation for libsoup. # Copyright (C) 2012 Free Software Foundation, Inc. # This file is distributed under the same license as the libsoup package. -# Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>, 2012, 2017. +# Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>, 2012-2023. +# msgid "" msgstr "" "Project-Id-Version: libsoup master\n" -"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?product=libsou" -"p&keywords=I18N+L10N&component=Misc\n" -"POT-Creation-Date: 2017-02-23 10:17+0000\n" -"PO-Revision-Date: 2017-06-11 12:37+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/libsoup/issues\n" +"POT-Creation-Date: 2023-01-25 21:07+0000\n" +"PO-Revision-Date: 2023-09-20 00:03+0200\n" "Last-Translator: Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>\n" "Language-Team: Esperanto <gnome-eo-list@gnome.org>\n" "Language: eo\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Virtaal 0.7.1\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"X-Generator: Gtranslator 42.0\n" "X-Project-Style: gnome\n" -#: ../libsoup/soup-body-input-stream.c:139 -#: ../libsoup/soup-body-input-stream.c:170 -#: ../libsoup/soup-body-input-stream.c:203 ../libsoup/soup-message-io.c:235 +#: libsoup/cache/soup-cache-input-stream.c:70 +msgid "Network stream unexpectedly closed" +msgstr "Reta fluo neatatendite fermiĝis" + +#: libsoup/cache/soup-cache-input-stream.c:252 +msgid "Failed to completely cache the resource" +msgstr "Malsukcesis tute konservi la rimedon en kaŝmemoro" + +#: libsoup/content-decoder/soup-converter-wrapper.c:197 +#, c-format +msgid "Output buffer is too small" +msgstr "La elig-bufro estas tro malgranda" + +#: libsoup/http1/soup-body-input-stream.c:155 +#: libsoup/http1/soup-body-input-stream.c:187 +#: libsoup/http1/soup-body-input-stream.c:220 +#: libsoup/http1/soup-message-io-data.c:77 +#: libsoup/http2/soup-client-message-io-http2.c:408 +#: libsoup/server/http2/soup-server-message-io-http2.c:431 msgid "Connection terminated unexpectedly" msgstr "La konekto estas neatendite fermita" -#: ../libsoup/soup-body-input-stream.c:459 +#: libsoup/http1/soup-body-input-stream.c:471 msgid "Invalid seek request" msgstr "Nevalida serĉ-peto" -#: ../libsoup/soup-body-input-stream.c:487 +#: libsoup/http1/soup-body-input-stream.c:499 msgid "Cannot truncate SoupBodyInputStream" msgstr "Ne eblas trunki SoupBodyInputStream-on" -#: ../libsoup/soup-cache-input-stream.c:76 -msgid "Network stream unexpectedly closed" -msgstr "Reta fluo neatatendite fermiĝis" - -#: ../libsoup/soup-cache-input-stream.c:291 -msgid "Failed to completely cache the resource" -msgstr "" - -#: ../libsoup/soup-converter-wrapper.c:189 -#, c-format -msgid "Output buffer is too small" -msgstr "La elig-bufro estas tro malgranda" +#: libsoup/http1/soup-client-message-io-http1.c:322 +#: libsoup/http1/soup-client-message-io-http1.c:775 +#: libsoup/http2/soup-body-input-stream-http2.c:221 +#: libsoup/server/http1/soup-server-message-io-http1.c:417 +#: libsoup/server/http1/soup-server-message-io-http1.c:890 +msgid "Operation would block" +msgstr "La operacio estus haltigota" -#: ../libsoup/soup-message-client-io.c:41 -#| msgid "Could not parse URI '%s'" +#: libsoup/http1/soup-client-message-io-http1.c:463 msgid "Could not parse HTTP response" msgstr "Ne eblis analizi HTTP-respondon" -#: ../libsoup/soup-message-client-io.c:66 +#: libsoup/http1/soup-client-message-io-http1.c:486 msgid "Unrecognized HTTP response encoding" -msgstr "" +msgstr "Nerekonita HTTP-responda kodado" -#: ../libsoup/soup-message-io.c:392 ../libsoup/soup-message-io.c:1020 -msgid "Operation would block" -msgstr "La operacio estus haltigota" - -#: ../libsoup/soup-message-io.c:972 ../libsoup/soup-message-io.c:1005 +#: libsoup/http1/soup-client-message-io-http1.c:734 +#: libsoup/http1/soup-client-message-io-http1.c:760 +#: libsoup/http2/soup-client-message-io-http2.c:1640 +#: libsoup/http2/soup-client-message-io-http2.c:1666 msgid "Operation was cancelled" msgstr "La operacio estas ĉesigita" -#: ../libsoup/soup-message-server-io.c:64 -#| msgid "Could not parse URI '%s'" -msgid "Could not parse HTTP request" -msgstr "Ne eblis analizi HTTP-peton" +#: libsoup/http1/soup-message-io-data.c:105 +msgid "Header too big" +msgstr "Kaplinio tro granda" -#: ../libsoup/soup-request.c:141 -#, c-format -msgid "No URI provided" -msgstr "Neniu URI estas diponigita" +#: libsoup/server/soup-listener.c:261 +msgid "Could not import existing socket: " +msgstr "Ne eblis enporti ekzistantan ingon:" -#: ../libsoup/soup-request.c:151 -#, c-format -#| msgid "Invalid '%s' URI: %s" -msgid "Invalid “%s” URI: %s" -msgstr "Nevalida “%s” URI: %s" +#: libsoup/server/soup-listener.c:267 +msgid "Can’t import unconnected socket" +msgstr "Ne povas enporti nekonektitan ingon" -#: ../libsoup/soup-server.c:1725 +#: libsoup/server/soup-server.c:1217 msgid "Can’t create a TLS server without a TLS certificate" -msgstr "" +msgstr "Ne povas krei TLS-servilon sen TLS-atestilo" -#: ../libsoup/soup-server.c:1742 -#, c-format -msgid "Could not listen on address %s, port %d: " -msgstr "" +#: libsoup/soup-session.c:1133 +msgid "Location header is missing or empty in response headers" +msgstr "Loka kaplinio mankas aŭ estas malplena en respondkapoj" -#: ../libsoup/soup-session.c:4518 +#: libsoup/soup-session.c:1147 #, c-format -#| msgid "Could not parse URI '%s'" -msgid "Could not parse URI “%s”" -msgstr "Ne eblis analizi na URI “%s”" +msgid "Invalid URI “%s” in Location response header" +msgstr "Nevalida URI “%s” en loka respondkapo" -#: ../libsoup/soup-session.c:4555 -#, c-format -#| msgid "Unsupported URI scheme '%s'" -msgid "Unsupported URI scheme “%s”" -msgstr "Nesubtenata URI-skemo “%s”" +#: libsoup/soup-session.c:1167 +msgid "Too many redirects" +msgstr "Tro da alidirektiloj" -#: ../libsoup/soup-session.c:4577 -#, c-format -msgid "Not an HTTP URI" -msgstr "" +#: libsoup/soup-session.c:1172 +msgid "Message was restarted too many times" +msgstr "Mesaĝo estis rekomencita tro multajn fojojn" -#: ../libsoup/soup-session.c:4763 +#: libsoup/soup-session.c:3038 libsoup/soup-session.c:3186 +msgid "Message is already in session queue" +msgstr "Mesaĝo jam estas en vico de sesio" + +#: libsoup/soup-session.c:3662 msgid "The server did not accept the WebSocket handshake." -msgstr "" +msgstr "La servilo ne akceptis la manpremon de WebSocket." -#: ../libsoup/soup-socket.c:148 -msgid "Can’t import non-socket as SoupSocket" -msgstr "" +#: libsoup/soup-tld.c:129 +msgid "No public-suffix list available." +msgstr "Neniu publika sufiksa listo havebla." -#: ../libsoup/soup-socket.c:166 -msgid "Could not import existing socket: " -msgstr "" +#: libsoup/soup-tld.c:139 libsoup/soup-tld.c:155 +msgid "Invalid hostname" +msgstr "Nevalida komputilnomo" -#: ../libsoup/soup-socket.c:175 -msgid "Can’t import unconnected socket" -msgstr "" +#: libsoup/soup-tld.c:146 +msgid "Hostname is an IP address" +msgstr "La komputilnomo estas IP-adreso" -#: ../libsoup/soup-websocket.c:338 ../libsoup/soup-websocket.c:347 +#: libsoup/soup-tld.c:167 +msgid "Hostname has no base domain" +msgstr "La komputilnomo ne havas ĉefan retregionon" + +#: libsoup/soup-tld.c:175 +msgid "Not enough domains" +msgstr "Ne sufiĉe da retregionoj" + +#: libsoup/websocket/soup-websocket.c:391 +#: libsoup/websocket/soup-websocket.c:435 +#: libsoup/websocket/soup-websocket.c:451 +msgid "Server requested unsupported extension" +msgstr "Servilo petis nesubtenitan etendon" + +#: libsoup/websocket/soup-websocket.c:414 +#: libsoup/websocket/soup-websocket.c:606 +#, c-format +msgid "Incorrect WebSocket “%s” header" +msgstr "Malĝusta WebSocket \"%s\" kaplinio" + +#: libsoup/websocket/soup-websocket.c:415 +#: libsoup/websocket/soup-websocket.c:870 +#, c-format +msgid "Server returned incorrect “%s” key" +msgstr "Servilo redonis malĝustan ŝlosilon “%s”" + +#: libsoup/websocket/soup-websocket.c:478 +#, c-format +msgid "Duplicated parameter in “%s” WebSocket extension header" +msgstr "Duplikita parametro en \"%s\" WebSocket-etendkapo" + +#: libsoup/websocket/soup-websocket.c:479 +#, c-format +msgid "" +"Server returned a duplicated parameter in “%s” WebSocket extension header" +msgstr "Servilo resendis duobligitan parametron en \"%s\" WebSocket-etendkapo" + +#: libsoup/websocket/soup-websocket.c:569 +#: libsoup/websocket/soup-websocket.c:579 msgid "WebSocket handshake expected" -msgstr "" +msgstr "WebSocket manpremo atendita" -#: ../libsoup/soup-websocket.c:355 +#: libsoup/websocket/soup-websocket.c:587 msgid "Unsupported WebSocket version" msgstr "Nesubtenata WebSocket-versio" -#: ../libsoup/soup-websocket.c:364 +#: libsoup/websocket/soup-websocket.c:596 msgid "Invalid WebSocket key" msgstr "Nevalida WebSocket-ŝlosilo" -#: ../libsoup/soup-websocket.c:374 -#, c-format -msgid "Incorrect WebSocket “%s” header" -msgstr "" - -#: ../libsoup/soup-websocket.c:383 +#: libsoup/websocket/soup-websocket.c:615 msgid "Unsupported WebSocket subprotocol" -msgstr "" +msgstr "Nesubtenata WebSocket-subprotokolo" -#: ../libsoup/soup-websocket.c:510 +#: libsoup/websocket/soup-websocket.c:821 msgid "Server rejected WebSocket handshake" -msgstr "" +msgstr "Servilo malakceptis WebSocket manpremon" -#: ../libsoup/soup-websocket.c:518 ../libsoup/soup-websocket.c:527 +#: libsoup/websocket/soup-websocket.c:829 +#: libsoup/websocket/soup-websocket.c:838 msgid "Server ignored WebSocket handshake" -msgstr "" +msgstr "Servilo ignoris WebSocket manpremon" -#: ../libsoup/soup-websocket.c:539 +#: libsoup/websocket/soup-websocket.c:850 msgid "Server requested unsupported protocol" msgstr "Servilo petis nesubtenatan protokolon" -#: ../libsoup/soup-websocket.c:549 -msgid "Server requested unsupported extension" -msgstr "" +#~| msgid "Could not parse URI '%s'" +#~ msgid "Could not parse HTTP request" +#~ msgstr "Ne eblis analizi HTTP-peton" -#: ../libsoup/soup-websocket.c:562 #, c-format -msgid "Server returned incorrect “%s” key" -msgstr "Servilo redonis malĝustan ŝlosilon “%s”" - -#: ../libsoup/soup-tld.c:188 -msgid "Hostname is an IP address" -msgstr "La komputilnomo estas IP-adreso" +#~ msgid "No URI provided" +#~ msgstr "Neniu URI estas diponigita" -#: ../libsoup/soup-tld.c:198 ../libsoup/soup-tld.c:220 -msgid "Invalid hostname" -msgstr "Nevalida komputilnomo" +#, c-format +#~| msgid "Invalid '%s' URI: %s" +#~ msgid "Invalid “%s” URI: %s" +#~ msgstr "Nevalida “%s” URI: %s" -#: ../libsoup/soup-tld.c:250 -msgid "Hostname has no base domain" -msgstr "La komputilnomo ne havas ĉefan retregionon" +#, c-format +#~| msgid "Could not parse URI '%s'" +#~ msgid "Could not parse URI “%s”" +#~ msgstr "Ne eblis analizi na URI “%s”" -#: ../libsoup/soup-tld.c:304 -msgid "Not enough domains" -msgstr "Ne sufiĉe da retregionoj" +#, c-format +#~| msgid "Unsupported URI scheme '%s'" +#~ msgid "Unsupported URI scheme “%s”" +#~ msgstr "Nesubtenata URI-skemo “%s”"
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/po/tr.po -> _service:tar_scm:libsoup-3.4.4.tar.xz/po/tr.po
Changed
@@ -1,5 +1,5 @@ # Turkish translation for libsoup. -# Copyright (C) 2012-2022 libsoup's COPYRIGHT HOLDER +# Copyright (C) 2012-2023 libsoup's COPYRIGHT HOLDER # This file is distributed under the same license as the libsoup package. # # Ozan Çağlayan <ozancag@gmail.com>, 2013. @@ -13,10 +13,10 @@ msgstr "" "Project-Id-Version: libsoup master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/libsoup/issues\n" -"POT-Creation-Date: 2022-08-13 12:28+0000\n" +"POT-Creation-Date: 2023-04-13 18:20+0000\n" "PO-Revision-Date: 2021-09-09 22:15+0300\n" "Last-Translator: Emin Tufan Çetin <etcetin@gmail.com>\n" -"Language-Team: Türkçe <gnome-turk@gnome.org>\n" +"Language-Team: Türkçe <takim@gnome.org.tr>\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -42,6 +42,8 @@ #: libsoup/http1/soup-body-input-stream.c:187 #: libsoup/http1/soup-body-input-stream.c:220 #: libsoup/http1/soup-message-io-data.c:77 +#: libsoup/http2/soup-client-message-io-http2.c:412 +#: libsoup/server/http2/soup-server-message-io-http2.c:435 msgid "Connection terminated unexpectedly" msgstr "Bağlantı beklenmeyen biçimde sonlandı" @@ -53,26 +55,26 @@ msgid "Cannot truncate SoupBodyInputStream" msgstr "SoupBodyInputStream kesilemiyor" -#: libsoup/http1/soup-client-message-io-http1.c:321 -#: libsoup/http1/soup-client-message-io-http1.c:762 +#: libsoup/http1/soup-client-message-io-http1.c:322 +#: libsoup/http1/soup-client-message-io-http1.c:775 #: libsoup/http2/soup-body-input-stream-http2.c:221 -#: libsoup/server/http1/soup-server-message-io-http1.c:416 -#: libsoup/server/http1/soup-server-message-io-http1.c:889 +#: libsoup/server/http1/soup-server-message-io-http1.c:417 +#: libsoup/server/http1/soup-server-message-io-http1.c:890 msgid "Operation would block" msgstr "İşlem engellenebilir" -#: libsoup/http1/soup-client-message-io-http1.c:462 +#: libsoup/http1/soup-client-message-io-http1.c:463 msgid "Could not parse HTTP response" msgstr "HTTP yanıtı ayrıştırılamadı" -#: libsoup/http1/soup-client-message-io-http1.c:485 +#: libsoup/http1/soup-client-message-io-http1.c:486 msgid "Unrecognized HTTP response encoding" msgstr "HTTP yanıtı tanınmayan biçimde kodlanmış" -#: libsoup/http1/soup-client-message-io-http1.c:721 -#: libsoup/http1/soup-client-message-io-http1.c:747 -#: libsoup/http2/soup-client-message-io-http2.c:1544 -#: libsoup/http2/soup-client-message-io-http2.c:1568 +#: libsoup/http1/soup-client-message-io-http1.c:734 +#: libsoup/http1/soup-client-message-io-http1.c:760 +#: libsoup/http2/soup-client-message-io-http2.c:1653 +#: libsoup/http2/soup-client-message-io-http2.c:1679 msgid "Operation was cancelled" msgstr "İşlem iptal edildi" @@ -80,40 +82,40 @@ msgid "Header too big" msgstr "Başlık çok büyük" -#: libsoup/server/soup-listener.c:261 +#: libsoup/server/soup-listener.c:268 msgid "Could not import existing socket: " msgstr "Var olan yuva içe aktarılamadı: " -#: libsoup/server/soup-listener.c:267 +#: libsoup/server/soup-listener.c:274 msgid "Can’t import unconnected socket" msgstr "Bağlı olmayan yuva içe aktarılamıyor" -#: libsoup/server/soup-server.c:1209 +#: libsoup/server/soup-server.c:1217 msgid "Can’t create a TLS server without a TLS certificate" msgstr "TLS sertifikası olmadan TLS sunucusu oluşturulamaz" -#: libsoup/soup-session.c:1116 +#: libsoup/soup-session.c:1133 msgid "Location header is missing or empty in response headers" msgstr "Konum başlığı eksik veya yanıt başlıklarında boş" -#: libsoup/soup-session.c:1130 +#: libsoup/soup-session.c:1147 #, c-format msgid "Invalid URI “%s” in Location response header" msgstr "Konum yanıt başlığında geçersiz URI “%s”" -#: libsoup/soup-session.c:1150 +#: libsoup/soup-session.c:1167 msgid "Too many redirects" msgstr "Çok sayıda yönlendirme" -#: libsoup/soup-session.c:1155 +#: libsoup/soup-session.c:1172 msgid "Message was restarted too many times" msgstr "İleti birçok kez yeniden başladı" -#: libsoup/soup-session.c:3011 libsoup/soup-session.c:3159 +#: libsoup/soup-session.c:3040 libsoup/soup-session.c:3190 msgid "Message is already in session queue" msgstr "İleti zaten oturum sırasında" -#: libsoup/soup-session.c:3491 +#: libsoup/soup-session.c:3666 msgid "The server did not accept the WebSocket handshake." msgstr "Sunucu, WebSocket el sıkışmasını kabul etmedi." @@ -137,61 +139,61 @@ msgid "Not enough domains" msgstr "Yeterli etki alanı yok" -#: libsoup/websocket/soup-websocket.c:390 -#: libsoup/websocket/soup-websocket.c:434 -#: libsoup/websocket/soup-websocket.c:450 +#: libsoup/websocket/soup-websocket.c:391 +#: libsoup/websocket/soup-websocket.c:435 +#: libsoup/websocket/soup-websocket.c:451 msgid "Server requested unsupported extension" msgstr "Sunucu, desteklenmeyen eklenti isteğinde bulundu" -#: libsoup/websocket/soup-websocket.c:413 -#: libsoup/websocket/soup-websocket.c:605 +#: libsoup/websocket/soup-websocket.c:414 +#: libsoup/websocket/soup-websocket.c:606 #, c-format msgid "Incorrect WebSocket “%s” header" msgstr "Hatalı WebSocket “%s” başlığı" -#: libsoup/websocket/soup-websocket.c:414 -#: libsoup/websocket/soup-websocket.c:869 +#: libsoup/websocket/soup-websocket.c:415 +#: libsoup/websocket/soup-websocket.c:870 #, c-format msgid "Server returned incorrect “%s” key" msgstr "Sunucu, geçersiz “%s” anahtarı döndürdü" -#: libsoup/websocket/soup-websocket.c:477 +#: libsoup/websocket/soup-websocket.c:478 #, c-format msgid "Duplicated parameter in “%s” WebSocket extension header" msgstr "“%s” WebSocket eklenti başlığında yinelenen parametre" -#: libsoup/websocket/soup-websocket.c:478 +#: libsoup/websocket/soup-websocket.c:479 #, c-format msgid "" "Server returned a duplicated parameter in “%s” WebSocket extension header" msgstr "Sunucu, “%s” WebSocket eklenti başlığında yinelenen parametre döndürdü" -#: libsoup/websocket/soup-websocket.c:568 -#: libsoup/websocket/soup-websocket.c:578 +#: libsoup/websocket/soup-websocket.c:569 +#: libsoup/websocket/soup-websocket.c:579 msgid "WebSocket handshake expected" msgstr "WebSocket el sıkışması bekleniyor" -#: libsoup/websocket/soup-websocket.c:586 +#: libsoup/websocket/soup-websocket.c:587 msgid "Unsupported WebSocket version" msgstr "Desteklenmeyen WebSocket sürümü" -#: libsoup/websocket/soup-websocket.c:595 +#: libsoup/websocket/soup-websocket.c:596 msgid "Invalid WebSocket key" msgstr "Geçersiz WebSocket anahtarı" -#: libsoup/websocket/soup-websocket.c:614 +#: libsoup/websocket/soup-websocket.c:615 msgid "Unsupported WebSocket subprotocol" msgstr "Desteklenmeyen WebSocket alt iletişim kuralı" -#: libsoup/websocket/soup-websocket.c:820 +#: libsoup/websocket/soup-websocket.c:821 msgid "Server rejected WebSocket handshake" msgstr "Sunucu, WebSocket el sıkışmasını reddetti" -#: libsoup/websocket/soup-websocket.c:828 -#: libsoup/websocket/soup-websocket.c:837 +#: libsoup/websocket/soup-websocket.c:829 +#: libsoup/websocket/soup-websocket.c:838 msgid "Server ignored WebSocket handshake" msgstr "Sunucu, WebSocket el sıkışmasını yoksaydı" -#: libsoup/websocket/soup-websocket.c:849 +#: libsoup/websocket/soup-websocket.c:850 msgid "Server requested unsupported protocol" msgstr "Sunucu, desteklenmeyen iletişim kuralı isteğinde bulundu"
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/autobahn/autobahn-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/autobahn/autobahn-test.c
Changed
@@ -268,22 +268,23 @@ int ret = 0; guint64 num_case = 1, num_cases; SoupSession *session; + const char *num_cases_env, *num_case_env, *timeout_env; test_init (argc, argv, NULL); if (!autobahn_server ("--start", &num_cases)) exit (1); - if (getenv ("AUTOBAHN_NUM_CASES")) - num_cases = atol (getenv ("AUTOBAHN_NUM_CASES")); + if ((num_cases_env = g_getenv ("AUTOBAHN_NUM_CASES"))) + num_cases = atol (num_cases_env); - if (getenv ("AUTOBAHN_NUM_CASE")) { - num_case = atol (getenv ("AUTOBAHN_NUM_CASE")); + if ((num_case_env = g_getenv ("AUTOBAHN_NUM_CASE"))) { + num_case = atol (num_case_env); num_cases = num_case; } - if (getenv ("AUTOBAHN_TEST_TIMEOUT")) - AUTOBAHN_TEST_TIMEOUT = atol (getenv ("AUTOBAHN_TEST_TIMEOUT")); + if ((timeout_env = g_getenv ("AUTOBAHN_TEST_TIMEOUT"))) + AUTOBAHN_TEST_TIMEOUT = atol (timeout_env); session = soup_session_new (); soup_session_add_feature_by_type (session, SOUP_TYPE_WEBSOCKET_EXTENSION_MANAGER);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/cache-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/cache-test.c
Changed
@@ -597,9 +597,6 @@ g_object_unref (cache); g_free (cache_dir); - - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); soup_test_session_abort_unref (session); } @@ -942,10 +939,6 @@ g_object_unref (msg); - /* Continue iterating to ensure the item is unqueued and the connection released */ - while (g_main_context_pending (context)) - g_main_context_iteration (context, TRUE); - /* Cache writes are G_PRIORITY_LOW, so they won't have happened yet */ soup_cache_flush ((SoupCache *)soup_session_get_feature (request->session, SOUP_TYPE_CACHE));
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/connection-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/connection-test.c
Changed
@@ -1690,10 +1690,6 @@ g_assert_nonnull (body); g_bytes_unref (body); g_object_unref (msg); - - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - soup_test_session_abort_unref (session); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/cookies-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/cookies-test.c
Changed
@@ -286,6 +286,72 @@ g_object_unref (jar); } +static void +do_cookies_prefix_test (void) +{ + SoupCookieJar *jar; + GSList *cookies; + GUri *insecure_uri; + GUri *secure_uri; + + insecure_uri = g_uri_parse ("http://gnome.org", SOUP_HTTP_URI_FLAGS, NULL); + secure_uri = g_uri_parse ("https://gnome.org", SOUP_HTTP_URI_FLAGS, NULL); + jar = soup_cookie_jar_new (); + + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__SeCuRe-Valid-1=1; Path=/; Secure", secure_uri), + secure_uri, NULL); + + /* With NULL uri is considered secure */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__secure-Valid-2=1; Path=/; Secure", secure_uri), + NULL, NULL); + + /* Without Secure */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__SeCuRe-Invalid-1=1;", secure_uri), + secure_uri, NULL); + + /* Insecure host */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__SECURE-Invalid-2=1; Path=/Somethingelse; Secure", insecure_uri), + insecure_uri, NULL); + + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HoSt-Valid-1=1; Path=/; Secure", secure_uri), + secure_uri, NULL); + + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HoSt-Valid-2=1; Path=/; Secure", secure_uri), + NULL, NULL); + + /* Invalid Path */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HOST-Invalid-1=1; Path=/Somethingelse; Secure", secure_uri), + secure_uri, NULL); + + /* Without Secure */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__host-Invalid-2=1; Path=/", secure_uri), + secure_uri, NULL); + + /* Domain forbidden */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__HoSt-Invalid-3=1; Path=/; Secure; Domain=gnome.org", secure_uri), + secure_uri, NULL); + + /* Insecure host */ + soup_cookie_jar_add_cookie_full (jar, soup_cookie_parse ("__host-Invalid-4=1; Path=/; Secure", insecure_uri), + insecure_uri, NULL); + + cookies = soup_cookie_jar_all_cookies (jar); + + for (GSList *l = cookies; l; l = g_slist_next (l)) { + SoupCookie *cookie = l->data; + + g_assert_true (strstr (soup_cookie_get_name (cookie), "Valid") != NULL); + } + + /* In total we expect 4 valid cookies above. */ + g_assert_cmpuint (g_slist_length (cookies), ==, 4); + + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + g_uri_unref (insecure_uri); + g_uri_unref (secure_uri); + g_object_unref (jar); +} + /* FIXME: moar tests! */ static void do_cookies_parsing_test (void) @@ -332,11 +398,12 @@ got1 = TRUE; g_assert_true (soup_cookie_get_http_only (cookie)); g_assert_true (soup_cookie_get_expires (cookie) != NULL); + g_assert_cmpint (soup_cookie_get_same_site_policy (cookie), ==, SOUP_SAME_SITE_POLICY_LAX); } else if (!strcmp (soup_cookie_get_name (cookie), "two")) { got2 = TRUE; g_assert_true (soup_cookie_get_http_only (cookie)); g_assert_true (soup_cookie_get_expires (cookie) != NULL); - g_assert_cmpint (soup_cookie_get_same_site_policy (cookie), ==, SOUP_SAME_SITE_POLICY_NONE); + g_assert_cmpint (soup_cookie_get_same_site_policy (cookie), ==, SOUP_SAME_SITE_POLICY_LAX); } else if (!strcmp (soup_cookie_get_name (cookie), "three")) { got3 = TRUE; g_assert_true (soup_cookie_get_http_only (cookie)); @@ -368,6 +435,68 @@ } static void +do_cookies_equal_nullpath (void) +{ + SoupCookie *cookie1, *cookie2; + + cookie1 = soup_cookie_new ("one", "1", "127.0.0.1", NULL, 1000); + cookie2 = soup_cookie_new ("one", "1", "127.0.0.1", "/foo", 1000); + + g_assert_false (soup_cookie_equal (cookie1, cookie2)); + + soup_cookie_free (cookie1); + soup_cookie_free (cookie2); +} + +static void +do_cookies_parsing_control_characters (void) +{ + SoupCookieJar *jar; + GSList *cookies; + GUri *uri; + char buf256; + int cntrl; + + uri = g_uri_parse ("https://gnome.org", SOUP_HTTP_URI_FLAGS, NULL); + jar = soup_cookie_jar_new (); + + /* Cookies should not take control characters %x00-1F / %x7F in names or values, + * with the exception of %x09 (the tab character). + */ + for (cntrl = 0x01; cntrl <= 0x1F; cntrl++) { + if (cntrl == 0x09) + continue; + + g_snprintf (buf, sizeof(buf), "name%c%x=value%x", cntrl, cntrl, cntrl); + soup_cookie_jar_set_cookie (jar, uri, buf); + g_snprintf (buf, sizeof(buf), "name%x=value%c%x", cntrl, cntrl, cntrl); + soup_cookie_jar_set_cookie (jar, uri, buf); + + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 0); + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + } + + cntrl = 0x7F; + g_snprintf (buf, sizeof(buf), "name%c%x=value%x", cntrl, cntrl, cntrl); + soup_cookie_jar_set_cookie (jar, uri, buf); + g_snprintf (buf, sizeof(buf), "name%x=value%c%x", cntrl, cntrl, cntrl); + soup_cookie_jar_set_cookie (jar, uri, buf); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 0); + + /* Cookies are accepted with a tab (\t) in name or value. */ + soup_cookie_jar_set_cookie (jar, uri, "name\x099=value9"); + soup_cookie_jar_set_cookie (jar, uri, "name9=value\x099"); + cookies = soup_cookie_jar_all_cookies (jar); + g_assert_cmpint (g_slist_length (cookies), ==, 2); + + g_slist_free_full (cookies, (GDestroyNotify)soup_cookie_free); + g_uri_unref (uri); + g_object_unref (jar); +} + +static void do_get_cookies_empty_host_test (void) { SoupCookieJar *jar; @@ -526,9 +655,12 @@ g_test_add_func ("/cookies/accept-policy-subdomains", do_cookies_subdomain_policy_test); g_test_add_func ("/cookies/parsing", do_cookies_parsing_test); g_test_add_func ("/cookies/parsing/no-path-null-origin", do_cookies_parsing_nopath_nullorigin); + g_test_add_func ("/cookies/parsing/equal-nullpath", do_cookies_equal_nullpath); + g_test_add_func ("/cookies/parsing/control-characters", do_cookies_parsing_control_characters); g_test_add_func ("/cookies/get-cookies/empty-host", do_get_cookies_empty_host_test); g_test_add_func ("/cookies/remove-feature", do_remove_feature_test); g_test_add_func ("/cookies/secure-cookies", do_cookies_strict_secure_test); + g_test_add_func ("/cookies/prefix", do_cookies_prefix_test); g_test_add_func ("/cookies/threads", do_cookies_threads_test); ret = g_test_run ();
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/forms-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/forms-test.c
Changed
@@ -311,6 +311,8 @@ const char *content_type; GString *buf; const char *method; + char *buf_str; + gsize buf_len; method = soup_server_message_get_method (msg); if (method != SOUP_METHOD_GET && method != SOUP_METHOD_HEAD) { @@ -351,10 +353,11 @@ } } + buf_len = buf->len; + buf_str = g_string_free (g_steal_pointer (&buf), FALSE); soup_server_message_set_response (msg, content_type, SOUP_MEMORY_TAKE, - buf->str, buf->len); - g_string_free (buf, FALSE); + g_steal_pointer (&buf_str), buf_len); soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); } @@ -368,6 +371,8 @@ const char *file = NULL, *md5sum = NULL, *fmt; const char *content_type; GString *buf; + char *buf_str; + gsize buf_len; if (query) { file = g_hash_table_lookup (query, "file"); @@ -397,10 +402,11 @@ g_string_append_printf (buf, "%s", md5sum); } + buf_len = buf->len; + buf_str = g_string_free (g_steal_pointer (&buf), FALSE); soup_server_message_set_response (msg, content_type, SOUP_MEMORY_TAKE, - buf->str, buf->len); - g_string_free (buf, FALSE); + g_steal_pointer (&buf_str), buf_len); soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/header-parsing-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/header-parsing-test.c
Changed
@@ -1211,10 +1211,12 @@ { "two", "test with spaces" }, { "three", "test with \"quotes\" and \\s" }, { "four", NULL }, - { "five", "test with \xC3\xA1\xC3\xA7\xC4\x89\xC3\xA8\xC3\xB1\xC5\xA3\xC5\xA1" } + { "five", "test with \xC3\xA1\xC3\xA7\xC4\x89\xC3\xA8\xC3\xB1\xC5\xA3\xC5\xA1" }, + { "six", "あ,い!#$&+-.^_`|~" }, + { "seven", "あabc*'%123^_`|~" } }; -#define TEST_PARAMS_RESULT "one=foo, two=\"test with spaces\", three=\"test with \\\"quotes\\\" and \\\\s\", four, five*=UTF-8''test%20with%20%C3%A1%C3%A7%C4%89%C3%A8%C3%B1%C5%A3%C5%A1" +#define TEST_PARAMS_RESULT "one=foo, two=\"test with spaces\", three=\"test with \\\"quotes\\\" and \\\\s\", four, five*=UTF-8''test%20with%20%C3%A1%C3%A7%C4%89%C3%A8%C3%B1%C5%A3%C5%A1, six*=UTF-8''%E3%81%82%2C%E3%81%84!#$&+-.^_`|~, seven*=UTF-8''%E3%81%82abc%2A%27%25123^_`|~" static void do_append_param_tests (void)
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/http2-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/http2-test.c
Changed
@@ -194,9 +194,6 @@ g_assert_cmpstr (g_bytes_get_data (response1, NULL), ==, "body%201"); g_assert_cmpstr (g_bytes_get_data (response2, NULL), ==, "body%202"); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_bytes_unref (response1); g_bytes_unref (response2); g_object_unref (msg1); @@ -316,9 +313,6 @@ g_bytes_unref (body); } - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - g_object_unref (cancellable); g_object_unref (ostream); g_object_unref (istream); @@ -366,7 +360,7 @@ GUri *uri; SoupMessage *msg; GInputStream *response; - guint large_size = 10000; + guint large_size = 1000000; char *large_data; unsigned int i; GError *error = NULL; @@ -414,9 +408,6 @@ g_assert_cmpstr (g_bytes_get_data (response, NULL), ==, "body 1"); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_bytes_unref (response); g_bytes_unref (bytes); g_main_context_unref (async_context); @@ -431,7 +422,7 @@ SoupMessage *msg; GBytes *response = NULL; GMainContext *async_context = g_main_context_ref_thread_default (); - guint large_size = 10000; + guint large_size = 1000000; char *large_data; unsigned int i; @@ -451,9 +442,6 @@ g_assert_true (g_bytes_equal (bytes, response)); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_bytes_unref (response); g_bytes_unref (bytes); g_main_context_unref (async_context); @@ -489,9 +477,6 @@ g_assert_cmpstr (g_bytes_get_data (response, NULL), ==, "Part 1 - Part 2"); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_bytes_unref (response); g_object_unref (in_stream); g_main_context_unref (async_context); @@ -522,9 +507,6 @@ g_assert_true (g_str_has_prefix (g_bytes_get_data (response, NULL), "-----BEGIN CERTIFICATE-----")); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_bytes_unref (response); g_object_unref (in_stream); g_object_unref (in_file); @@ -571,6 +553,90 @@ g_uri_unref (uri); } +typedef struct { + int connection; + int stream; +} WindowSize; + +static void +flow_control_message_network_event (SoupMessage *msg, + GSocketClientEvent event, + GIOStream *connection, + WindowSize *window_size) +{ + SoupConnection *conn; + + if (event != G_SOCKET_CLIENT_RESOLVING) + return; + + conn = soup_message_get_connection (msg); + g_assert_nonnull (conn); + if (window_size->connection != -1) + soup_connection_set_http2_initial_window_size (conn, window_size->connection); + if (window_size->stream != -1) + soup_connection_set_http2_initial_stream_window_size (conn, window_size->stream); +} + +static void +do_flow_control_large_test (Test *test, gconstpointer data) +{ + gboolean async = GPOINTER_TO_INT (data); + GUri *uri; + SoupMessage *msg; + GBytes *response; + GError *error = NULL; + WindowSize window_size = { (LARGE_N_CHARS * LARGE_CHARS_REPEAT) / 2 , (LARGE_N_CHARS * LARGE_CHARS_REPEAT) / 2 }; + + uri = g_uri_parse_relative (base_uri, "/large", SOUP_HTTP_URI_FLAGS, NULL); + msg = soup_message_new_from_uri (SOUP_METHOD_GET, uri); + g_signal_connect (msg, "network-event", + G_CALLBACK (flow_control_message_network_event), + &window_size); + + if (async) + response = soup_test_session_async_send (test->session, msg, NULL, &error); + else + response = soup_session_send_and_read (test->session, msg, NULL, &error); + + g_assert_no_error (error); + g_assert_cmpuint (g_bytes_get_size (response), ==, (LARGE_N_CHARS * LARGE_CHARS_REPEAT) + 1); + + g_uri_unref (uri); + g_bytes_unref (response); + g_object_unref (msg); +} + +static void +do_flow_control_multi_message_async_test (Test *test, gconstpointer data) +{ + GUri *uri; + SoupMessage *msg1, *msg2; + GBytes *response1 = NULL; + GBytes *response2 = NULL; + WindowSize window_size = { (LARGE_N_CHARS * LARGE_CHARS_REPEAT), (LARGE_N_CHARS * LARGE_CHARS_REPEAT) / 2 }; + + uri = g_uri_parse_relative (base_uri, "/large", SOUP_HTTP_URI_FLAGS, NULL); + msg1 = soup_message_new_from_uri (SOUP_METHOD_GET, uri); + g_signal_connect (msg1, "network-event", + G_CALLBACK (flow_control_message_network_event), + &window_size); + msg2 = soup_message_new_from_uri (SOUP_METHOD_GET, uri); + soup_session_send_async (test->session, msg1, G_PRIORITY_DEFAULT, NULL, on_send_complete, &response1); + soup_session_send_async (test->session, msg2, G_PRIORITY_DEFAULT, NULL, on_send_complete, &response2); + + while (!response1 || !response2) + g_main_context_iteration (NULL, TRUE); + + g_assert_cmpuint (g_bytes_get_size (response1), ==, (LARGE_N_CHARS * LARGE_CHARS_REPEAT) + 1); + g_assert_cmpuint (g_bytes_get_size (response2), ==, (LARGE_N_CHARS * LARGE_CHARS_REPEAT) + 1); + + g_uri_unref (uri); + g_bytes_unref (response1); + g_bytes_unref (response2); + g_object_unref (msg1); + g_object_unref (msg2); +} + static SoupConnection *last_connection; static void @@ -584,25 +650,23 @@ GInputStream *stream; stream = soup_session_send_finish (sess, res, &error); - g_assert_no_error (error); g_assert_nonnull (stream); - GBytes *result = read_stream_to_bytes_sync (stream); - g_object_unref (stream); - g_assert_nonnull (result); - g_assert_cmpstr (g_bytes_get_data (result, NULL), ==, "Hello world"); - g_bytes_unref (result); - g_assert_nonnull (msg); g_assert_cmpuint (soup_message_get_http_version (msg), ==, SOUP_HTTP_2_0); conn = soup_message_get_connection (msg); - if (last_connection) - g_assert (last_connection == conn); + g_assert_true (last_connection == conn); else last_connection = conn; - + + GBytes *result = read_stream_to_bytes_sync (stream); + g_object_unref (stream); + g_assert_nonnull (result); + g_assert_cmpstr (g_bytes_get_data (result, NULL), ==, "Hello world"); + g_bytes_unref (result); + g_test_message ("Conn (%u) = %p", *complete_count, conn); *complete_count += 1; @@ -635,9 +699,6 @@ g_main_context_iteration (async_context, TRUE); } - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - /* After no messages reference the connection it should be IDLE and reusable */ g_assert_cmpuint (soup_connection_get_state (last_connection), ==, SOUP_CONNECTION_IDLE); SoupMessage *msg = soup_message_new_from_uri (SOUP_METHOD_GET, uri); @@ -647,9 +708,6 @@ while (complete_count != N_TESTS + 1) g_main_context_iteration (async_context, TRUE); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_uri_unref (uri); g_main_context_unref (async_context); } @@ -718,16 +776,28 @@ } static void +msg_got_body_data_cb (SoupMessage *msg, + guint chunk_size, + guint64 *response_body_bytes_received) +{ + *response_body_bytes_received += chunk_size; +} + +static void do_metrics_size_test (Test *test, gconstpointer data) { GUri *uri; SoupMessage *msg; GBytes *response; GError *error = NULL; + guint64 response_body_bytes_received = 0; GBytes *bytes = g_bytes_new_static ("Test", sizeof ("Test")); uri = g_uri_parse_relative (base_uri, "/echo_post", SOUP_HTTP_URI_FLAGS, NULL); msg = soup_message_new_from_uri (SOUP_METHOD_POST, uri); + g_signal_connect (msg, "got-body-data", + G_CALLBACK (msg_got_body_data_cb), + &response_body_bytes_received); soup_message_set_request_body_from_bytes (msg, "text/plain", bytes); soup_message_add_flags (msg, SOUP_MESSAGE_COLLECT_METRICS); @@ -745,6 +815,7 @@ g_assert_cmpuint (soup_message_metrics_get_response_header_bytes_received (metrics), >, 0); g_assert_cmpuint (soup_message_metrics_get_response_body_size (metrics), ==, g_bytes_get_size (response)); g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), >, soup_message_metrics_get_response_body_size (metrics)); + g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), ==, response_body_bytes_received); g_bytes_unref (response); g_bytes_unref (bytes); @@ -1111,9 +1182,6 @@ do_one_sniffer_test (test->session, "/large", (LARGE_N_CHARS * LARGE_CHARS_REPEAT) + 1, should_content_sniff, async_context); do_one_sniffer_test (test->session, "/no-content", 0, should_content_sniff, async_context); - while (g_main_context_pending (async_context)) - g_main_context_iteration (async_context, FALSE); - g_main_context_unref (async_context); } @@ -1147,9 +1215,6 @@ g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT); g_object_unref (msg); g_uri_unref (uri); - - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); } static void @@ -1174,6 +1239,7 @@ unpause_message (SoupServerMessage *msg) { soup_server_message_unpause (msg); + g_object_unref (msg); return FALSE; } @@ -1200,7 +1266,7 @@ soup_server_message_pause (msg); timeout = soup_add_timeout (g_main_context_get_thread_default (), is_timeout ? 4000 : 1000, - (GSourceFunc)unpause_message, msg); + (GSourceFunc)unpause_message, g_object_ref (msg)); g_source_unref (timeout); } } else if (strcmp (path, "/no-content") == 0) { @@ -1379,6 +1445,18 @@ setup_session, do_paused_async_test, teardown_session); + g_test_add ("/http2/flow-control/large/async", Test, GINT_TO_POINTER (TRUE), + setup_session, + do_flow_control_large_test, + teardown_session); + g_test_add ("/http2/flow-control/large/sync", Test, GINT_TO_POINTER (TRUE), + setup_session, + do_flow_control_large_test, + teardown_session); + g_test_add ("/http2/flow-control/multiplex/async", Test, NULL, + setup_session, + do_flow_control_multi_message_async_test, + teardown_session); g_test_add ("/http2/connections", Test, NULL, setup_session, do_connections_test,
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/misc-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/misc-test.c
Changed
@@ -22,6 +22,7 @@ timeout_finish_message (gpointer msg) { soup_server_message_unpause (msg); + g_object_unref (msg); return FALSE; } @@ -68,7 +69,7 @@ GSource *timeout; soup_server_message_pause (msg); timeout = soup_add_timeout (g_main_context_get_thread_default (), - 1000, timeout_finish_message, msg); + 1000, timeout_finish_message, g_object_ref (msg)); g_source_unref (timeout); } @@ -377,9 +378,6 @@ g_clear_error (&error); g_object_unref (stream); - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - ensure_no_signal_handlers (msg, signal_ids, n_signal_ids); soup_test_session_abort_unref (session); @@ -453,7 +451,6 @@ (GAsyncReadyCallback)ea_msg_completed_one, loop); g_object_unref (msg); - g_main_context_iteration (context, FALSE); soup_session_abort (session); while (g_main_context_pending (context)) @@ -473,10 +470,6 @@ g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); g_clear_error (&error); g_object_unref (msg); - - while (g_main_context_pending (context)) - g_main_context_iteration (context, FALSE); - soup_test_session_abort_unref (session); g_test_bug ("668098"); @@ -494,10 +487,6 @@ g_clear_error (&error); g_object_unref (cancellable); g_object_unref (msg); - - while (g_main_context_pending (context)) - g_main_context_iteration (context, FALSE); - soup_test_session_abort_unref (session); } @@ -697,9 +686,6 @@ g_bytes_unref (body); } - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - g_object_unref (cancellable); g_object_unref (ostream); g_object_unref (istream); @@ -990,9 +976,6 @@ g_object_unref (msg); g_object_unref (data.cancellable); - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - data.cancellable = g_cancellable_new (); data.connections0 = data.connections1 = 0; data.done = FALSE; @@ -1013,10 +996,6 @@ g_object_unref (msg); g_object_unref (data.cancellable); - - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - g_uri_unref (uri); g_bytes_unref (data.body); soup_test_session_abort_unref (data.session);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/multipart-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/multipart-test.c
Changed
@@ -452,8 +452,6 @@ soup_session_send_async (session, msg, 0, NULL, no_multipart_handling_cb, NULL); g_main_loop_run (loop); - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); content_type = soup_message_headers_get_content_type (soup_message_get_response_headers (msg), ¶ms);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/multithread-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/multithread-test.c
Changed
@@ -365,9 +365,6 @@ body = soup_test_session_async_send (test->session, msg, NULL, NULL); g_bytes_unref (body); - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - g_assert_nonnull (conn); g_assert_cmpuint (soup_connection_get_state (conn), ==, SOUP_CONNECTION_IDLE);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/samesite-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/samesite-test.c
Changed
@@ -13,21 +13,28 @@ same_site_setup (SameSiteFixture *fixture, gconstpointer data) { - SoupCookie *cookie_none, *cookie_lax, *cookie_strict; + SoupCookie *cookie_none, *cookie_none_secure, *cookie_lax, *cookie_strict, *cookie_default; - fixture->origin_uri = g_uri_parse ("http://127.0.0.1", SOUP_HTTP_URI_FLAGS, NULL); - fixture->cross_uri = g_uri_parse ("http://localhost", SOUP_HTTP_URI_FLAGS, NULL); + fixture->origin_uri = g_uri_parse ("https://127.0.0.1", SOUP_HTTP_URI_FLAGS, NULL); + fixture->cross_uri = g_uri_parse ("https://localhost", SOUP_HTTP_URI_FLAGS, NULL); fixture->jar = soup_cookie_jar_new (); cookie_none = soup_cookie_new ("none", "1", "127.0.0.1", "/", 1000); + soup_cookie_set_same_site_policy (cookie_none, SOUP_SAME_SITE_POLICY_NONE); + cookie_none_secure = soup_cookie_new ("none_secure", "1", "127.0.0.1", "/", 1000); + soup_cookie_set_same_site_policy (cookie_none_secure, SOUP_SAME_SITE_POLICY_NONE); + soup_cookie_set_secure(cookie_none_secure, TRUE); cookie_lax = soup_cookie_new ("lax", "1", "127.0.0.1", "/", 1000); soup_cookie_set_same_site_policy (cookie_lax, SOUP_SAME_SITE_POLICY_LAX); cookie_strict = soup_cookie_new ("strict", "1", "127.0.0.1", "/", 1000); soup_cookie_set_same_site_policy (cookie_strict, SOUP_SAME_SITE_POLICY_STRICT); + cookie_default = soup_cookie_new ("default", "1", "127.0.0.1", "/", 1000); soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_none); + soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_none_secure); soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_lax); soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_strict); + soup_cookie_jar_add_cookie_with_first_party (fixture->jar, fixture->origin_uri, cookie_default); } static void @@ -52,10 +59,10 @@ switch (policy) { case SOUP_SAME_SITE_POLICY_STRICT: - expected_count = 3; + expected_count = 4; break; case SOUP_SAME_SITE_POLICY_LAX: - expected_count = 2; + expected_count = 3; break; case SOUP_SAME_SITE_POLICY_NONE: expected_count = 1;
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/server-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/server-test.c
Changed
@@ -6,6 +6,7 @@ #include "test-utils.h" #include "soup-message-private.h" #include "soup-uri-utils-private.h" +#include "soup-server-private.h" #include "soup-misc.h" #include <gio/gnetworking.h> @@ -1315,6 +1316,45 @@ g_free (proxy_uri_str); } +static void +do_idle_connection_closed_test (ServerData *sd, gconstpointer test_data) +{ + SoupSession *session; + SoupMessage *msg; + GBytes *body; + GError *error = NULL; + GSList *clients; + + soup_server_set_http2_enabled (sd->server, tls_available); + + session = soup_test_session_new (NULL); + + msg = soup_message_new_from_uri ("GET", sd->base_uri); + body = soup_session_send_and_read (session, msg, NULL, &error); + g_assert_no_error (error); + g_bytes_unref (body); + g_object_unref (msg); + + clients = soup_server_get_clients (sd->server); + g_assert_cmpuint (g_slist_length (clients), ==, 1); + + if (tls_available) { + msg = soup_message_new_from_uri ("GET", sd->ssl_base_uri); + body = soup_session_send_and_read (session, msg, NULL, &error); + g_assert_no_error (error); + g_bytes_unref (body); + g_object_unref (msg); + + clients = soup_server_get_clients (sd->server); + g_assert_cmpuint (g_slist_length (clients), ==, 2); + } + + soup_test_session_abort_unref (session); + + while (soup_server_get_clients (sd->server)) + g_main_context_iteration (NULL, FALSE); +} + int main (int argc, char **argv) { @@ -1330,6 +1370,8 @@ server_setup, do_invalid_percent_encoding_paths_test, server_teardown); g_test_add ("/server/ipv6", ServerData, NULL, NULL, do_ipv6_test, server_teardown); + g_test_add ("/server/idle-connection-closed", ServerData, NULL, + server_setup, do_idle_connection_closed_test, server_teardown); g_test_add ("/server/multi/port", ServerData, NULL, NULL, do_multi_port_test, server_teardown); g_test_add ("/server/multi/scheme", ServerData, NULL,
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/ssl-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/ssl-test.c
Changed
@@ -463,6 +463,7 @@ &error ); g_assert_no_error (error); + g_clear_error (&error); g_assert_nonnull (pkcs11_certificate); g_assert_true (G_IS_TLS_CERTIFICATE (pkcs11_certificate)); msg = soup_message_new_from_uri ("GET", uri); @@ -509,7 +510,7 @@ g_bytes_unref (body); g_object_unref (msg); - g_object_unref (pkcs11_certificate); + g_clear_object (&pkcs11_certificate); } g_object_set (server, "tls-database", NULL, "tls-auth-mode", G_TLS_AUTHENTICATION_NONE, NULL);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/streaming-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/streaming-test.c
Changed
@@ -98,6 +98,14 @@ } static void +msg_got_body_data_cb (SoupMessage *msg, + guint chunk_size, + guint64 *response_body_bytes_received) +{ + *response_body_bytes_received += chunk_size; +} + +static void msg_got_body_cb (SoupMessage *msg, SoupMessageMetrics *metrics) { @@ -113,6 +121,7 @@ GBytes *body; char *md5; SoupMessageMetrics *metrics; + guint64 response_body_bytes_received = 0; uri = g_uri_parse_relative (base_uri, path, SOUP_HTTP_URI_FLAGS, NULL); msg = soup_message_new_from_uri ("GET", uri); @@ -134,6 +143,9 @@ g_signal_connect (msg, "got-headers", G_CALLBACK (msg_got_headers_cb), metrics); + g_signal_connect (msg, "got-body-data", + G_CALLBACK (msg_got_body_data_cb), + &response_body_bytes_received); g_signal_connect (msg, "got-body", G_CALLBACK (msg_got_body_cb), metrics); @@ -143,6 +155,7 @@ soup_test_assert_message_status (msg, SOUP_STATUS_OK); g_assert_cmpint (g_bytes_get_size (body), ==, g_bytes_get_size (full_response)); g_assert_cmpint (soup_message_metrics_get_response_body_size (metrics), ==, g_bytes_get_size (body)); + g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), ==, response_body_bytes_received); g_assert_cmpuint (soup_message_metrics_get_request_header_bytes_sent (metrics), >, 0); g_assert_cmpuint (soup_message_metrics_get_request_body_bytes_sent (metrics), ==, 0); g_assert_cmpuint (soup_message_metrics_get_request_body_size (metrics), ==, 0); @@ -152,6 +165,12 @@ } else { g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), ==, soup_message_metrics_get_response_body_size (metrics)); } + if (g_str_equal (path, "content-length")) { + goffset content_length; + + content_length = soup_message_headers_get_content_length (soup_message_get_response_headers (msg)); + g_assert_cmpuint (content_length, ==, response_body_bytes_received); + } md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5, (guchar *)g_bytes_get_data (body, NULL), @@ -198,6 +217,74 @@ soup_test_session_abort_unref (session); } +static void +do_skip (SoupSession *session, + GUri *base_uri, + const char *path) +{ + GUri *uri; + SoupMessage *msg; + GInputStream *stream; + SoupMessageMetrics *metrics; + guint64 body_size = 0; + guint64 response_body_bytes_received = 0; + GError *error = NULL; + + uri = g_uri_parse_relative (base_uri, path, SOUP_HTTP_URI_FLAGS, NULL); + msg = soup_message_new_from_uri ("GET", uri); + g_uri_unref (uri); + + soup_message_add_flags (msg, SOUP_MESSAGE_COLLECT_METRICS); + g_signal_connect (msg, "got-body-data", + G_CALLBACK (msg_got_body_data_cb), + &response_body_bytes_received); + + stream = soup_test_request_send (session, msg, NULL, 0, &error); + g_assert_no_error (error); + while (TRUE) { + gssize skipped; + + skipped = g_input_stream_skip (stream, 4096, NULL, &error); + g_assert_no_error (error); + if (skipped == 0) + break; + + body_size += skipped; + } + g_object_unref (stream); + + metrics = soup_message_get_metrics (msg); + g_assert_cmpint (body_size, ==, g_bytes_get_size (full_response)); + g_assert_cmpint (soup_message_metrics_get_response_body_size (metrics), ==, body_size); + g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), ==, response_body_bytes_received); + if (g_str_equal (path, "chunked")) { + g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), >, soup_message_metrics_get_response_body_size (metrics)); + } else { + g_assert_cmpuint (soup_message_metrics_get_response_body_bytes_received (metrics), ==, soup_message_metrics_get_response_body_size (metrics)); + } + if (g_str_equal (path, "content-length")) { + goffset content_length; + + content_length = soup_message_headers_get_content_length (soup_message_get_response_headers (msg)); + g_assert_cmpuint (content_length, ==, response_body_bytes_received); + } + + g_object_unref (msg); +} + +static void +do_skip_test (gconstpointer data) +{ + GUri *base_uri = (GUri *)data; + SoupSession *session; + + session = soup_test_session_new (NULL); + do_skip (session, base_uri, "chunked"); + do_skip (session, base_uri, "content-length"); + do_skip (session, base_uri, "eof"); + soup_test_session_abort_unref (session); +} + int main (int argc, char **argv) { @@ -222,6 +309,7 @@ g_test_add_data_func ("/streaming/chunked", base_uri, do_chunked_test); g_test_add_data_func ("/streaming/content-length", base_uri, do_content_length_test); g_test_add_data_func ("/streaming/eof", base_uri, do_eof_test); + g_test_add_data_func ("/streaming/skip", base_uri, do_skip_test); ret = g_test_run ();
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/test-utils.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/test-utils.c
Changed
@@ -727,12 +727,8 @@ gpointer user_data) { AsyncAsSyncData *data = user_data; - GMainContext *context; data->result = g_object_ref (result); - context = g_main_loop_get_context (data->loop); - while (g_main_context_pending (context)) - g_main_context_iteration (context, FALSE); g_main_loop_quit (data->loop); } @@ -772,16 +768,10 @@ stream = soup_session_send_finish (session, data.result, error); if (flags & SOUP_TEST_REQUEST_CANCEL_AFTER_SEND_FINISH) { - GMainContext *context; - if (flags & SOUP_TEST_REQUEST_CANCEL_BY_SESSION) soup_session_cancel_message (session, msg); else g_cancellable_cancel (cancellable); - - context = g_main_loop_get_context (data.loop); - while (g_main_context_pending (context)) - g_main_context_iteration (context, FALSE); } g_main_loop_unref (data.loop);
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/timeout-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/timeout-test.c
Changed
@@ -180,6 +180,7 @@ timeout_finish_message (gpointer msg) { soup_server_message_unpause (msg); + g_object_unref (msg); return FALSE; } @@ -199,7 +200,7 @@ GSource *timeout; soup_server_message_pause (msg); timeout = soup_add_timeout (g_main_context_get_thread_default (), - 4000, timeout_finish_message, msg); + 4000, timeout_finish_message, g_object_ref (msg)); g_source_unref (timeout); } }
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/uri-parsing-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/uri-parsing-test.c
Changed
@@ -51,10 +51,12 @@ do_copy_tests (void) { GUri *uri; + GUri *uri2; GUri *copy; char *str; uri = g_uri_parse ("http://127.0.0.1:1234/foo#bar", SOUP_HTTP_URI_FLAGS, NULL); + uri2 = g_uri_parse ("http://127.0.0.1", SOUP_HTTP_URI_FLAGS, NULL); /* Exact copy */ copy = soup_uri_copy (uri, SOUP_URI_NONE); @@ -91,6 +93,13 @@ g_free (str); g_uri_unref (copy); + /* Switch protocols without explicit port */ + copy = soup_uri_copy (uri2, SOUP_URI_SCHEME, "https", SOUP_URI_NONE); + str = g_uri_to_string (copy); + g_assert_cmpstr (str, ==, "https://127.0.0.1/"); + g_free (str); + g_uri_unref (copy); + /* Update everything */ copy = soup_uri_copy (uri, SOUP_URI_SCHEME, "https", @@ -114,6 +123,7 @@ g_uri_unref (copy); g_uri_unref (uri); + g_uri_unref (uri2); } #define CONTENT_TYPE_DEFAULT "text/plain;charset=US-ASCII"
View file
_service:tar_scm:libsoup-3.2.2.tar.xz/tests/websocket-test.c -> _service:tar_scm:libsoup-3.4.4.tar.xz/tests/websocket-test.c
Changed
@@ -907,6 +907,56 @@ g_assert_cmpstr (soup_message_headers_get_one (soup_message_get_response_headers (test->msg), "Sec-WebSocket-Protocol"), ==, NULL); } +static const char *invalid_protocols = { "", NULL }; + +static void +test_soup_websocket_client_prepare_handshake_ignores_invalid_protocols (Test *test, + gconstpointer unused) +{ + SoupMessage *msg; + const char *protocol; + msg = soup_message_new ("GET", "http://127.0.0.1"); + soup_websocket_client_prepare_handshake (msg, NULL, (char **) invalid_protocols, NULL); + + protocol = soup_message_headers_get_one (soup_message_get_request_headers (msg), "Sec-WebSocket-Protocol"); + g_assert_cmpstr (protocol, ==, NULL); +} + +static void +test_protocol_client_invalid_direct (Test *test, + gconstpointer unused) +{ + SoupMessage *msg; + SoupServerMessage *server_msg; + SoupMessageHeaders *request_headers; + SoupMessageHeadersIter iter; + const char *name, *value; + gboolean ok; + GError *error = NULL; + + msg = soup_message_new ("GET", "http://127.0.0.1"); + soup_websocket_client_prepare_handshake (msg, NULL, NULL, NULL); + soup_message_headers_append (soup_message_get_request_headers (msg), "Sec-WebSocket-Protocol", ""); + + server_msg = g_object_new (SOUP_TYPE_SERVER_MESSAGE, NULL); + soup_server_message_set_method (server_msg, soup_message_get_method (msg)); + soup_server_message_set_uri (server_msg, soup_message_get_uri (msg)); + request_headers = soup_server_message_get_request_headers (server_msg); + soup_message_headers_iter_init (&iter, soup_message_get_request_headers (msg)); + while (soup_message_headers_iter_next (&iter, &name, &value)) + soup_message_headers_append (request_headers, name, value); + ok = soup_websocket_server_check_handshake (server_msg, NULL, (char **) all_protocols, NULL, &error); + g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE); + g_assert_false (ok); + + ok = soup_websocket_server_process_handshake (server_msg, NULL, (char **) all_protocols, NULL, NULL); + g_assert_false (ok); + + + g_object_unref (msg); + g_object_unref (server_msg); +} + typedef enum { CLOSE_TEST_FLAG_SERVER = 1 << 0, CLOSE_TEST_FLAG_CLIENT = 1 << 1 @@ -2166,6 +2216,12 @@ test_protocol_client_any_soup, teardown_soup_connection); + g_test_add ("/websocket/direct/invalid-protocols-ignored", Test, NULL, NULL, + test_soup_websocket_client_prepare_handshake_ignores_invalid_protocols, + NULL); + g_test_add ("/websocket/direct/invalid-protocols-rejected", Test, NULL, NULL, + test_protocol_client_invalid_direct, + NULL); g_test_add ("/websocket/direct/receive-fragmented", Test, NULL, setup_half_direct_connection,
View file
_service:tar_scm:libsoup3.yaml
Changed
@@ -1,4 +1,4 @@ version_control: gitlab.gnome src_repo: libsoup tag_prefix: ^v -seperator: . +separator: .
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2