This adds API for web browsers to set extra information to support
same-site cookies.
Note that usage of SoupSession alone does not provide enough
information to reasonably use these at the moment and require
manually setting the information with the extra context a browser
may have.
Add soup_hsts_enforcer_get_domains() which returns a list of domains
for which there are HSTS policies. This API is needed to allow
WebKit's data manager to handle HSTS policies.
Add new API to add WebSocket extensions to SoupSession and SoupServer
and include an implementation of permessage-deflate extension (see RFC
7692). In the client side, supported extensions are added to the session
as sub-features of a new session feature, SoupWebsocketExtensionManager.
In the client side, supported extensions are added/removed directly using
the new SoupServer API. All functions to negotiate the handshake
(client_prepare, client_verify, server_check and server_process) have
now a _with_extensions alternative to handle the extensions.
RFC 6455 says that text messages should contains valid UTF-8, and null
characters valid according to RFC 3629. However, we are using
g_utf8_validate(), which considers null characters as errors, to
validate WebSockets text messages. This patch adds an internal
utf8_validate() function based on g_utf8_validate() but allowing null
characters and just returning a gboolean since we are always ignoring
the end parameter in case of errors.
soup_websocket_connection_send_text() assumes the given text is null
terminated, so we need a new public function to allow sending text
messages containing null characters. This patch adds
soup_websocket_connection_send_message() that receives a
SoupWebsocketDataType and GBytes, which is consistent with
SoupWebsocketConnection::message signal.
This is a comprehensive rework of the HSTS enforcer and related
classes, based upon Adrien Plazas work. A summary of the most
relevant changes:
SoupHSTSEnforcer:
- The enforcer will listen on headers both on message queueing
and restarting. This is necessary in order to be able to enforce
HSTS redirections on messages that are restarted for whatever
reason.
- Instead of causing a redirection, the URI will be overwritten
directly on the message before it is sent. Redirections
are for use on the server side, and the tests added show that
it is not a reliable way to do HSTS enforcing. Currently,
the only way to find out that a HSTS policy has been enforced
is by listening to the SoupMessage:uri property changes, but
this might be impractical, so this could be revisited in the
future.
- soup_hsts_enforcer_policy() will not steal the given policy.
Doing so is prone to leaks and not customary.
- SoupHSTSEnforcerClass now has a has_valid_policy() vfunc.
It currently works exactly as before, but the idea here is to
make it possible for subclasses to implement their own check
for existence of valid policies for domains, instead of all
subclasses having to add their policies to the base
SoupHSTSEnforcer class. This will be useful when having a large
number of pre-loaded HSTS policies (either in SoupHSTSEnforcerDB
or in an enforcer using libhsts as a backend) to avoid having
potentially thousands of policies in memory at all times.
- HSTS headers are parsed using soup's available utilities,
instead of parsing them by hand. The specification is carefully
followed so as to not accept any header that is not fully
compliant.
SoupHSTSEnforcerDB:
- Store the max-age attribute in the database. This was done before
errata 5372 was reported to RFC 6797, and its necessity will
depend on how the errata is treated.
Other:
- Added tests for both enforcer classes that cover most of the
specification.
- Added the gtk-doc documentation and update all the documentation
comments.
- Rename SoupHsts classes to SoupHSTS for consistent naming and
other minor renaming of parameters and methods.
These functions extend the existing parameter-parsing functions
but differ in that they return NULL if there are any duplicated
parameters. It is noted in their documentation that they
are not recommended to parse header fields that might contain
RFC5987-encoded parameters.
Add tests for the parameter parsing methods that cover the
different cases, including RFC5789-encoded parameters.
Add soup_session_connect_async() to create a new dedicated connection to
the given SoupURI. The operation finishes when the connection has been
completed, including any TLS handshacking or proxy negotiation,
returning a GIOStream that can be used to communicate with the server.
This is based on a patch by Dirkjan Ochtman <[email protected]>.
https://bugzilla.gnome.org/show_bug.cgi?id=792212
If a "WWW-Authenticate: Negotiate" HTTP header is spotted libsoup will check if
the host is on blacklist and the authentication fails if so. Otherwise the host
is compared against a trusted URIs (if the trusted URIs list is not set all
the HTTPS requests are trusted by default) and then processed. The trusted URIs
list and blacklist are both created when a SoupNegotiateAuth is created. The
trusted URIs list (blacklist) is parsed from the SOUP_GSSAPI_TRUSTED_URIS (
SOUP_GSSAPI_BLACKLIST_URIS) environment variable that expects the URIs be comma
separated (e.g. "http://www.example.com,https://www.test.com:80"). Then the
request is processed by the GSS library (the SPNEGO mechanism is used) which
produces a token that is send back to the server in the next request. The reply
is then again processed by the GSS library and the authentication succeeds by
receiving the GSS_S_COMPLETE status or we continue negotiating when the
GSS_S_CONTINUE_NEEDED is received.
The SoupAuth object is marked as not authenticated if a user will try to call
the soup_auth_authenticate() with the credentials provided as this is not
supported.
If the libsoup is configured with GSS-Negotiate support, a Kerberos library with
GSSAPI support needs to be available on the system (MIT Kerberos was tested
while working on this). Developers can check whether the libsoup was
compiled with the GSS-Negotiate support enabled by checking the
soup_auth_negotiate_supported() function.
To easily test the GSS-Negotiate functionality a new argument "N" was added to
the examples/get utility.
A support for NTLMSSP is provided by this patch given that a Kerberos library
supports NTLMSSP mechanism via GSSAPI. For MIT Kerberos one can use gss-ntlmssp
module, https://fedorahosted.org/gss-ntlmssp/.
Co-Authored-By: Tomas Popela <[email protected]>
Co-Authored-By: David Woodhouse <[email protected]>
Co-Authored-By: Dan Winship <[email protected]>
This allows using e.g. g_autoptr(SoupSession) in other programs, but
does not make libsoup itself use g_autoptr, or require a new enough glib
to support it.
https://bugzilla.gnome.org/show_bug.cgi?id=754721
Add new SoupSession and SoupServer API to use the new WebSocket
support.
Based on code originally from the Cockpit project, and on earlier work
by Lionel Landwerlin to merge that into libsoup.
https://bugzilla.gnome.org/show_bug.cgi?id=627738
Add functions to create and parse WebSocket handshakes, and to
communicate on a WebSocket connection.
Based on code originally from the Cockpit project, and on earlier work
by Lionel Landwerlin to merge that into libsoup.
https://bugzilla.gnome.org/show_bug.cgi?id=627738
Add a method to allow stealing a connection from a SoupSession.
Includes a new test using both this and
soup_client_context_steal_connection() to perform an upgrade on both
sides of a previously-HTTP connection.
https://bugzilla.gnome.org/show_bug.cgi?id=721343
Add a method to allow a SoupServer handler to steal the connection
from the server, and use this in simple-proxy to implement CONNECT.
Incorporates a patch from Lionel Landwerlin.
Allow a GIOStream to be accepted as new client connection by the
SoupServer. This is useful for clients that do not want to rely on
system sockets for example.
https://bugzilla.gnome.org/show_bug.cgi?id=744186
Finish up the GProxyResolver porting started in 2.42 by removing all
the non-GProxyResolver proxy code from SoupSocket and SoupConnection
and implementing SoupSession:proxy-uri in terms of
GSimpleProxyResolver. If the user adds a SoupProxyResolverDefault to
the session, just use its GProxyResolver directly instead. If the user
adds any other kind of SoupProxyURIResolver to the session, use the
new SoupProxyResolverWrapper, which is a GProxyResolver that
translates from SoupProxyURIResolver.
https://bugzilla.gnome.org/show_bug.cgi?id=680273
Rename SoupKnownStatusCode to SoupStatus (so that the type name
matches the enum values), and then, for backward-compatibility, add a
new SoupKnownStatusCode enum with equivalent values so that
introspection-using code that was doing "SoupKnownStatusCode.OK", etc,
will still work.
https://bugzilla.gnome.org/show_bug.cgi?id=684409