The abstract base class for handling authentication. Specific HTTP Authentication mechanisms are implemented by its subclasses, but applications never need to be aware of the specific subclasses being used. #SoupAuth objects store the authentication data associated with a given bit of web space. They are created automatically by [class@Session]. Creates a new #SoupAuth of type @type with the information from @msg and @auth_header. This is called by [class@Session]; you will normally not create auths yourself. the new #SoupAuth, or %NULL if it could not be created the type of auth to create (a subtype of #SoupAuth) the #SoupMessage the auth is being created for the WWW-Authenticate/Proxy-Authenticate header Call this on an auth to authenticate it. Normally this will cause the auth's message to be requeued with the new authentication info. a #SoupAuth the username provided by the user or client the password provided by the user or client Tests if @auth is able to authenticate by providing credentials to the [method@Auth.authenticate]. %TRUE if @auth is able to accept credentials. a #SoupAuth Generates an appropriate "Authorization" header for @msg. (The session will only call this if [method@Auth.is_authenticated] returned %TRUE.) the "Authorization" header, which must be freed. a #SoupAuth the #SoupMessage to be authorized Returns a list of paths on the server which @auth extends over. (All subdirectories of these paths are also assumed to be part of @auth's protection space, unless otherwise discovered not to be.) the list of paths, which can be freed with [method@Auth.free_protection_space]. a #SoupAuth the URI of the request that @auth was generated in response to. Tests if @auth has been given a username and password. %TRUE if @auth has been given a username and password a #SoupAuth Tests if @auth is ready to make a request for @msg with. For most auths, this is equivalent to [method@Auth.is_authenticated], but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated. %TRUE if @auth is ready to make a request with. a #SoupAuth a #SoupMessage Updates @auth with the information from @msg and @auth_header, possibly un-authenticating it. As with [ctor@Auth.new], this is normally only used by [class@Session]. %TRUE if @auth is still a valid (but potentially unauthenticated) #SoupAuth. %FALSE if something about @auth_params could not be parsed or incorporated into @auth at all. a #SoupAuth the #SoupMessage @auth is being updated for the WWW-Authenticate/Proxy-Authenticate header Call this on an auth to authenticate it. Normally this will cause the auth's message to be requeued with the new authentication info. a #SoupAuth the username provided by the user or client the password provided by the user or client Tests if @auth is able to authenticate by providing credentials to the [method@Auth.authenticate]. %TRUE if @auth is able to accept credentials. a #SoupAuth Call this on an auth to cancel it. You need to cancel an auth to complete an asynchronous authenticate operation when no credentials are provided ([method@Auth.authenticate] is not called). The #SoupAuth will be cancelled on dispose if it hans't been authenticated. a #SoupAuth Frees @space. a #SoupAuth the return value from [method@Auth.get_protection_space] Returns the authority (host:port) that @auth is associated with. the authority a #SoupAuth Generates an appropriate "Authorization" header for @msg. (The session will only call this if [method@Auth.is_authenticated] returned %TRUE.) the "Authorization" header, which must be freed. a #SoupAuth the #SoupMessage to be authorized Gets an opaque identifier for @auth. The identifier can be used as a hash key or the like. #SoupAuth objects from the same server with the same identifier refer to the same authentication domain (eg, the URLs associated with them take the same usernames and passwords). the identifier a #SoupAuth Returns a list of paths on the server which @auth extends over. (All subdirectories of these paths are also assumed to be part of @auth's protection space, unless otherwise discovered not to be.) the list of paths, which can be freed with [method@Auth.free_protection_space]. a #SoupAuth the URI of the request that @auth was generated in response to. Returns @auth's realm. This is an identifier that distinguishes separate authentication spaces on a given server, and may be some string that is meaningful to the user. (Although it is probably not localized.) the realm name a #SoupAuth soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name) Returns @auth's scheme name. (Eg, "Basic", "Digest", or "NTLM") the scheme name a #SoupAuth Tests if @auth has been given a username and password. %TRUE if @auth has been given a username and password a #SoupAuth Tests if @auth has been cancelled %TRUE if @auth has been cancelled a #SoupAuth Tests whether or not @auth is associated with a proxy server rather than an "origin" server. %TRUE or %FALSE a #SoupAuth Tests if @auth is ready to make a request for @msg with. For most auths, this is equivalent to [method@Auth.is_authenticated], but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated. %TRUE if @auth is ready to make a request with. a #SoupAuth a #SoupMessage Updates @auth with the information from @msg and @auth_header, possibly un-authenticating it. As with [ctor@Auth.new], this is normally only used by [class@Session]. %TRUE if @auth is still a valid (but potentially unauthenticated) #SoupAuth. %FALSE if something about @auth_params could not be parsed or incorporated into @auth at all. a #SoupAuth the #SoupMessage @auth is being updated for the WWW-Authenticate/Proxy-Authenticate header The authority (host:port) being authenticated to. Whether or not the auth has been authenticated. Whether or not the auth has been cancelled. Whether or not the auth is for a proxy server. The authentication realm. The authentication scheme name. HTTP "Basic" authentication. [class@Session]s support this by default; if you want to disable support for it, call [method@Session.remove_feature_by_type], passing %SOUP_TYPE_AUTH_BASIC. %TRUE if @auth is still a valid (but potentially unauthenticated) #SoupAuth. %FALSE if something about @auth_params could not be parsed or incorporated into @auth at all. a #SoupAuth the #SoupMessage @auth is being updated for the WWW-Authenticate/Proxy-Authenticate header the list of paths, which can be freed with [method@Auth.free_protection_space]. a #SoupAuth the URI of the request that @auth was generated in response to. a #SoupAuth the username provided by the user or client the password provided by the user or client %TRUE if @auth has been given a username and password a #SoupAuth the "Authorization" header, which must be freed. a #SoupAuth the #SoupMessage to be authorized %TRUE if @auth is ready to make a request with. a #SoupAuth a #SoupMessage %TRUE if @auth is able to accept credentials. a #SoupAuth HTTP "Digest" authentication. [class@Session]s support this by default; if you want to disable support for it, call [method@Session.remove_feature_by_type] passing %SOUP_TYPE_AUTH_DIGEST. Server-side authentication. A #SoupAuthDomain manages authentication for all or part of a [class@Server]. To make a server require authentication, first create an appropriate subclass of #SoupAuthDomain, and then add it to the server with [method@Server.add_auth_domain]. In order for an auth domain to have any effect, you must add one or more paths to it (via [method@AuthDomain.add_path]). To require authentication for all ordinary requests, add the path `"/"`. (Note that this does not include the special `"*"` URI (eg, "OPTIONS *"), which must be added as a separate path if you want to cover it.) If you need greater control over which requests should and shouldn't be authenticated, add paths covering everything you *might* want authenticated, and then use a filter ([method@AuthDomain.set_filter] to bypass authentication for those requests that don't need it. Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to @msg. It requests that the client authenticate, and sets @msg's status accordingly. This is used by [class@Server] internally and is probably of no use to anyone else. a #SoupAuthDomain a #SoupServerMessage Checks if @msg authenticates to @domain via @username and @password. This would normally be called from a [callback@AuthDomainGenericAuthCallback]. whether or not the message is authenticated a #SoupAuthDomain a #SoupServerMessage a username a password Checks if @msg contains appropriate authorization for @domain to accept it. Mirroring [method@AuthDomain.covers], this does not check whether or not @domain *cares* if @msg is authorized. This is used by [class@Server] internally and is probably of no use to anyone else. the username that @msg has authenticated as, if in fact it has authenticated. %NULL otherwise. a #SoupAuthDomain a #SoupServerMessage Adds @path to @domain. Requests under @path on @domain's server will require authentication (unless overridden by [method@AuthDomain.remove_path] or [method@AuthDomain.set_filter]). a #SoupAuthDomain the path to add to @domain Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to @msg. It requests that the client authenticate, and sets @msg's status accordingly. This is used by [class@Server] internally and is probably of no use to anyone else. a #SoupAuthDomain a #SoupServerMessage Checks if @msg authenticates to @domain via @username and @password. This would normally be called from a [callback@AuthDomainGenericAuthCallback]. whether or not the message is authenticated a #SoupAuthDomain a #SoupServerMessage a username a password Checks if @domain requires @msg to be authenticated (according to its paths and filter function). This does not actually look at whether @msg *is* authenticated, merely whether or not it needs to be. This is used by [class@Server] internally and is probably of no use to anyone else. %TRUE if @domain requires @msg to be authenticated a #SoupAuthDomain a #SoupServerMessage Gets the realm name associated with @domain. @domain's realm a #SoupAuthDomain Removes @path from @domain. Requests under @path on @domain's server will NOT require authentication. This is not simply an undo-er for [method@AuthDomain.add_path]; it can be used to "carve out" a subtree that does not require authentication inside a hierarchy that does. Note also that unlike with [method@AuthDomain.add_path], this cannot be overridden by adding a filter, as filters can only bypass authentication that would otherwise be required, not require it where it would otherwise be unnecessary. a #SoupAuthDomain the path to remove from @domain Adds @filter as an authentication filter to @domain. The filter gets a chance to bypass authentication for certain requests that would otherwise require it. Eg, it might check the message's path in some way that is too complicated to do via the other methods, or it might check the message's method, and allow GETs but not PUTs. The filter function returns %TRUE if the request should still require authentication, or %FALSE if authentication is unnecessary for this request. To help prevent security holes, your filter should return %TRUE by default, and only return %FALSE under specifically-tested circumstances, rather than the other way around. Eg, in the example above, where you want to authenticate PUTs but not GETs, you should check if the method is GET and return %FALSE in that case, and then return %TRUE for all other methods (rather than returning %TRUE for PUT and %FALSE for all other methods). This way if it turned out (now or later) that some paths supported additional methods besides GET and PUT, those methods would default to being NOT allowed for unauthenticated users. You can also set the filter by setting the SoupAuthDomain:filter and [property@AuthDomain:filter-data properties], which can also be used to set the filter at construct time. a #SoupAuthDomain the auth filter for @domain data to pass to @filter destroy notifier to free @filter_data when @domain is destroyed Sets @auth_callback as an authentication-handling callback for @domain. Whenever a request comes in to @domain which cannot be authenticated via a domain-specific auth callback (eg, [callback@AuthDomainDigestAuthCallback]), the generic auth callback will be invoked. See [callback@AuthDomainGenericAuthCallback] for information on what the callback should do. a #SoupAuthDomain the auth callback data to pass to @auth_callback destroy notifier to free @auth_data when @domain is destroyed The [callback@AuthDomainFilter] for the domain. Data to pass to the [callback@AuthDomainFilter]. The [callback@AuthDomainGenericAuthCallback]. The data to pass to the [callback@AuthDomainGenericAuthCallback]. Whether or not this is a proxy auth domain. The realm of this auth domain. Server-side "Basic" authentication. #SoupAuthDomainBasic handles the server side of HTTP "Basic" (ie, cleartext password) authentication. Creates a #SoupAuthDomainBasic. You must set the [property@AuthDomain:realm] property, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional. the new #SoupAuthDomain name of first option, or %NULL option name/value pairs Sets the callback that @domain will use to authenticate incoming requests. For each request containing authorization, @domain will invoke the callback, and then either accept or reject the request based on @callback's return value. You can also set the auth callback by setting the [property@AuthDomainBasic:auth-callback] and [property@AuthDomainBasic:auth-data] properties, which can also be used to set the callback at construct time. the domain the callback data to pass to @auth_callback destroy notifier to free @user_data when @domain is destroyed The [callback@AuthDomainBasicAuthCallback]. The data to pass to the [callback@AuthDomainBasicAuthCallback]. Callback used by #SoupAuthDomainBasic for authentication purposes. The application should verify that @username and @password and valid and return %TRUE or %FALSE. If you are maintaining your own password database (rather than using the password to authenticate against some other system like PAM or a remote server), you should make sure you know what you are doing. In particular, don't store cleartext passwords, or easily-computed hashes of cleartext passwords, even if you don't care that much about the security of your server, because users will frequently use the same password for multiple sites, and so compromising any site with a cleartext (or easily-cracked) password database may give attackers access to other more-interesting sites as well. %TRUE if @username and @password are valid the domain the message being authenticated the username provided by the client the password provided by the client the data passed to [method@AuthDomainBasic.set_auth_callback] a #SoupAuthDomain a #SoupServerMessage whether or not the message is authenticated a #SoupAuthDomain a #SoupServerMessage a username a password Server-side "Digest" authentication. #SoupAuthDomainDigest handles the server side of HTTP "Digest" authentication. Creates a #SoupAuthDomainDigest. You must set the [property@AuthDomain:realm] property, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional. the new #SoupAuthDomain name of first option, or %NULL option name/value pairs Encodes the username/realm/password triplet for Digest authentication. That is, it returns a stringified MD5 hash of @username, @realm, and @password concatenated together. This is the form that is needed as the return value of #SoupAuthDomainDigest's auth handler. For security reasons, you should store the encoded hash, rather than storing the cleartext password itself and calling this method only when you need to verify it. This way, if your server is compromised, the attackers will not gain access to cleartext passwords which might also be usable at other sites. (Note also that the encoded password returned by this method is identical to the encoded password stored in an Apache .htdigest file.) the encoded password a username an auth realm name the password for @username in @realm Sets the callback that @domain will use to authenticate incoming requests. For each request containing authorization, @domain will invoke the callback, and then either accept or reject the request based on @callback's return value. You can also set the auth callback by setting the [property@AuthDomainDigest:auth-callback] and [property@AuthDomainDigest:auth-data] properties, which can also be used to set the callback at construct time. the domain the callback data to pass to @auth_callback destroy notifier to free @user_data when @domain is destroyed The [callback@AuthDomainDigestAuthCallback]. The data to pass to the [callback@AuthDomainDigestAuthCallback]. Callback used by #SoupAuthDomainDigest for authentication purposes. The application should look up @username in its password database, and return the corresponding encoded password (see [func@AuthDomainDigest.encode_password]. the encoded password, or %NULL if @username is not a valid user. @domain will free the password when it is done with it. the domain the message being authenticated the username provided by the client the data passed to [method@AuthDomainDigest.set_auth_callback] The prototype for a #SoupAuthDomain filter. See [method@AuthDomain.set_filter] for details. %TRUE if @msg requires authentication, %FALSE if not. a #SoupAuthDomain a #SoupServerMessage the data passed to [method@AuthDomain.set_filter] The prototype for a #SoupAuthDomain generic authentication callback. The callback should look up the user's password, call [method@AuthDomain.check_password], and use the return value from that method as its own return value. In general, for security reasons, it is preferable to use the auth-domain-specific auth callbacks (eg, [callback@AuthDomainBasicAuthCallback] and [callback@AuthDomainDigestAuthCallback]), because they don't require keeping a cleartext password database. Most users will use the same password for many different sites, meaning if any site with a cleartext password database is compromised, accounts on other servers might be compromised as well. For many of the cases where [class@Server] is used, this is not really relevant, but it may still be worth considering. %TRUE if @msg is authenticated, %FALSE if not. a #SoupAuthDomain the #SoupServerMessage being authenticated the username from @msg the data passed to [method@AuthDomain.set_generic_auth_callback] HTTP client-side authentication handler. #SoupAuthManager is the [iface@SessionFeature] that handles HTTP authentication for a [class@Session]. A #SoupAuthManager is added to the session by default, and normally you don't need to worry about it at all. However, if you want to disable HTTP authentication, you can remove the feature from the session with [method@Session.remove_feature_by_type] or disable it on individual requests with [method@Message.disable_feature]. You can use this with [method@Session.remove_feature_by_type] or [method@Message.disable_feature]. (Although this type has only been publicly visible since libsoup 2.42, it has always existed in the background, and you can use `g_type_from_name ("SoupAuthManager")` to get its [alias@GLib.Type] in earlier releases.) Clear all credentials cached by @manager. a #SoupAuthManager Records that @auth is to be used under @uri, as though a WWW-Authenticate header had been received at that URI. This can be used to "preload" @manager's auth cache, to avoid an extra HTTP round trip in the case where you know ahead of time that a 401 response will be returned. This is only useful for authentication types where the initial Authorization header does not depend on any additional information from the server. (Eg, Basic or NTLM, but not Digest.) a #SoupAuthManager the #GUri under which @auth is to be used the #SoupAuth to use HTTP-based NTLM authentication. [class@Session]s do not support this type by default; if you want to enable support for it, call [method@Session.add_feature_by_type], passing %SOUP_TYPE_AUTH_NTLM. HTTP-based GSS-Negotiate authentication, as defined by [RFC 4559](https://datatracker.ietf.org/doc/html/rfc4559). [class@Session]s do not support this type by default; if you want to enable support for it, call [method@Session.add_feature_by_type], passing %SOUP_TYPE_AUTH_NEGOTIATE. This auth type will only work if libsoup was compiled with GSSAPI support; you can check [func@AuthNegotiate.supported] to see if it was. Indicates whether libsoup was built with GSSAPI support. If this is %FALSE, %SOUP_TYPE_AUTH_NEGOTIATE will still be defined and can still be added to a [class@Session], but libsoup will never attempt to actually use this auth type. %TRUE if supported otherwise %FALSE Macro to test the version of libsoup being compiled against. Returns %TRUE if the version of the libsoup header files is the same as or newer than the passed-in version. major version (e.g. 2 for version 2.42.0) minor version (e.g. 42 for version 2.42.0) micro version (e.g. 0 for version 2.42.0) A constant corresponding to 1 day. For use with [ctor@Cookie.new] and [method@Cookie.set_max_age]. A constant corresponding to 1 hour. For use with [ctor@Cookie.new] and [method@Cookie.set_max_age]. A constant corresponding to 1 week. For use with [ctor@Cookie.new] and [method@Cookie.set_max_age]. A constant corresponding to 1 year. For use with [ctor@Cookie.new] and [method@Cookie.set_max_age]. File-based cache for HTTP resources. Creates a new #SoupCache. a new #SoupCache the directory to store the cached data, or %NULL to use the default one. Note that since the cache isn't safe to access for multiple processes at once, and the default directory isn't namespaced by process, clients are strongly discouraged from passing %NULL. the #SoupCacheType of the cache Will remove all entries in the @cache plus all the cache files. This is not thread safe and must be called only from the thread that created the #SoupCache a #SoupCache Synchronously writes the cache index out to disk. Contrast with [method@Cache.flush], which writes pending cache *entries* to disk. You must call this before exiting if you want your cache data to persist between sessions. This is not thread safe and must be called only from the thread that created the #SoupCache a #SoupCache Forces all pending writes in the @cache to be committed to disk. For doing so it will iterate the [struct@GLib.MainContext] associated with @cache's session as long as needed. Contrast with [method@Cache.dump], which writes out the cache index file. a #SoupCache Gets the maximum size of the cache. the maximum size of the cache, in bytes. a #SoupCache Loads the contents of @cache's index into memory. This is not thread safe and must be called only from the thread that created the #SoupCache a #SoupCache Sets the maximum size of the cache. a #SoupCache the maximum size of the cache, in bytes The directory to store the cache files. Whether the cache is private or shared. The type of cache; this affects what kinds of responses will be saved. a single-user cache a shared cache Indicates if a message should or shouldn't be cached. The message should be cached The message shouldn't be cached The messages cache should be invalidated The messages cache should be updated Handles decoding of HTTP messages. #SoupContentDecoder handles adding the "Accept-Encoding" header on outgoing messages, and processing the "Content-Encoding" header on incoming ones. Currently it supports the "gzip", "deflate", and "br" content codings. A #SoupContentDecoder will automatically be added to the session by default. (You can use [method@Session.remove_feature_by_type] if you don't want this.) If #SoupContentDecoder successfully decodes the Content-Encoding, the message body will contain the decoded data; however, the message headers will be unchanged (and so "Content-Encoding" will still be present, "Content-Length" will describe the original encoded length, etc). If "Content-Encoding" contains any encoding types that #SoupContentDecoder doesn't recognize, then none of the encodings will be decoded. (Note that currently there is no way to (automatically) use Content-Encoding when sending a request body, or to pick specific encoding types to support.) Sniffs the mime type of messages. A #SoupContentSniffer tries to detect the actual content type of the files that are being downloaded by looking at some of the data before the [class@Message] emits its [signal@Message::got-headers] signal. #SoupContentSniffer implements [iface@SessionFeature], so you can add content sniffing to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type]. Creates a new #SoupContentSniffer. a new #SoupContentSniffer Sniffs @buffer to determine its Content-Type. The result may also be influenced by the Content-Type declared in @msg's response headers. the sniffed Content-Type of @buffer; this will never be %NULL, but may be `application/octet-stream`. a #SoupContentSniffer the message to sniff a buffer containing the start of @msg's response body return location for Content-Type parameters (eg, "charset"), or %NULL Implements HTTP cookies, as described by [RFC 6265](http://tools.ietf.org/html/rfc6265.txt). To have a [class@Session] handle cookies for your appliction automatically, use a [class@CookieJar]. @name and @value will be set for all cookies. If the cookie is generated from a string that appears to have no name, then @name will be the empty string. @domain and @path give the host or domain, and path within that host/domain, to restrict this cookie to. If @domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has @domain as a suffix). Otherwise, it is a hostname and must match exactly. @expires will be non-%NULL if the cookie uses either the original "expires" attribute, or the newer "max-age" attribute. If @expires is %NULL, it indicates that neither "expires" nor "max-age" was specified, and the cookie expires at the end of the session. If @http_only is set, the cookie should not be exposed to untrusted code (eg, javascript), so as to minimize the danger posed by cross-site scripting attacks. Creates a new #SoupCookie with the given attributes. Use [method@Cookie.set_secure] and [method@Cookie.set_http_only] if you need to set those attributes on the returned cookie. If @domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has @domain as a suffix). Otherwise, it is a hostname and must match exactly. @max_age is used to set the "expires" attribute on the cookie; pass -1 to not include the attribute (indicating that the cookie expires with the current session), 0 for an already-expired cookie, or a lifetime in seconds. You can use the constants %SOUP_COOKIE_MAX_AGE_ONE_HOUR, %SOUP_COOKIE_MAX_AGE_ONE_DAY, %SOUP_COOKIE_MAX_AGE_ONE_WEEK and %SOUP_COOKIE_MAX_AGE_ONE_YEAR (or multiples thereof) to calculate this value. (If you really care 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. a new #SoupCookie. cookie name cookie value cookie domain or hostname cookie path, or %NULL max age of the cookie, or -1 for a session cookie Tests if @cookie should be sent to @uri. (At the moment, this does not check that @cookie's domain matches @uri, because it assumes that the caller has already done that. But don't rely on that; it may change in the future.) %TRUE if @cookie should be sent to @uri, %FALSE if not a #SoupCookie a #GUri Copies @cookie. a copy of @cookie a #SoupCookie Checks if the @cookie's domain and @host match. The domains match if @cookie should be sent when making a request to @host, or that @cookie should be accepted when receiving a response from @host. %TRUE if the domains match, %FALSE otherwise a #SoupCookie a URI Tests if @cookie1 and @cookie2 are equal. Note that currently, this does not check that the cookie domains match. This may change in the future. whether the cookies are equal. a #SoupCookie a #SoupCookie Frees @cookie. a #SoupCookie Gets @cookie's domain. @cookie's domain a #SoupCookie Gets @cookie's expiration time. @cookie's expiration time, which is owned by @cookie and should not be modified or freed. a #GDateTime Gets @cookie's HttpOnly attribute. @cookie's HttpOnly attribute a #SoupCookie Gets @cookie's name. @cookie's name a #SoupCookie Gets @cookie's path. @cookie's path a #SoupCookie Returns the same-site policy for this cookie. a #SoupSameSitePolicy a #SoupCookie Gets @cookie's secure attribute. @cookie's secure attribute a #SoupCookie Gets @cookie's value. @cookie's value a #SoupCookie Sets @cookie's domain to @domain. a #SoupCookie the new domain Sets @cookie's expiration time to @expires. If @expires is %NULL, @cookie will be a session cookie and will expire at the end of the client's session. (This sets the same property as [method@Cookie.set_max_age].) a #SoupCookie the new expiration time, or %NULL Sets @cookie's HttpOnly attribute to @http_only. If %TRUE, @cookie will be marked as "http only", meaning it should not be exposed to web page scripts or other untrusted code. a #SoupCookie the new value for the HttpOnly attribute Sets @cookie's max age to @max_age. If @max_age is -1, the cookie is a session cookie, and will expire at the end of the client's session. Otherwise, it is the number of seconds until the cookie expires. You can use the constants %SOUP_COOKIE_MAX_AGE_ONE_HOUR, %SOUP_COOKIE_MAX_AGE_ONE_DAY, %SOUP_COOKIE_MAX_AGE_ONE_WEEK and %SOUP_COOKIE_MAX_AGE_ONE_YEAR (or multiples thereof) to calculate this value. (A value of 0 indicates that the cookie should be considered already-expired.) This sets the same property as [method@Cookie.set_expires]. a #SoupCookie the new max age Sets @cookie's name to @name. a #SoupCookie the new name Sets @cookie's path to @path. a #SoupCookie the new path When used in conjunction with [method@CookieJar.get_cookie_list_with_same_site_info] this sets the policy of when this cookie should be exposed. a #SoupCookie a #SoupSameSitePolicy Sets @cookie's secure attribute to @secure. If %TRUE, @cookie will only be transmitted from the client to the server over secure (https) connections. a #SoupCookie the new value for the secure attribute Sets @cookie's value to @value. a #SoupCookie the new value Serializes @cookie in the format used by the Cookie header (ie, for returning a cookie from a [class@Session] to a server). the header a #SoupCookie Serializes @cookie in the format used by the Set-Cookie header. i.e. for sending a cookie from a [class@Server] to a client. the header a #SoupCookie Parses @header and returns a #SoupCookie. If @header contains multiple cookies, only the first one will be parsed. If @header does not have "path" or "domain" attributes, they will be defaulted from @origin. If @origin is %NULL, path will default to "/", but domain will be left as %NULL. Note that this is not a valid state for a #SoupCookie, and you will need to fill in some 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. a new #SoupCookie, or %NULL if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from @origin. a cookie string (eg, the value of a Set-Cookie header) origin of the cookie Automatic cookie handling for SoupSession. A #SoupCookieJar stores [struct@Cookie]s and arrange for them to be sent with the appropriate [class@Message]s. #SoupCookieJar implements [iface@SessionFeature], so you can add a cookie jar to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type]. Note that the base #SoupCookieJar class does not support any form of long-term cookie persistence. Creates a new #SoupCookieJar. The base #SoupCookieJar class does not support persistent storage of cookies; use a subclass for that. a new #SoupCookieJar Gets whether @jar stores cookies persistenly. %TRUE if @jar storage is persistent or %FALSE otherwise. a #SoupCookieJar Adds @cookie to @jar. Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past). @cookie will be 'stolen' by the jar, so don't free it afterwards. a #SoupCookieJar a #SoupCookie Adds @cookie to @jar. Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past). @first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar. @uri will be used to reject setting or overwriting secure cookies from insecure origins. %NULL is treated as secure. @cookie will be 'stolen' by the jar, so don't free it afterwards. a #SoupCookieJar a #SoupCookie the URI setting the cookie the URI for the main document Adds @cookie to @jar. Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past). @first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar. @cookie will be 'stolen' by the jar, so don't free it afterwards. For secure cookies to work properly you may want to use [method@CookieJar.add_cookie_full]. a #SoupCookieJar the URI for the main document a #SoupCookie Constructs a [struct@GLib.List] with every cookie inside the @jar. The cookies in the list are a copy of the original, so you have to free them when you are done with them. a #GSList with all the cookies in the @jar. a #SoupCookieJar Deletes @cookie from @jar. Emits the [signal@CookieJar::changed] signal. a #SoupCookieJar a #SoupCookie Gets @jar's [enum@CookieJarAcceptPolicy]. the #SoupCookieJarAcceptPolicy set in the @jar a #SoupCookieJar Retrieves the list of cookies that would be sent with a request to @uri as a [struct@GLib.List] of #SoupCookie objects. If @for_http is %TRUE, the return value will include cookies marked "HttpOnly" (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to %FALSE if you are calling this. a #GSList with the cookies in the @jar that would be sent with a request to @uri. a #SoupCookieJar a #GUri whether or not the return value is being passed directly to an HTTP operation This is an extended version of [method@CookieJar.get_cookie_list] that provides more information required to use SameSite cookies. See the [SameSite cookies spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more detailed information. a #GSList with the cookies in the @jar that would be sent with a request to @uri. a #SoupCookieJar a #GUri a #GUri for the top level document a #GUri indicating the origin to get cookies for whether or not the return value is being passed directly to an HTTP operation if the HTTP method is safe, as defined by RFC 7231, ignored when @for_http is %FALSE whether or not the HTTP request is part of top level navigation Retrieves (in Cookie-header form) the list of cookies that would be sent with a request to @uri. If @for_http is %TRUE, the return value will include cookies marked "HttpOnly" (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to %FALSE if you are calling this. the cookies, in string form, or %NULL if there are no cookies for @uri. a #SoupCookieJar a #GUri whether or not the return value is being passed directly to an HTTP operation Gets whether @jar stores cookies persistenly. %TRUE if @jar storage is persistent or %FALSE otherwise. a #SoupCookieJar Sets @policy as the cookie acceptance policy for @jar. a #SoupCookieJar a #SoupCookieJarAcceptPolicy Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri. Keep in mind that if the [enum@CookieJarAcceptPolicy] set is either %SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY or %SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY you'll need to use [method@CookieJar.set_cookie_with_first_party], otherwise the jar will have no way of knowing if the cookie is being set by a third party or not. a #SoupCookieJar the URI setting the cookie the stringified cookie to set Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri. @first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar. a #SoupCookieJar the URI setting the cookie the URI for the main document the stringified cookie to set The policy the jar should follow to accept or reject cookies. Whether or not the cookie jar is read-only. Emitted when @jar changes. If a cookie has been added, @new_cookie will contain the newly-added cookie and @old_cookie will be %NULL. If a cookie has been deleted, @old_cookie will contain the to-be-deleted cookie and @new_cookie will be %NULL. If a cookie has been changed, @old_cookie will contain its old value, and @new_cookie its new value. the old #SoupCookie value the new #SoupCookie value The policy for accepting or rejecting cookies returned in responses. accept all cookies unconditionally. reject all cookies unconditionally. accept all cookies set by the main document loaded in the application using libsoup. An example of the most common case, web browsers, would be: If http://www.example.com is the page loaded, accept all cookies set by example.com, but if a resource from http://www.third-party.com is loaded from that page reject any cookie that it could try to set. For libsoup to be able to tell apart first party cookies from the rest, the application must call [method@Message.set_first_party] on each outgoing [class@Message], setting the [struct@GLib.Uri] of the main document. If no first party is set in a message when this policy is in effect, cookies will be assumed to be third party by default. accept all cookies set by the main document loaded in the application using libsoup, and from domains that have previously set at least one cookie when loaded as the main document. An example of the most common case, web browsers, would be: if http://www.example.com is the page loaded, accept all cookies set by example.com, but if a resource from http://www.third-party.com is loaded from that page, reject any cookie that it could try to set unless it already has a cookie in the cookie jar. For libsoup to be able to tell apart first party cookies from the rest, the application must call [method@Message.set_first_party] on each outgoing #SoupMessage, setting the [struct@GLib.Uri] of the main document. If no first party is set in a message when this policy is in effect, cookies will be assumed to be third party by default. %TRUE if @jar storage is persistent or %FALSE otherwise. a #SoupCookieJar Database-based Cookie Jar. #SoupCookieJarDB is a [class@CookieJar] that reads cookies from and writes them to a sqlite database in the new Mozilla format. (This is identical to `SoupCookieJarSqlite` in libsoup-gnome; it has just been moved into libsoup proper, and renamed to avoid conflicting.) Creates a #SoupCookieJarDB. @filename will be read in at startup to create an initial set of cookies. If @read_only is %FALSE, then the non-session cookies will be written to @filename when the [signal@CookieJar::changed] signal is emitted from the jar. (If @read_only is %TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.) the new #SoupCookieJar the filename to read to/write from, or %NULL %TRUE if @filename is read-only Cookie-storage filename. Text-file-based ("cookies.txt") Cookie Jar #SoupCookieJarText is a [class@CookieJar] that reads cookies from and writes them to a text file in format similar to Mozilla's "cookies.txt". Creates a #SoupCookieJarText. @filename will be read in at startup to create an initial set of cookies. If @read_only is %FALSE, then the non-session cookies will be written to @filename when the [signal@CookieJar::changed] signal is emitted from the jar. (If @read_only is %TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.) the new #SoupCookieJar the filename to read to/write from %TRUE if @filename is read-only Cookie-storage filename. Marks a symbol as deprecated in favor of another symbol. You should use `SOUP_DEPRECATED_FOR_IN_*` in order to handle versioning. the symbol that replaces the deprecated one A macro used to indicate a symbol was deprecated in this version with a replacement. The recommended replacement function. A macro used to indicate a symbol was deprecated in this version with a replacement. The recommended replacement function. A macro used to indicate a symbol was deprecated in this version with a replacement. The recommended replacement function. A macro used to indicate a symbol was deprecated in this version with a replacement. The recommended replacement function. Date formats that [func@date_time_to_string] can use. @SOUP_DATE_HTTP and @SOUP_DATE_COOKIE always coerce the time to UTC. This enum may be extended with more values in future releases. RFC 1123 format, used by the HTTP "Date" header. Eg "Sun, 06 Nov 1994 08:49:37 GMT". The format for the "Expires" timestamp in the Netscape cookie specification. Eg, "Sun, 06-Nov-1994 08:49:37 GMT". How a message body is encoded for transport unknown / error no body is present (which is not the same as a 0-length body, and only occurs in certain places) Content-Length encoding Response body ends when the connection is closed chunked encoding (currently only supported for response) multipart/byteranges (Reserved for future use: NOT CURRENTLY IMPLEMENTED) Represents the parsed value of the "Expect" header. any unrecognized expectation "100-continue" A macro containing the value `multipart/form-data`; the MIME type used for posting form data that contains files to be uploaded. A macro containing the value `application/x-www-form-urlencoded`; the default MIME type for POSTing HTML form data. Automatic HTTP Strict Transport Security enforcing for [class@Session]. A #SoupHSTSEnforcer stores HSTS policies and enforces them when required. #SoupHSTSEnforcer implements [iface@SessionFeature], so you can add an HSTS enforcer to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type]. #SoupHSTSEnforcer keeps track of all the HTTPS destinations that, when connected to, return the Strict-Transport-Security header with valid values. #SoupHSTSEnforcer will forget those destinations upon expiry or when the server requests it. When the [class@Session] the #SoupHSTSEnforcer is attached to queues or restarts a message, the #SoupHSTSEnforcer will rewrite the URI to HTTPS if the destination is a known HSTS host and is contacted over an insecure transport protocol (HTTP). Users of #SoupHSTSEnforcer are advised to listen to changes in the [property@Message:uri] property in order to be aware of changes in the message URI. Note that #SoupHSTSEnforcer does not support any form of long-term HSTS policy persistence. See [class@HSTSEnforcerDB] for a persistent enforcer. Creates a new #SoupHSTSEnforcer. The base #SoupHSTSEnforcer class does not support persistent storage of HSTS policies, see [class@HSTSEnforcerDB] for that. a new #SoupHSTSEnforcer The class closure for the #SoupHSTSEnforcer::changed signal. Gets whether @hsts_enforcer has a currently valid policy for @domain. %TRUE if access to @domain should happen over HTTPS, false otherwise. a #SoupHSTSEnforcer a domain. Gets whether @hsts_enforcer stores policies persistenly. %TRUE if @hsts_enforcer storage is persistent or %FALSE otherwise. a #SoupHSTSEnforcer Gets a list of domains for which there are policies in @enforcer. a newly allocated list of domains. Use [func@GLib.List.free_full] and [func@GLib.free] to free the list. a #SoupHSTSEnforcer whether to include session policies Gets a list with the policies in @enforcer. a newly allocated list of policies. Use [func@GLib.List.free_full] and [method@HSTSPolicy.free] to free the list. a #SoupHSTSEnforcer whether to include session policies Gets whether @hsts_enforcer has a currently valid policy for @domain. %TRUE if access to @domain should happen over HTTPS, false otherwise. a #SoupHSTSEnforcer a domain. Gets whether @hsts_enforcer stores policies persistenly. %TRUE if @hsts_enforcer storage is persistent or %FALSE otherwise. a #SoupHSTSEnforcer Sets @policy to @hsts_enforcer. If @policy is expired, any existing HSTS policy for its host will be removed instead. If a policy existed for this host, it will be replaced. Otherwise, the new policy will be inserted. If the policy is a session policy, that is, one created with [ctor@HSTSPolicy.new_session_policy], the policy will not expire and will be enforced during the lifetime of @hsts_enforcer's [class@Session]. a #SoupHSTSEnforcer the policy of the HSTS host Sets a session policy for @domain. A session policy is a policy that is permanent to the lifetime of @hsts_enforcer's [class@Session] and doesn't expire. a #SoupHSTSEnforcer policy domain or hostname %TRUE if the policy applies on sub domains Emitted when @hsts_enforcer changes. If a policy has been added, @new_policy will contain the newly-added policy and @old_policy will be %NULL. If a policy has been deleted, @old_policy will contain the to-be-deleted policy and @new_policy will be %NULL. If a policy has been changed, @old_policy will contain its old value, and @new_policy its new value. Note that you shouldn't modify the policies from a callback to this signal. the old #SoupHSTSPolicy value the new #SoupHSTSPolicy value Class structure for #SoupHSTSEnforcer. The parent class. The @is_persistent function advertises whether the enforcer is persistent or whether changes made to it will be lost when the underlying [class@Session] is finished. %TRUE if @hsts_enforcer storage is persistent or %FALSE otherwise. a #SoupHSTSEnforcer The @has_valid_policy function is called to check whether there is a valid policy for the given domain. This method should return %TRUE for #SoupHSTSEnforcer to change the scheme of the #GUri in the #SoupMessage to HTTPS. Implementations might want to chain up to the @has_valid_policy in the parent class to check, for instance, for runtime policies. %TRUE if access to @domain should happen over HTTPS, false otherwise. a #SoupHSTSEnforcer a domain. The class closure for the #SoupHSTSEnforcer::changed signal. Persistent HTTP Strict Transport Security enforcer. #SoupHSTSEnforcerDB is a [class@HSTSEnforcer] that uses a SQLite database as a backend for persistency. Creates a #SoupHSTSEnforcerDB. @filename will be read in during the initialization of a #SoupHSTSEnforcerDB, in order to create an initial set of HSTS policies. If the file doesn't exist, a new database will be created and initialized. Changes to the policies during the lifetime of a #SoupHSTSEnforcerDB will be written to @filename when [signal@HSTSEnforcer::changed] is emitted. the new #SoupHSTSEnforcer the filename of the database to read/write from. The filename of the SQLite database where HSTS policies are stored. #SoupHSTSPolicy implements HTTP policies, as described by [RFC 6797](http://tools.ietf.org/html/rfc6797). @domain represents the host that this policy applies to. The domain must be IDNA-canonicalized. [ctor@HSTSPolicy.new] and related methods will do this for you. @max_age contains the 'max-age' value from the Strict Transport Security header and indicates the time to live of this policy, in seconds. @expires will be non-%NULL if the policy has been set by the host and hence has an expiry time. If @expires is %NULL, it indicates that the policy is a permanent session policy set by the user agent. If @include_subdomains is %TRUE, the Strict Transport Security policy must also be enforced on subdomains of @domain. Creates a new #SoupHSTSPolicy with the given attributes. @domain is a domain on which the strict transport security policy represented by this object must be enforced. @max_age is used to set the "expires" attribute on the policy; pass %SOUP_HSTS_POLICY_MAX_AGE_PAST for an already-expired policy, or a lifetime in seconds. If @include_subdomains is %TRUE, the strict transport security policy must also be enforced on all subdomains of @domain. a new #SoupHSTSPolicy. policy domain or hostname max age of the policy %TRUE if the policy applies on subdomains Parses @msg's first "Strict-Transport-Security" response header and returns a #SoupHSTSPolicy. a new #SoupHSTSPolicy, or %NULL if no valid "Strict-Transport-Security" response header was found. a #SoupMessage Full version of [ctor@HSTSPolicy.new], to use with an existing expiration date. See [ctor@HSTSPolicy.new] for details. a new #SoupHSTSPolicy. policy domain or hostname max age of the policy the date of expiration of the policy or %NULL for a permanent policy %TRUE if the policy applies on subdomains Creates a new session #SoupHSTSPolicy with the given attributes. A session policy is a policy that is valid during the lifetime of the [class@HSTSEnforcer] it is added to. Contrary to regular policies, it has no expiration date and is not stored in persistent enforcers. These policies are useful for user-agent to load their own or user-defined rules. @domain is a domain on which the strict transport security policy represented by this object must be enforced. If @include_subdomains is %TRUE, the strict transport security policy must also be enforced on all subdomains of @domain. a new #SoupHSTSPolicy. policy domain or hostname %TRUE if the policy applies on sub domains Copies @policy. a copy of @policy a #SoupHSTSPolicy Tests if @policy1 and @policy2 are equal. whether the policies are equal. a #SoupHSTSPolicy a #SoupHSTSPolicy Frees @policy. a #SoupHSTSPolicy Gets @policy's domain. @policy's domain. a #SoupHSTSPolicy Returns the expiration date for @policy. A #GDateTime or %NULL if unset a #SoupHSTSPolicy Returns the max age for @policy. Max age in seconds a #SoupHSTSPolicy Gets whether @policy include its subdomains. %TRUE if @policy includes subdomains, %FALSE otherwise. a #SoupHSTSPolicy Gets whether @policy is expired. Permanent policies never expire. %TRUE if @policy is expired, %FALSE otherwise. a #SoupHSTSPolicy Gets whether @policy is a non-permanent, non-expirable session policy. See [ctor@HSTSPolicy.new_session_policy] for details. %TRUE if @policy is permanent, %FALSE otherwise a #SoupHSTSPolicy An expiration date that is always in the past. Indicates the HTTP protocol version being used. HTTP 1.0 (RFC 1945) HTTP 1.1 (RFC 2616) HTTP 2.0 (RFC 7540) The set of #GUriFlags libsoup expects all #GUri to use. Debug logging support #SoupLogger watches a [class@Session] and logs the HTTP traffic that it generates, for debugging purposes. Many applications use an environment variable to determine whether or not to use #SoupLogger, and to determine the amount of debugging output. To use #SoupLogger, first create a logger with [ctor@Logger.new], optionally configure it with [method@Logger.set_request_filter], [method@Logger.set_response_filter], and [method@Logger.set_printer], and then attach it to a session (or multiple sessions) with [method@Session.add_feature]. By default, the debugging output is sent to `stdout`, and looks something like: ``` > POST /unauth HTTP/1.1 > Soup-Debug-Timestamp: 1200171744 > Soup-Debug: SoupSession 1 (0x612190), SoupMessage 1 (0x617000), GSocket 1 (0x612220) > Host: localhost > Content-Type: text/plain > Connection: close &lt; HTTP/1.1 201 Created &lt; Soup-Debug-Timestamp: 1200171744 &lt; Soup-Debug: SoupMessage 1 (0x617000) &lt; Date: Sun, 12 Jan 2008 21:02:24 GMT &lt; Content-Length: 0 ``` The `Soup-Debug-Timestamp` line gives the time (as a `time_t`) when the request was sent, or the response fully received. The `Soup-Debug` line gives further debugging information about the [class@Session], [class@Message], and [class@Gio.Socket] involved; the hex numbers are the addresses of the objects in question (which may be useful if you are running in a debugger). The decimal IDs are simply counters that uniquely identify objects across the lifetime of the #SoupLogger. In particular, this can be used to identify when multiple messages are sent across the same connection. Currently, the request half of the message is logged just before the first byte of the request gets written to the network (from the [signal@Message::starting] signal). The response is logged just after the last byte of the response body is read from the network (from the [signal@Message::got-body] or [signal@Message::got-informational] signal), which means that the [signal@Message::got-headers] signal, and anything triggered off it (such as #SoupMessage::authenticate) will be emitted *before* the response headers are actually logged. If the response doesn't happen to trigger the [signal@Message::got-body] nor [signal@Message::got-informational] signals due to, for example, a cancellation before receiving the last byte of the response body, the response will still be logged on the event of the [signal@Message::finished] signal. Creates a new #SoupLogger with the given debug level. If you need finer control over what message parts are and aren't logged, use [method@Logger.set_request_filter] and [method@Logger.set_response_filter]. a new #SoupLogger the debug level Get the maximum body size for @logger. the maximum body size, or -1 if unlimited a #SoupLogger Sets the maximum body size for @logger (-1 means no limit). a #SoupLogger the maximum body size to log Sets up an alternate log printing routine, if you don't want the log to go to `stdout`. a #SoupLogger the callback for printing logging output data to pass to the callback a #GDestroyNotify to free @printer_data Sets up a filter to determine the log level for a given request. For each HTTP request @logger will invoke @request_filter to determine how much (if any) of that request to log. (If you do not set a request filter, @logger will just always log requests at the level passed to [ctor@Logger.new].) a #SoupLogger the callback for request debugging data to pass to the callback a #GDestroyNotify to free @filter_data Sets up a filter to determine the log level for a given response. For each HTTP response @logger will invoke @response_filter to determine how much (if any) of that response to log. (If you do not set a response filter, @logger will just always log responses at the level passed to [ctor@Logger.new].) a #SoupLogger the callback for response debugging data to pass to the callback a #GDestroyNotify to free @filter_data The level of logging output. If [property@Logger:level] is %SOUP_LOGGER_LOG_BODY, this gives the maximum number of bytes of the body that will be logged. (-1 means "no limit".) The prototype for a logging filter. The filter callback will be invoked for each request or response, and should analyze it and return a [enum@LoggerLogLevel] value indicating how much of the message to log. a [enum@LoggerLogLevel] value indicating how much of the message to log the #SoupLogger the message being logged the data passed to [method@Logger.set_request_filter] or [method@Logger.set_response_filter] Describes the level of logging output to provide. No logging Log the Request-Line or Status-Line and the Soup-Debug pseudo-headers Log the full request/response headers Log the full headers and request/response bodies The prototype for a custom printing callback. @level indicates what kind of information is being printed. Eg, it will be %SOUP_LOGGER_LOG_HEADERS if @data is header data. @direction is either '<', '>', or ' ', and @data is the single line to print; the printer is expected to add a terminating newline. To get the effect of the default printer, you would do: ```c printf ("%c %s\n", direction, data); ``` the #SoupLogger the level of the information being printed. a single-character prefix to @data data to print the data passed to [method@Logger.set_printer] Like [func@get_major_version], but from the headers used at application compile time, rather than from the library linked against at application run time. Like [func@get_micro_version], but from the headers used at application compile time, rather than from the library linked against at application run time. Like [func@get_minor_version], but from the headers used at application compile time, rather than from the library linked against at application run time. The lifetime of the memory being passed. The memory is statically allocated and constant; libsoup can use the passed-in buffer directly and not need to worry about it being modified or freed. The caller has allocated the memory and libsoup will assume ownership of it and free it with [func@GLib.free]. The passed-in data belongs to the caller and libsoup will copy it into new memory leaving the caller free to reuse the original memory. Represents an HTTP message being sent or received. A #SoupMessage represents an HTTP message that is being sent or received. You would create a #SoupMessage with [ctor@Message.new] or [ctor@Message.new_from_uri], set up its fields appropriately, and send it. [property@Message:status-code] will normally be a [enum@Status] value, eg, %SOUP_STATUS_OK, though of course it might actually be an unknown status code. [property@Message:reason-phrase] is the actual text returned from the server, which may or may not correspond to the "standard" description of @status_code. At any rate, it is almost certainly not localized, and not very descriptive even if it is in the user's language; you should not use [property@Message:reason-phrase] in user-visible messages. Rather, you should look at [property@Message:status-code], and determine an end-user-appropriate message based on that and on what you were trying to do. Note that libsoup's terminology here does not quite match the HTTP specification: in RFC 2616, an "HTTP-message" is *either* a Request, *or* a Response. In libsoup, a #SoupMessage combines both the request and the response. Creates a new empty #SoupMessage, which will connect to @uri. the new #SoupMessage (or %NULL if @uri could not be parsed). the HTTP method for the created request the destination endpoint (as a string) Creates a new #SoupMessage and sets it up to send the given @encoded_form to @uri via @method. If @method is "GET", it will include the form data into @uri's query field, and if @method is "POST" or "PUT", it will be set as request body. This function takes the ownership of @encoded_form, that will be released with [func@GLib.free] when no longer in use. See also [func@form_encode], [func@form_encode_hash] and [func@form_encode_datalist]. the new #SoupMessage, or %NULL if @uri_string could not be parsed or @method is not "GET, "POST" or "PUT" the HTTP method for the created request (GET, POST or PUT) the destination endpoint (as a string) a encoded form Creates a new #SoupMessage and sets it up to send @multipart to @uri_string via POST. the new #SoupMessage, or %NULL if @uri_string could not be parsed the destination endpoint a #SoupMultipart Creates a new empty #SoupMessage, which will connect to @uri. the new #SoupMessage the HTTP method for the created request the destination endpoint Creates a new #SoupMessage to send `OPTIONS *` to a server. The path of @base_uri will be ignored. the new #SoupMessage the destination endpoint Adds @flags to the set of @msg's flags. a #SoupMessage a set of #SoupMessageFlags values Adds a signal handler to @msg for @signal. Similar to [func@GObject.signal_connect], but the @callback will only be run if @msg's incoming messages headers (that is, the `request_headers`) contain a header named @header. the handler ID from [func@GObject.signal_connect] a #SoupMessage signal to connect the handler to. HTTP response header to match against the header handler data to pass to @handler_cb Adds a signal handler to @msg for @signal. Similar to [func@GObject.signal_connect], but the @callback will only be run if @msg has the status @status_code. @signal must be a signal that will be emitted after @msg's status is set (this means it can't be a "wrote" signal). the handler ID from [func@GObject.signal_connect] a #SoupMessage signal to connect the handler to. status code to match against the header handler data to pass to @handler_cb Disables the actions of [iface@SessionFeature]s with the given @feature_type (or a subclass of that type) on @msg. @msg is processed as though the feature(s) hadn't been added to the session. Eg, passing #SOUP_TYPE_CONTENT_SNIFFER for @feature_type will disable Content-Type sniffing on the message. You must call this before queueing @msg on a session; calling it on a message that has already been queued is undefined. In particular, you cannot call this on a message that is being requeued after a redirect or authentication. a #SoupMessage the #GType of a #SoupSessionFeature Returns the unique idenfier for the last connection used. This may be 0 if it was a cached resource or it has not gotten a connection yet. An id or 0 if no connection. The #SoupMessage Gets @msg's first-party [struct@GLib.Uri]. the @msg's first party #GUri a #SoupMessage Gets the flags on @msg. the flags a #SoupMessage Returns whether HTTP/1 version is currently demanded for the @msg send. %TRUE, when HTTP/1 is demanded, %FALSE otherwise. The #SoupMessage Gets the HTTP version of @msg. This is the minimum of the version from the request and the version from the response. the HTTP version a #SoupMessage Gets whether @msg is intended to be used to send `OPTIONS *` to a server. %TRUE if the message is options ping, or %FALSE otherwise a #SoupMessage Returns if this message is set as a top level navigation. Used for same-site policy checks. Whether the current request is a top-level navitation a #SoupMessage Returns the method of this message. A method such as %SOUP_METHOD_GET The #SoupMessage Get the [struct@MessageMetrics] of @msg. If the flag %SOUP_MESSAGE_COLLECT_METRICS is not enabled for @msg this will return %NULL. a #SoupMessageMetrics The #SoupMessage Retrieves the [enum@MessagePriority]. If not set this value defaults to #SOUP_MESSAGE_PRIORITY_NORMAL. the priority of the message. a #SoupMessage Returns the reason phrase for the status of this message. the phrase The #SoupMessage Get the remote [class@Gio.SocketAddress] of the connection associated with the message. The returned address can be %NULL if the connection hasn't been established yet, or the resource was loaded from the disk cache. In case of proxy connections, the remote address returned is a [class@Gio.ProxyAddress]. If [property@Session:remote-connectable] is set the returned address id for the connection to the session's remote connectable. a #GSocketAddress or %NULL if the connection hasn't been established The #SoupMessage Returns the headers sent with the request. The #SoupMessageHeaders The #SoupMessage Returns the headers recieved with the response. The #SoupMessageHeaders The #SoupMessage Gets @msg's site for cookies #GUri. the @msg's site for cookies #GUri a #SoupMessage Returns the set status of this message. The #SoupStatus The #SoupMessage Gets the name of the TLS ciphersuite negotiated for @msg's connection. the name of the TLS ciphersuite, or %NULL if @msg's connection is not SSL. a #SoupMessage Gets the peer's [class@Gio.TlsCertificate] associated with @msg's connection. Note that this is not set yet during the emission of [signal@Message::accept-certificate] signal. @msg's TLS peer certificate, or %NULL if @msg's connection is not SSL. a #SoupMessage Gets the errors associated with validating @msg's TLS peer certificate. Note that this is not set yet during the emission of [signal@Message::accept-certificate] signal. a #GTlsCertificateFlags with @msg's TLS peer certificate errors. a #SoupMessage Gets the TLS protocol version negotiated for @msg's connection. If the message connection is not SSL, %G_TLS_PROTOCOL_VERSION_UNKNOWN is returned. a #GTlsProtocolVersion a #SoupMessage Gets @msg's URI. the URI @msg is targeted for. a #SoupMessage Get whether [iface@SessionFeature]s of the given @feature_type (or a subclass of that type) are disabled on @msg. See [method@Message.disable_feature]. %TRUE if feature is disabled, or %FALSE otherwise. a #SoupMessage the #GType of a #SoupSessionFeature Determines whether or not @msg's connection can be kept alive for further requests after processing @msg. The result is based on the HTTP version, Connection header, etc. %TRUE or %FALSE. a #SoupMessage Queries if @flags are present in the set of @msg's flags. %TRUE if @flags are enabled in @msg a #SoupMessage a set of #SoupMessageFlags values Removes @flags from the set of @msg's flags. a #SoupMessage a set of #SoupMessageFlags values Sets @first_party as the main document #GUri for @msg. For details of when and how this is used refer to the documentation for [enum@CookieJarAcceptPolicy]. a #SoupMessage the #GUri for the @msg's first party Sets the specified flags on @msg. a #SoupMessage a set of #SoupMessageFlags values 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. The #SoupMessage value to set Set whether @msg is intended to be used to send `OPTIONS *` to a server. When set to %TRUE, the path of [property@Message:uri] will be ignored and [property@Message:method] set to %SOUP_METHOD_OPTIONS. a #SoupMessage the value to set Sets whether the current request is a top-level navitation. See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more information. a #SoupMessage if %TRUE indicate the current request is a top-level navigation Set @msg's HTTP method to @method. a #SoupMessage the value to set Sets the priority of a message. Note that this won't have any effect unless used before the message is added to the session's message processing queue. The message will be placed just before any other previously added message with lower priority (messages with the same priority are processed on a FIFO basis). Setting priorities does not currently work with synchronous messages because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling. a #SoupMessage the #SoupMessagePriority Set the request body of a #SoupMessage. If @content_type is %NULL and @stream is not %NULL the Content-Type header will not be changed if present. The request body needs to be set again in case @msg is restarted (in case of redirection or authentication). the message MIME Content-Type of the body, or %NULL if unknown a #GInputStream to read the request body from the byte length of @stream or -1 if unknown Set the request body of a #SoupMessage from [struct@GLib.Bytes]. If @content_type is %NULL and @bytes is not %NULL the Content-Type header will not be changed if present. The request body needs to be set again in case @msg is restarted (in case of redirection or authentication). the message MIME Content-Type of the body, or %NULL if unknown a #GBytes with the request body data Sets @site_for_cookies as the policy URL for same-site cookies for @msg. It is either the URL of the top-level document or %NULL depending on whether the registrable domain of this document's URL matches the registrable domain of its parent's/opener's URL. For the top-level document it is set to the document's URL. See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more information. a #SoupMessage the #GUri for the @msg's site for cookies Sets the @certificate to be used by @msg's connection when a client certificate is requested during the TLS handshake. You can call this as a response to [signal@Message::request-certificate] signal, or before the connection is started. If @certificate is %NULL the handshake will continue without providing a GTlsCertificate. Note that the [class@Gio.TlsCertificate] set by this function will be ignored if [property@Session:tls-interaction] is not %NULL. a #SoupMessage the #GTlsCertificate to set, or %NULL Sets @msg's URI to @uri. If @msg has already been sent and you want to re-send it with the new URI, you need to send it again. a #SoupMessage the new #GUri Completes a certificate password request. You must call this as a response to [signal@Message::request-certificate-password] signal, to notify @msg that the [class@Gio.TlsPassword] has already been updated. a #SoupMessage The [struct@GLib.Uri] loaded in the application when the message was queued. Various message options. The HTTP protocol version to use. Whether the message is an OPTIONS ping. The #SoupMessage is intended to be used to send `OPTIONS *` to a server. When set to %TRUE, the path of [property@Message:uri] will be ignored and [property@Message:method] set to %SOUP_METHOD_OPTIONS. Set when the message is navigating between top level domains. The message's HTTP method. Sets the priority of the #SoupMessage. See [method@Message.set_priority] for further details. The HTTP response reason phrase. The remote [class@Gio.SocketAddress] of the connection associated with the message. The HTTP request headers. The HTTP response headers. Site used to compare cookies against. Used for SameSite cookie support. The HTTP response status code. The Name of TLS ciphersuite negotiated for this message connection. The peer's [class@Gio.TlsCertificate] associated with the message. The verification errors on [property@Message:tls-peer-certificate]. The TLS protocol version negotiated for the message connection. The message's Request-URI. Emitted during the @msg's connection TLS handshake after an unacceptable TLS certificate has been received. You can return %TRUE to accept @tls_certificate despite @tls_errors. %TRUE to accept the TLS certificate and stop other handlers from being invoked, or %FALSE to propagate the event further. the peer's #GTlsCertificate the tls errors of @tls_certificate Emitted when the message requires authentication. If credentials are available call [method@Auth.authenticate] on @auth. If these credentials fail, the signal will be emitted again, with @retrying set to %TRUE, which will continue until you return without calling [method@Auth.authenticate] on @auth. Note that this may be emitted before @msg's body has been fully read. You can authenticate @auth asynchronously by calling [method@GObject.Object.ref] on @auth and returning %TRUE. The operation will complete once either [method@Auth.authenticate] or [method@Auth.cancel] are called. %TRUE to stop other handlers from being invoked or %FALSE to propagate the event further. the #SoupAuth to authenticate %TRUE if this is the second (or later) attempt This signal is emitted after [signal@Message::got-headers]. If content sniffing is disabled, or no content sniffing will be performed, due to the sniffer deciding to trust the Content-Type sent by the server, this signal is emitted immediately after [signal@Message::got-headers], and @type is %NULL. the content type that we got from sniffing a #GHashTable with the parameters Emitted when all HTTP processing is finished for a message. (After [signal@Message::got_body]). Emitted after receiving the complete message response body. Emitted after reading a portion of the message body from the network. the number of bytes read Emitted after receiving the Status-Line and response headers. See also [method@Message.add_header_handler] and [method@Message.add_status_code_handler], which can be used to connect to a subset of emissions of this signal. If you cancel or requeue @msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and @msg's connection will be closed. (If you need to requeue a message--eg, after handling authentication or redirection--it is usually better to requeue it from a [signal@Message::got-body] handler rather than a [signal@Message::got_headers] handler, so that the existing HTTP connection can be reused.) Emitted after receiving a 1xx (Informational) response for a (client-side) message. The response_headers will be filled in with the headers associated with the informational response; however, those header values will be erased after this signal is done. If you cancel or requeue @msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and @msg's connection will be closed. Emitted when [class@HSTSEnforcer] has upgraded the protocol for @msg to HTTPS as a result of matching its domain with a HSTS policy. Emitted to indicate that some network-related event related to @msg has occurred. This essentially proxies the [signal@Gio.SocketClient::event] signal, but only for events that occur while @msg "owns" the connection; if @msg is sent on an existing persistent connection, then this signal will not be emitted. (If you want to force the message to be sent on a new connection, set the %SOUP_MESSAGE_NEW_CONNECTION flag on it.) See [signal@Gio.SocketClient::event] for more information on what the different values of @event correspond to, and what @connection will be in each case. the network event the current state of the network connection Emitted during the @msg's connection TLS handshake when @tls_connection requests a certificate from the client. You can set the client certificate by calling [method@Message.set_tls_client_certificate] and returning %TRUE. It's possible to handle the request asynchornously by returning %TRUE and call [method@Message.set_tls_client_certificate] later once the certificate is available. Note that this signal is not emitted if [property@Session:tls-interaction] was set, or if [method@Message.set_tls_client_certificate] was called before the connection TLS handshake started. %TRUE to handle the request, or %FALSE to make the connection fail with %G_TLS_ERROR_CERTIFICATE_REQUIRED. the #GTlsClientConnection Emitted during the @msg's connection TLS handshake when @tls_connection requests a certificate password from the client. You can set the certificate password on @password, then call [method@Message.tls_client_certificate_password_request_complete] and return %TRUE to handle the signal synchronously. It's possible to handle the request asynchornously by calling [method@GObject.Object.ref] on @password, then returning %TRUE and call [method@Message.tls_client_certificate_password_request_complete] later after setting the password on @password. Note that this signal is not emitted if [property@Session:tls-interaction] was set. %TRUE to handle the request, or %FALSE to make the connection fail with %G_TLS_ERROR_CERTIFICATE_REQUIRED. the #GTlsPassword Emitted when a request that was already sent once is now being sent again. e.g. because the first attempt received a redirection response, or because we needed to use authentication. Emitted just before a message is sent. Emitted immediately after writing the complete body for a message. Emitted immediately after writing a portion of the message body to the network. the number of bytes written Emitted immediately after writing the request headers for a message. #SoupMessageBody represents the request or response body of a [class@Message]. Note that while @length always reflects the full length of the message body, @data is normally %NULL, and will only be filled in after [method@MessageBody.flatten] is called. For client-side messages, this automatically happens for the response body after it has been fully read. Likewise, for server-side messages, the request body is automatically filled in after being read. As an added bonus, when @data is filled in, it is always terminated with a `\0` byte (which is not reflected in @length). the data length of @data Creates a new #SoupMessageBody. [class@Message] uses this internally; you will not normally need to call it yourself. a new #SoupMessageBody. Appends @length bytes from @data to @body according to @use. a #SoupMessageBody how to use @data data to append length of @data Appends the data from @buffer to @body. a #SoupMessageBody a #GBytes Appends @length bytes from @data to @body. This function is exactly equivalent to [method@MessageBody.append] with %SOUP_MEMORY_TAKE as second argument; it exists mainly for convenience and simplifying language bindings. a #SoupMessageBody data to append length of @data Tags @body as being complete. Call this when using chunked encoding after you have appended the last chunk. a #SoupMessageBody Fills in @body's data field with a buffer containing all of the data in @body. Adds an additional `\0` byte not counted by @body's length field. a #GBytes containing the same data as @body. (You must [method@GLib.Bytes.unref] this if you do not want it.) a #SoupMessageBody Gets the accumulate flag on @body. See [method@MessageBody.set_accumulate. for details. the accumulate flag for @body. a #SoupMessageBody Gets a [struct@GLib.Bytes] containing data from @body starting at @offset. The size of the returned chunk is unspecified. You can iterate through the entire body by first calling [method@MessageBody.get_chunk] with an offset of 0, and then on each successive call, increment the offset by the length of the previously-returned chunk. If @offset is greater than or equal to the total length of @body, then the return value depends on whether or not [method@MessageBody.complete] has been called or not; if it has, then [method@MessageBody.get_chunk] will return a 0-length chunk (indicating the end of @body). If it has not, then [method@MessageBody.get_chunk] will return %NULL (indicating that @body may still potentially have more data, but that data is not currently available). a #GBytes a #SoupMessageBody an offset Handles the #SoupMessageBody part of receiving a chunk of data from the network. Normally this means appending @chunk to @body, exactly as with [method@MessageBody.append_bytes], but if you have set @body's accumulate flag to %FALSE, then that will not happen. This is a low-level method which you should not normally need to use. a #SoupMessageBody a #GBytes received from the network Atomically increments the reference count of @body by one. the passed in #SoupMessageBody a #SoupMessageBody Sets or clears the accumulate flag on @body. (The default value is %TRUE.) If set to %FALSE, @body's data field will not be filled in after the body is fully sent/received, and the chunks that make up @body may be discarded when they are no longer needed. If you set the flag to %FALSE on the [class@Message] request_body of a client-side message, it will block the accumulation of chunks into @body's data field, but it will not normally cause the chunks to be discarded after being written like in the server-side [class@Message] response_body case, because the request body needs to be kept around in case the request needs to be sent a second time due to redirection or authentication. a #SoupMessageBody whether or not to accumulate body chunks in @body Deletes all of the data in @body. a #SoupMessageBody Atomically decrements the reference count of @body by one. When the reference count reaches zero, the resources allocated by @body are freed a #SoupMessageBody Handles the #SoupMessageBody part of writing a chunk of data to the network. Normally this is a no-op, but if you have set @body's accumulate flag to %FALSE, then this will cause @chunk to be discarded to free up memory. This is a low-level method which you should not need to use, and there are further restrictions on its proper use which are not documented here. a #SoupMessageBody a #GBytes returned from [method@MessageBody.get_chunk] Various flags that can be set on a #SoupMessage to alter its behavior. The session should not follow redirect (3xx) responses received by this message. Requests that the message should be sent on a newly-created connection, not reusing an existing persistent connection. Note that messages with non-idempotent [property@Message:method]s behave this way by default, unless #SOUP_MESSAGE_IDEMPOTENT is set. The message is considered idempotent, regardless its [property@Message:method], and allows reuse of existing idle connections, instead of always requiring a new one, unless #SOUP_MESSAGE_NEW_CONNECTION is set. The [class@AuthManager] should not use the credentials cache for this message, neither to use cached credentials to automatically authenticate this message nor to cache the credentials after the message is successfully authenticated. This applies to both server and proxy authentication. Note that [signal@Message::authenticate] signal will be emitted, if you want to disable authentication for a message use [method@Message.disable_feature] passing #SOUP_TYPE_AUTH_MANAGER instead. Metrics will be collected for this message. The HTTP message headers associated with a request or response. Creates a #SoupMessageHeaders. ([class@Message] does this automatically for its own headers. You would only need to use this method if you are manually parsing or generating message headers.) a new #SoupMessageHeaders the type of headers Appends a new header with name @name and value @value to @hdrs. (If there is an existing header with name @name, then this creates a second one, which is only allowed for list-valued headers; see also [method@MessageHeaders.replace].) The caller is expected to make sure that @name and @value are syntactically correct. a #SoupMessageHeaders the header name to add the new value of @name Removes all the headers listed in the Connection header. a #SoupMessageHeaders Clears @hdrs. a #SoupMessageHeaders Calls @func once for each header value in @hdrs. Beware that unlike [method@MessageHeaders.get_list], this processes the headers in exactly the way they were added, rather than concatenating multiple same-named headers into a single value. (This is intentional; it ensures that if you call [method@MessageHeaders.append] multiple times with the same name, then the I/O code will output multiple copies of the header when sending the message to the remote implementation, which may be required for interoperability in some cases.) You may not modify the headers from @func. a #SoupMessageHeaders callback function to run for each header data to pass to @func Frees the array of ranges returned from [method@MessageHeaders.get_ranges]. a #SoupMessageHeaders an array of #SoupRange Looks up the "Content-Disposition" header in @hdrs, parses it, and returns its value in *@disposition and *@params. @params can be %NULL if you are only interested in the disposition-type. In HTTP, the most common use of this header is to set a disposition-type of "attachment", to suggest to the browser that a response should be saved to disk rather than displayed in the browser. If @params contains a "filename" parameter, this is a suggestion of a filename to use. (If the parameter value in the header contains an absolute or relative path, libsoup will truncate it down to just the final path component, so you do not need to test this yourself.) Content-Disposition is also used in "multipart/form-data", however this is handled automatically by [struct@Multipart] and the associated form methods. %TRUE if @hdrs contains a "Content-Disposition" header, %FALSE if not (in which case *@disposition and *@params will be unchanged). a #SoupMessageHeaders return location for the disposition-type, or %NULL return location for the Content-Disposition parameters, or %NULL Gets the message body length that @hdrs declare. This will only be non-0 if [method@MessageHeaders.get_encoding] returns %SOUP_ENCODING_CONTENT_LENGTH. the message body length declared by @hdrs. a #SoupMessageHeaders Parses @hdrs's Content-Range header and returns it in @start, @end, and @total_length. If the total length field in the header was specified as "*", then @total_length will be set to -1. %TRUE if @hdrs contained a "Content-Range" header containing a byte range which could be parsed, %FALSE otherwise. a #SoupMessageHeaders return value for the start of the range return value for the end of the range return value for the total length of the resource, or %NULL if you don't care. Looks up the "Content-Type" header in @hdrs, parses it, and returns its value in *@content_type and *@params. @params can be %NULL if you are only interested in the content type itself. a string with the value of the "Content-Type" header or %NULL if @hdrs does not contain that header or it cannot be parsed (in which case *@params will be unchanged). a #SoupMessageHeaders return location for the Content-Type parameters (eg, "charset"), or %NULL Gets the message body encoding that @hdrs declare. This may not always correspond to the encoding used on the wire; eg, a HEAD response may declare a Content-Length or Transfer-Encoding, but it will never actually include a body. the encoding declared by @hdrs. a #SoupMessageHeaders Gets the expectations declared by @hdrs's "Expect" header. Currently this will either be %SOUP_EXPECTATION_CONTINUE or %SOUP_EXPECTATION_UNRECOGNIZED. the contents of @hdrs's "Expect" header a #SoupMessageHeaders Gets the type of headers. the header's type. a #SoupMessageHeaders Gets the value of header @name in @hdrs. Use this for headers whose values are comma-delimited lists, and which are therefore allowed to appear multiple times in the headers. For non-list-valued headers, use [method@MessageHeaders.get_one]. If @name appears multiple times in @hdrs, [method@MessageHeaders.get_list] will concatenate all of the values together, separated by commas. This is sometimes awkward to parse (eg, WWW-Authenticate, Set-Cookie), but you have to be able to deal with it anyway, because the HTTP spec explicitly states that this transformation is allowed, and so an upstream proxy could do the same thing. the header's value or %NULL if not found. a #SoupMessageHeaders header name Gets the value of header @name in @hdrs. Use this for headers whose values are *not* comma-delimited lists, and which therefore can only appear at most once in the headers. For list-valued headers, use [method@MessageHeaders.get_list]. If @hdrs does erroneously contain multiple copies of the header, it is not defined which one will be returned. (Ideally, it will return whichever one makes libsoup most compatible with other HTTP implementations.) the header's value or %NULL if not found. a #SoupMessageHeaders header name Parses @hdrs's Range header and returns an array of the requested byte ranges. The returned array must be freed with [method@MessageHeaders.free_ranges]. If @total_length is non-0, its value will be used to adjust the returned ranges to have explicit start and end values, and the returned ranges will be sorted and non-overlapping. If @total_length is 0, then some ranges may have an end value of -1, as described under [struct@Range], and some of the ranges may be redundant. Beware that even if given a @total_length, this function does not check that the ranges are satisfiable. #SoupServer has built-in handling for range requests. If your server handler returns a %SOUP_STATUS_OK response containing the complete response body (rather than pausing the message and returning some of the response body later), and there is a Range header in the request, then libsoup will automatically convert the response to a %SOUP_STATUS_PARTIAL_CONTENT response containing only the range(s) requested by the client. The only time you need to process the Range header yourself is if either you need to stream the response body rather than returning it all at once, or you do not already have the complete response body available, and only want to generate the parts that were actually requested by the client. %TRUE if @hdrs contained a syntactically-valid "Range" header, %FALSE otherwise (in which case @range and @length will not be set). a #SoupMessageHeaders the total_length of the response body return location for an array of #SoupRange the length of the returned array Checks whether the list-valued header @name is present in @hdrs, and contains a case-insensitive match for @token. (If @name is present in @hdrs, then this is equivalent to calling [func@header_contains] on its value.) %TRUE if the header is present and contains @token, %FALSE otherwise. a #SoupMessageHeaders header name token to look for Checks whether the header @name is present in @hdrs and is (case-insensitively) equal to @value. %TRUE if the header is present and its value is @value, %FALSE otherwise. a #SoupMessageHeaders header name expected value Atomically increments the reference count of @hdrs by one. the passed in #SoupMessageHeaders a #SoupMessageHeaders Removes @name from @hdrs. If there are multiple values for @name, they are all removed. a #SoupMessageHeaders the header name to remove Replaces the value of the header @name in @hdrs with @value. See also [method@MessageHeaders.append]. The caller is expected to make sure that @name and @value are syntactically correct. a #SoupMessageHeaders the header name to replace the new value of @name Sets the "Content-Disposition" header in @hdrs to @disposition, optionally with additional parameters specified in @params. See [method@MessageHeaders.get_content_disposition] for a discussion of how Content-Disposition is used in HTTP. a #SoupMessageHeaders the disposition-type additional parameters Sets the message body length that @hdrs will declare, and sets @hdrs's encoding to %SOUP_ENCODING_CONTENT_LENGTH. You do not normally need to call this; if @hdrs is set to use Content-Length encoding, libsoup will automatically set its Content-Length header for you immediately before sending the headers. One situation in which this method is useful is when generating the response to a HEAD request; Calling [method@MessageHeaders.set_content_length] allows you to put the correct content length into the response without needing to waste memory by filling in a response body which won't actually be sent. a #SoupMessageHeaders the message body length Sets @hdrs's Content-Range header according to the given values. (Note that @total_length is the total length of the entire resource that this is a range of, not simply @end - @start + 1.) [class@Server] has built-in handling for range requests, and you do not normally need to call this function youself. See [method@MessageHeaders.get_ranges] for more details. a #SoupMessageHeaders the start of the range the end of the range the total length of the resource, or -1 if unknown Sets the "Content-Type" header in @hdrs to @content_type. Accepts additional parameters specified in @params. a #SoupMessageHeaders the MIME type additional parameters Sets the message body encoding that @hdrs will declare. In particular, you should use this if you are going to send a request or response in chunked encoding. a #SoupMessageHeaders a #SoupEncoding Sets @hdrs's "Expect" header according to @expectations. Currently %SOUP_EXPECTATION_CONTINUE is the only known expectation value. You should set this value on a request if you are sending a large message body (eg, via POST or PUT), and want to give the server a chance to reject the request after seeing just the headers (eg, because it will require authentication before allowing you to post, or because you're POSTing to a URL that doesn't exist). This saves you from having to transmit the large request body when the server is just going to ignore it anyway. a #SoupMessageHeaders the expectations to set Sets @hdrs's Range header to request the indicated range. @start and @end are interpreted as in a [struct@Range]. If you need to request multiple ranges, use [method@MessageHeaders.set_ranges]. a #SoupMessageHeaders the start of the range to request the end of the range to request Sets @hdrs's Range header to request the indicated ranges. If you only want to request a single range, you can use [method@MessageHeaders.set_range]. a #SoupMessageHeaders an array of #SoupRange the length of @range Atomically decrements the reference count of @hdrs by one. When the reference count reaches zero, the resources allocated by @hdrs are freed a #SoupMessageHeaders The callback passed to [method@MessageHeaders.foreach]. the header name the header value the data passed to [method@MessageHeaders.foreach] An opaque type used to iterate over a %SoupMessageHeaders structure. After intializing the iterator with [func@MessageHeadersIter.init], call [method@MessageHeadersIter.next] to fetch data from it. You may not modify the headers while iterating over them. Yields the next name/value pair in the [struct@MessageHeaders] being iterated by @iter. If @iter has already yielded the last header, then [method@MessageHeadersIter.next] will return %FALSE and @name and @value will be unchanged. %TRUE if another name and value were returned, %FALSE if the end of the headers has been reached. a %SoupMessageHeadersIter pointer to a variable to return the header name in pointer to a variable to return the header value in Initializes @iter for iterating @hdrs. a pointer to a %SoupMessageHeadersIter structure a %SoupMessageHeaders Value passed to [ctor@MessageHeaders.new] to set certain default behaviors. request headers response headers multipart body part headers Contains metrics collected while loading a [class@Message] either from the network or the disk cache. Metrics are not collected by default for a [class@Message], you need to add the flag %SOUP_MESSAGE_COLLECT_METRICS to enable the feature. Temporal metrics are expressed as a monotonic time and always start with a fetch start event and finish with response end. All other events are optional. 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 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. Copies @metrics. a copy of @metrics a #SoupMessageMetrics Frees @metrics. a #SoupMessageMetrics Get the time immediately after the [class@Message] completed the connection to the server. This includes the time for the proxy negotiation and TLS handshake. It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache). the connection end time a #SoupMessageMetrics Get the time immediately before the [class@Message] started to establish the connection to the server. It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache). the connection start time a #SoupMessageMetrics Get the time immediately after the [class@Message] completed the domain lookup name for the resource. It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache). the domain lookup end time a #SoupMessageMetrics Get the time immediately before the [class@Message] started the domain lookup name for the resource. It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache). the domain lookup start time a #SoupMessageMetrics Get the time immediately before the [class@Message] started to fetch a resource either from a remote server or local disk cache. the fetch start time a #SoupMessageMetrics Get the number of bytes sent to the network for the request body. This is the size of the body sent, after encodings are applied, so it might be greater than the value returned by [method@MessageMetrics.get_request_body_size]. This value is available right before [signal@Message::wrote-body] signal is emitted, but you might get an intermediate value if called before. the request body bytes sent a #SoupMessageMetrics Get the request body size in bytes. This is the size of the original body given to the request before any encoding is applied. This value is available right before [signal@Message::wrote-body] signal is emitted, but you might get an intermediate value if called before. the request body size a #SoupMessageMetrics Get the number of bytes sent to the network for the request headers. This value is available right before [signal@Message::wrote-headers] signal is emitted, but you might get an intermediate value if called before. the request headers bytes sent a #SoupMessageMetrics Get the time immediately before the [class@Message] started the request of the resource from the server or the local disk cache. the request start time a #SoupMessageMetrics Get the number of bytes received from the network for the response body. This value is available right before [signal@Message::got-body] signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0. the response body bytes received a #SoupMessageMetrics Get the response body size in bytes. This is the size of the body as given to the user after all encodings are applied, so it might be greater than the value returned by [method@MessageMetrics.get_response_body_bytes_received]. This value is available right before [signal@Message::got-body] signal is emitted, but you might get an intermediate value if called before. the response body size a #SoupMessageMetrics Get the time immediately after the [class@Message] received the last bytes of the response from the server or the local disk cache. In case of load failure, this returns the time immediately before the fetch is aborted. the response end time a #SoupMessageMetrics Get the number of bytes received from the network for the response headers. This value is available right before [signal@Message::got-headers] signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0. the response headers bytes received a #SoupMessageMetrics Get the time immediately after the [class@Message] received the first bytes of the response from the server or the local disk cache. the response start time a #SoupMessageMetrics Get the time immediately before the [class@Message] started the TLS handshake. It will be 0 if no TLS handshake was required to fetch the resource (connection was not secure, a persistent connection was used or resource was loaded from the local disk cache). the tls start time a #SoupMessageMetrics Priorities that can be set on a [class@Message] to instruct the message queue to process it before any other message with lower priority. The lowest priority, the messages with this priority will be the last ones to be attended. Use this for low priority messages, a #SoupMessage with the default priority will be processed first. The default priotity, this is the priority assigned to the #SoupMessage by default. High priority, a #SoupMessage with this priority will be processed before the ones with the default priority. The highest priority, use this for very urgent #SoupMessage as they will be the first ones to be attended. Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046. Of particular interest to HTTP are `multipart/byte-ranges` and `multipart/form-data`, Although the headers of a #SoupMultipart body part will contain the full headers from that body part, libsoup does not interpret them according to MIME rules. For example, each body part is assumed to have "binary" Content-Transfer-Encoding, even if its headers explicitly state otherwise. In other words, don't try to use #SoupMultipart for handling real MIME multiparts. Creates a new empty #SoupMultipart with a randomly-generated boundary string. Note that @mime_type must be the full MIME type, including "multipart/". See also: [ctor@Message.new_from_multipart]. a new empty #SoupMultipart of the given @mime_type the MIME type of the multipart to create. Parses @headers and @body to form a new #SoupMultipart a new #SoupMultipart (or %NULL if the message couldn't be parsed or wasn't multipart). the headers of the HTTP message to parse the body of the HTTP message to parse Adds a new MIME part containing @body to @multipart Uses "Content-Disposition: form-data", as per the HTML forms specification. a multipart (presumably of type "multipart/form-data") the name of the control associated with this file the name of the file, or %NULL if not known the MIME type of the file, or %NULL if not known the file data Adds a new MIME part containing @data to @multipart. Uses "Content-Disposition: form-data", as per the HTML forms specification. a multipart (presumably of type "multipart/form-data") the name of the control associated with @data the body data Adds a new MIME part to @multipart with the given headers and body. (The multipart will make its own copies of @headers and @body, so you should free your copies if you are not using them for anything else.) a #SoupMultipart the MIME part headers the MIME part body Frees @multipart. a #SoupMultipart Gets the number of body parts in @multipart. the number of body parts in @multipart a #SoupMultipart Gets the indicated body part from @multipart. %TRUE on success, %FALSE if @part is out of range (in which case @headers and @body won't be set) a #SoupMultipart the part number to get (counting from 0) return location for the MIME part headers return location for the MIME part body Serializes @multipart to @dest_headers and @dest_body. a #SoupMultipart the headers of the HTTP message to serialize @multipart to the body of the HTTP message to serialize @multipart to Handles streams of multipart messages. This adds support for the multipart responses. For handling the multiple parts the user needs to wrap the [class@Gio.InputStream] obtained by sending the request with a [class@MultipartInputStream] and use [method@MultipartInputStream.next_part] before reading. Responses which are not wrapped will be treated like non-multipart responses. Note that although #SoupMultipartInputStream is a [class@Gio.InputStream], you should not read directly from it, and the results are undefined if you do. Creates a new #SoupMultipartInputStream that wraps the [class@Gio.InputStream] obtained by sending the [class@Message]. Reads should not be done directly through this object, use the input streams returned by [method@MultipartInputStream.next_part] or its async counterpart instead. a new #SoupMultipartInputStream the #SoupMessage the response is related to. the #GInputStream returned by sending the request. Obtains the headers for the part currently being processed. Note that the [struct@MessageHeaders] that are returned are owned by the #SoupMultipartInputStream and will be replaced when a call is made to [method@MultipartInputStream.next_part] or its async counterpart, so if keeping the headers is required, a copy must be made. Note that if a part had no headers at all an empty [struct@MessageHeaders] will be returned. a #SoupMessageHeaders containing the headers for the part currently being processed or %NULL if the headers failed to parse. a #SoupMultipartInputStream. Obtains an input stream for the next part. When dealing with a multipart response the input stream needs to be wrapped in a #SoupMultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading. After calling this function, [method@MultipartInputStream.get_headers] can be used to obtain the headers for the first part. A read of 0 bytes indicates the end of the part; a new call to this function should be done at that point, to obtain the next part. @error will only be set if an error happens during a read, %NULL is a valid return value otherwise. a new #GInputStream, or %NULL if there are no more parts the #SoupMultipartInputStream a #GCancellable Obtains a [class@Gio.InputStream] for the next request. See [method@MultipartInputStream.next_part] for details on the workflow. the #SoupMultipartInputStream. the I/O priority for the request. a #GCancellable. callback to call when request is satisfied. data for @callback Finishes an asynchronous request for the next part. a newly created [class@Gio.InputStream] for reading the next part or %NULL if there are no more parts. a #SoupMultipartInputStream. a #GAsyncResult. The [class@Message]. Represents a byte range as used in the Range header. If @end is non-negative, then @start and @end represent the bounds of of the range, counting from 0. (Eg, the first 500 bytes would be represented as @start = 0 and @end = 499.) If @end is -1 and @start is non-negative, then this represents a range starting at @start and ending with the last byte of the requested resource body. (Eg, all but the first 500 bytes would be @start = 500, and @end = -1.) If @end is -1 and @start is negative, then it represents a "suffix range", referring to the last -@start bytes of the resource body. (Eg, the last 500 bytes would be @start = -500 and @end = -1.) the start of the range the end of the range Tests if @status is a Client Error (4xx) response. an HTTP status code Tests if @status is an Informational (1xx) response. an HTTP status code Tests if @status is a Redirection (3xx) response. an HTTP status code Tests if @status is a Server Error (5xx) response. an HTTP status code Tests if @status is a Successful (2xx) response. an HTTP status code Represents the same-site policies of a cookie. The cookie is exposed with both cross-site and same-site requests The cookie is withheld on cross-site requests but exposed on cross-site navigations The cookie is only exposed for same-site requests A HTTP server. #SoupServer implements a simple HTTP server. To begin, create a server using [ctor@Server.new]. Add at least one handler by calling [method@Server.add_handler] or [method@Server.add_early_handler]; the handler will be called to process any requests underneath the path you pass. (If you want all requests to go to the same handler, just pass "/" (or %NULL) for the path.) When a new connection is accepted (or a new request is started on an existing persistent connection), the #SoupServer will emit [signal@Server::request-started] and then begin processing the request as described below, but note that once the message is assigned a status-code, then callbacks after that point will be skipped. Note also that it is not defined when the callbacks happen relative to various [class@ServerMessage] signals. Once the headers have been read, #SoupServer will check if there is a [class@AuthDomain] `(qv)` covering the Request-URI; if so, and if the message does not contain suitable authorization, then the [class@AuthDomain] will set a status of %SOUP_STATUS_UNAUTHORIZED on the message. After checking for authorization, #SoupServer will look for "early" handlers (added with [method@Server.add_early_handler]) matching the Request-URI. If one is found, it will be run; in particular, this can be used to connect to signals to do a streaming read of the request body. (At this point, if the request headers contain `Expect: 100-continue`, and a status code has been set, then #SoupServer will skip the remaining steps and return the response. If the request headers contain `Expect: 100-continue` and no status code has been set, #SoupServer will return a %SOUP_STATUS_CONTINUE status before continuing.) The server will then read in the response body (if present). At this point, if there are no handlers at all defined for the Request-URI, then the server will return %SOUP_STATUS_NOT_FOUND to the client. Otherwise (assuming no previous step assigned a status to the message) any "normal" handlers (added with [method@Server.add_handler]) for the message's Request-URI will be run. Then, if the path has a WebSocket handler registered (and has not yet been assigned a status), #SoupServer will attempt to validate the WebSocket handshake, filling in the response and setting a status of %SOUP_STATUS_SWITCHING_PROTOCOLS or %SOUP_STATUS_BAD_REQUEST accordingly. If the message still has no status code at this point (and has not been paused with [method@ServerMessage.pause]), then it will be given a status of %SOUP_STATUS_INTERNAL_SERVER_ERROR (because at least one handler ran, but returned without assigning a status). Finally, the server will emit [signal@Server::request-finished] (or [signal@Server::request-aborted] if an I/O error occurred before handling was completed). If you want to handle the special "*" URI (eg, "OPTIONS *"), you must explicitly register a handler for "*"; the default handler will not be used for that case. If you want to process https connections in addition to (or instead of) http connections, you can set the [property@Server:tls-certificate] property. Once the server is set up, make one or more calls to [method@Server.listen], [method@Server.listen_local], or [method@Server.listen_all] to tell it where to listen for connections. (All ports on a #SoupServer use the same handlers; if you need to handle some ports differently, such as returning different data for http and https, you'll need to create multiple `SoupServer`s, or else check the passed-in URI in the handler function.). #SoupServer will begin processing connections as soon as you return to (or start) the main loop for the current thread-default [struct@GLib.MainContext]. Creates a new #SoupServer. This is exactly equivalent to calling [ctor@GObject.Object.new] and specifying %SOUP_TYPE_SERVER as the type. a new #SoupServer. If you are using certain legacy properties, this may also return %NULL if an error occurs. name of first property to set value of @optname1, followed by additional property/value pairs Adds a new client stream to the @server. %TRUE on success, %FALSE if the stream could not be accepted or any other error occurred (in which case @error will be set). a #SoupServer a #GIOStream the local #GSocketAddress associated with the @stream the remote #GSocketAddress associated with the @stream Adds an authentication domain to @server. Each auth domain will have the chance to require authentication for each request that comes in; normally auth domains will require authentication for requests on certain paths that they have been set up to watch, or that meet other criteria set by the caller. If an auth domain determines that a request requires authentication (and the request doesn't contain authentication), @server will automatically reject the request with an appropriate status (401 Unauthorized or 407 Proxy Authentication Required). If the request used the SoupServer:100-continue Expectation, @server will reject it before the request body is sent. a #SoupServer a #SoupAuthDomain Adds an "early" handler to @server for requests prefixed by @path. Note that "normal" and "early" handlers are matched up together, so if you add a normal handler for "/foo" and an early handler for "/foo/bar", then a request to "/foo/bar" (or any path below it) will run only the early handler. (But if you add both handlers at the same path, then both will get run.) For requests under @path (that have not already been assigned a status code by a [class@AuthDomain] or a signal handler), @callback will be invoked after receiving the request headers, but before receiving the request body; the message's method and request-headers properties will be set. Early handlers are generally used for processing requests with request bodies in a streaming fashion. If you determine that the request will contain a message body, normally you would call [method@MessageBody.set_accumulate] on the message's request-body to turn off request-body accumulation, and connect to the message's [signal@ServerMessage::got-chunk] signal to process each chunk as it comes in. To complete the message processing after the full message body has been read, you can either also connect to [signal@ServerMessage::got-body], or else you can register a non-early handler for @path as well. As long as you have not set the status-code by the time [signal@ServerMessage::got-body] is emitted, the non-early handler will be run as well. a #SoupServer the toplevel path for the handler callback to invoke for requests under @path data for @callback destroy notifier to free @user_data Adds a handler to @server for requests prefixed by @path. If @path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler. (Note though that if you want to handle requests to the special "*" URI, you must explicitly register a handler for "*"; the default handler will not be used for that case.) For requests under @path (that have not already been assigned a status code by a [class@AuthDomain], an early server handler, or a signal handler), @callback will be invoked after receiving the request body; the [class@ServerMessage]'s method, request-headers, and request-body properties will be set. After determining what to do with the request, the callback must at a minimum call [method@ServerMessage.set_status] on the message to set the response status code. Additionally, it may set response headers and/or fill in the response body. If the callback cannot fully fill in the response before returning (eg, if it needs to wait for information from a database, or another network server), it should call [method@ServerMessage.pause] to tell @server to not send the response right away. When the response is ready, call [method@ServerMessage.unpause] to cause it to be sent. To send the response body a bit at a time using "chunked" encoding, first call [method@MessageHeaders.set_encoding] to set %SOUP_ENCODING_CHUNKED on the response-headers. Then call [method@MessageBody.append] (or [method@MessageBody.append_bytes])) to append each chunk as it becomes ready, and [method@ServerMessage.unpause] to make sure it's running. (The server will automatically pause the message if it is using chunked encoding but no more chunks are available.) When you are done, call [method@MessageBody.complete] to indicate that no more chunks are coming. a #SoupServer the toplevel path for the handler callback to invoke for requests under @path data for @callback destroy notifier to free @user_data Add support for a WebSocket extension of the given @extension_type. When a WebSocket client requests an extension of @extension_type, a new [class@WebsocketExtension] of type @extension_type will be created to handle the request. Note that [class@WebsocketExtensionDeflate] is supported by default, use [method@Server.remove_websocket_extension] if you want to disable it. a #SoupServer a #GType Adds a WebSocket handler to @server for requests prefixed by @path. If @path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler. When a path has a WebSocket handler registered, @server will check incoming requests for WebSocket handshakes after all other handlers have run (unless some earlier handler has already set a status code on the message), and update the request's status, response headers, and response body accordingly. If @origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. More complicated requirements can be handled by adding a normal handler to @path, and having it perform whatever checks are needed and setting a failure status code if the handshake should be rejected. a #SoupServer the toplevel path for the handler the origin of the connection the protocols supported by this handler callback to invoke for successful WebSocket requests under @path data for @callback destroy notifier to free @user_data Closes and frees @server's listening sockets. Note that if there are currently requests in progress on @server, that they will continue to be processed if @server's [struct@GLib.MainContext] is still running. You can call [method@Server.listen], etc, after calling this function if you want to start listening again. a #SoupServer Gets @server's list of listening sockets. You should treat these sockets as read-only; writing to or modifiying any of these sockets may cause @server to malfunction. a list of listening sockets. a #SoupServer Gets the @server SSL/TLS client authentication mode. a #GTlsAuthenticationMode a #SoupServer Gets the @server SSL/TLS certificate. a #GTlsCertificate or %NULL a #SoupServer Gets the @server SSL/TLS database. a #GTlsDatabase a #SoupServer Gets a list of URIs corresponding to the interfaces @server is listening on. These will contain IP addresses, not hostnames, and will also indicate whether the given listener is http or https. Note that if you used [method@Server.listen_all] the returned URIs will use the addresses `0.0.0.0` and `::`, rather than actually returning separate URIs for each interface on the system. a list of #GUris, which you must free when you are done with it. a #SoupServer Checks whether @server is capable of https. In order for a server to run https, you must call [method@Server.set_tls_certificate], or set the [property@Server:tls-certificate] property, to provide it with a certificate to use. If you are using the deprecated single-listener APIs, then a return value of %TRUE indicates that the #SoupServer serves https exclusively. If you are using [method@Server.listen], etc, then a %TRUE return value merely indicates that the server is *able* to do https, regardless of whether it actually currently is or not. Use [method@Server.get_uris] to see if it currently has any https listeners. %TRUE if @server is configured to serve https. a #SoupServer Attempts to set up @server to listen for connections on @address. If @options includes %SOUP_SERVER_LISTEN_HTTPS, and @server has been configured for TLS, then @server will listen for https connections on this port. Otherwise it will listen for plain http. You may call this method (along with the other "listen" methods) any number of times on a server, if you want to listen on multiple ports, or set up both http and https service. After calling this method, @server will begin accepting and processing connections as soon as the appropriate [struct@GLib.MainContext] is run. Note that this API does not make use of dual IPv4/IPv6 sockets; if @address is an IPv6 address, it will only accept IPv6 connections. You must configure IPv4 listening separately. %TRUE on success, %FALSE if @address could not be bound or any other error occurred (in which case @error will be set). a #SoupServer the address of the interface to listen on listening options for this server Attempts to set up @server to listen for connections on all interfaces on the system. That is, it listens on the addresses `0.0.0.0` and/or `::`, depending on whether @options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither.) If @port is specified, @server will listen on that port. If it is 0, @server will find an unused port to listen on. (In that case, you can use [method@Server.get_uris] to find out what port it ended up choosing. See [method@Server.listen] for more details. %TRUE on success, %FALSE if @port could not be bound or any other error occurred (in which case @error will be set). a #SoupServer the port to listen on, or 0 listening options for this server Attempts to set up @server to listen for connections on "localhost". That is, `127.0.0.1` and/or `::1`, depending on whether @options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither). If @port is specified, @server will listen on that port. If it is 0, @server will find an unused port to listen on. (In that case, you can use [method@Server.get_uris] to find out what port it ended up choosing. See [method@Server.listen] for more details. %TRUE on success, %FALSE if @port could not be bound or any other error occurred (in which case @error will be set). a #SoupServer the port to listen on, or 0 listening options for this server Attempts to set up @server to listen for connections on @socket. See [method@Server.listen] for more details. %TRUE on success, %FALSE if an error occurred (in which case @error will be set). a #SoupServer a listening #GSocket listening options for this server Pauses I/O on @msg. This can be used when you need to return from the server handler without having the full response ready yet. Use [method@Server.unpause_message] to resume I/O. This must only be called on a [class@ServerMessage] which was created by the #SoupServer and are currently doing I/O, such as those passed into a [callback@ServerCallback] or emitted in a [signal@Server::request-read] signal. Use soup_server_message_pause() instead. a #SoupServer a #SoupServerMessage associated with @server. Removes @auth_domain from @server. a #SoupServer a #SoupAuthDomain Removes all handlers (early and normal) registered at @path. a #SoupServer the toplevel path for the handler Removes support for WebSocket extension of type @extension_type (or any subclass of @extension_type) from @server. a #SoupServer a #GType Sets @server's #GTlsAuthenticationMode to use for SSL/TLS client authentication. a #SoupServer a #GTlsAuthenticationMode Sets @server up to do https, using the given SSL/TLS @certificate. a #SoupServer a #GTlsCertificate Sets @server's #GTlsDatabase to use for validating SSL/TLS client certificates. a #SoupServer a #GTlsDatabase Resumes I/O on @msg. Use this to resume after calling [method@Server.pause_message], or after adding a new chunk to a chunked response. I/O won't actually resume until you return to the main loop. This must only be called on a [class@ServerMessage] which was created by the #SoupServer and are currently doing I/O, such as those passed into a [callback@ServerCallback] or emitted in a [signal@Server::request-read] signal. Use soup_server_message_unpause() instead. a #SoupServer a #SoupServerMessage associated with @server. If %TRUE, percent-encoding in the Request-URI path will not be automatically decoded. Server header. If non-%NULL, the value to use for the "Server" header on [class@ServerMessage]s processed by this server. The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens. Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes. As with [property@Session:user_agent], if you set a [property@Server:server-header] property that has trailing whitespace, #SoupServer will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you. A [enum@Gio.TlsAuthenticationMode] for SSL/TLS client authentication. A [class@Gio.TlsCertificate[] that has a [property@Gio.TlsCertificate:private-key] set. If this is set, then the server will be able to speak https in addition to (or instead of) plain http. A [class@Gio.TlsDatabase] to use for validating SSL/TLS client certificates. Emitted when processing has failed for a message. This could mean either that it could not be read (if [signal@Server::request-read] has not been emitted for it yet), or that the response could not be written back (if [signal@Server::request-read] has been emitted but [signal@Server::request-finished] has not been). @message is in an undefined state when this signal is emitted; the signal exists primarily to allow the server to free any state that it may have allocated in [signal@Server::request-started]. the message Emitted when the server has finished writing a response to a request. the message Emitted when the server has successfully read a request. @message will have all of its request-side information filled in, and if the message was authenticated, @client will have information about that. This signal is emitted before any (non-early) handlers are called for the message, and if it sets the message's #status_code, then normal handler processing will be skipped. the message Emitted when the server has started reading a new request. @message will be completely blank; not even the Request-Line will have been read yet. About the only thing you can usefully do with it is connect to its signals. If the request is read successfully, this will eventually be followed by a [signal@Server::request_read signal]. If a response is then sent, the request processing will end with a [signal@Server::request-finished] signal. If a network error occurs, the processing will instead end with [signal@Server::request-aborted]. the new message A callback used to handle requests to a [class@Server]. @path and @query contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, [class@Server] decodes all percent-encoding in the URI path, such that `"/foo%2Fbar"` is treated the same as `"/foo/bar"`. If your server is serving resources in some non-POSIX-filesystem namespace, you may want to distinguish those as two distinct paths. In that case, you can set the [property@Server:raw-paths] property when creating the [class@Server], and it will leave those characters undecoded. @query contains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignore @query, and call [method@Message.get_uri] and parse the URI's query field yourself. See [method@Server.add_handler] and [method@Server.add_early_handler] for details of what handlers can/should do. the #SoupServer the message being processed the path component of @msg's Request-URI the parsed query component of @msg's Request-URI the data passed to [method@Server.add_handler] or [method@Server.add_early_handler]. Options to pass to [method@Server.listen], etc. %SOUP_SERVER_LISTEN_IPV4_ONLY and %SOUP_SERVER_LISTEN_IPV6_ONLY only make sense with [method@Server.listen_all] and [method@Server.listen_local], not plain [method@Server.listen] (which simply listens on whatever kind of socket you give it). And you cannot specify both of them in a single call. Listen for https connections rather than plain http. Only listen on IPv4 interfaces. Only listen on IPv6 interfaces. An HTTP server request and response pair. A SoupServerMessage represents an HTTP message that is being sent or received on a [class@Server]. [class@Server] will create `SoupServerMessage`s automatically for incoming requests, which your application will receive via handlers. Note that libsoup's terminology here does not quite match the HTTP specification: in RFC 2616, an "HTTP-message" is *either* a Request, *or* a Response. In libsoup, a #SoupServerMessage combines both the request and the response. Get the HTTP version of @msg. a #SoupHTTPVersion. a #SoupServerMessage Retrieves the [class@Gio.SocketAddress] associated with the local end of a connection. the #GSocketAddress associated with the local end of a connection, it may be %NULL if you used [method@Server.accept_iostream]. a #SoupServerMessage Get the HTTP method of @msg. the HTTP method. a #SoupServerMessage Get the HTTP reason phrase of @msg. the reason phrase. a #SoupServerMessage: Retrieves the [class@Gio.SocketAddress] associated with the remote end of a connection. the #GSocketAddress associated with the remote end of a connection, it may be %NULL if you used [class@Server.accept_iostream]. a #SoupServerMessage Retrieves the IP address associated with the remote end of a connection. the IP address associated with the remote end of a connection, it may be %NULL if you used [method@Server.accept_iostream]. a #SoupServerMessage Get the request body of @msg. a #SoupMessageBody. a #SoupServerMessage Get the request headers of @msg. a #SoupMessageHeaders with the request headers. a #SoupServerMessage Get the response body of @msg. a #SoupMessageBody. a #SoupServerMessage Get the response headers of @msg. a #SoupMessageHeaders with the response headers. a #SoupServerMessage Retrieves the [class@Gio.Socket] that @msg is associated with. If you are using this method to observe when multiple requests are made on the same persistent HTTP connection (eg, as the ntlm-test test program does), you will need to pay attention to socket destruction as well (eg, by using weak references), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket. the #GSocket that @msg is associated with, %NULL if you used [method@Server.accept_iostream]. a #SoupServerMessage Get the HTTP status code of @msg. the HTTP status code. a #SoupServerMessage Gets the peer's #GTlsCertificate associated with @msg's connection. Note that this is not set yet during the emission of SoupServerMessage::accept-certificate signal. @msg's TLS peer certificate, or %NULL if @msg's connection is not SSL. a #SoupMessage Gets the errors associated with validating @msg's TLS peer certificate. Note that this is not set yet during the emission of SoupServerMessage::accept-certificate signal. a #GTlsCertificateFlags with @msg's TLS peer certificate errors. a #SoupMessage Get @msg's URI. a #GUri a #SoupServerMessage Gets if @msg represents an OPTIONS message with the path `*`. %TRUE if is an OPTIONS ping a #SoupServerMessage Pauses I/O on @msg. This can be used when you need to return from the server handler without having the full response ready yet. Use [method@ServerMessage.unpause] to resume I/O. a SoupServerMessage Set the HTTP version of @msg. a #SoupServerMessage a #SoupHTTPVersion Sets @msg's status_code to @status_code and adds a Location header pointing to @redirect_uri. Use this from a [class@Server] when you want to redirect the client to another URI. @redirect_uri can be a relative URI, in which case it is interpreted relative to @msg's current URI. In particular, if @redirect_uri is just a path, it will replace the path *and query* of @msg's URI. a #SoupServerMessage a 3xx status code the URI to redirect @msg to Convenience function to set the response body of a #SoupServerMessage. If @content_type is %NULL, the response body must be empty as well. the message MIME Content-Type of the body a #SoupMemoryUse describing how to handle @resp_body a data buffer containing the body of the message response. the byte length of @resp_body. Sets @msg's status code to @status_code. If @status_code is a known value and @reason_phrase is %NULL, the reason_phrase will be set automatically. a #SoupServerMessage an HTTP status code a reason phrase "Steals" the HTTP connection associated with @msg from its #SoupServer. This happens immediately, regardless of the current state of the connection; if the response to @msg has not yet finished being sent, then it will be discarded; you can steal the connection from a [signal@ServerMessage::wrote-informational] or [signal@ServerMessage::wrote-body] signal handler if you need to wait for part or all of the response to be sent. Note that when calling this function from C, @msg will most likely be freed as a side effect. the #GIOStream formerly associated with @msg (or %NULL if @msg was no longer associated with a connection). No guarantees are made about what kind of #GIOStream is returned. a #SoupServerMessage Resumes I/O on @msg. Use this to resume after calling [method@ServerMessage.pause], or after adding a new chunk to a chunked response. I/O won't actually resume until you return to the main loop. a SoupServerMessage The peer's #GTlsCertificate associated with the message The verification errors on #SoupServerMessage:tls-peer-certificate Emitted during the @msg's connection TLS handshake after client TLS certificate has been received. You can return %TRUE to accept @tls_certificate despite @tls_errors. %TRUE to accept the TLS certificate and stop other handlers from being invoked, or %FALSE to propagate the event further. the peer's #GTlsCertificate the tls errors of @tls_certificate Emitted when the @msg's socket is connected and the TLS handshake completed. Emitted when the @msg's socket is disconnected. Emitted when all HTTP processing is finished for a message. (After [signal@ServerMessage::wrote-body]). Emitted after receiving the complete request body. Emitted after receiving a chunk of a message body. Note that "chunk" in this context means any subpiece of the body, not necessarily the specific HTTP 1.1 chunks sent by the other side. the just-read chunk Emitted after receiving the Request-Line and request headers. Emitted immediately after writing the complete response body for a message. Emitted immediately after writing a portion of the message body to the network. the number of bytes written Emitted immediately after writing a body chunk for a message. Note that this signal is not parallel to [signal@ServerMessage::got-chunk]; it is emitted only when a complete chunk (added with [method@MessageBody.append] or [method@MessageBody.append_bytes] has been written. To get more useful continuous progress information, use [signal@ServerMessage::wrote-body-data]. Emitted immediately after writing the response headers for a message. Emitted immediately after writing a 1xx (Informational) response. A callback used to handle WebSocket requests to a #SoupServer. The callback will be invoked after sending the handshake response back to the client (and is only invoked if the handshake was successful). @path contains the path of the Request-URI, subject to the same rules as [callback@ServerCallback] `(qv)`. the #SoupServer the #SoupServerMessage the path component of @msg's Request-URI the newly created WebSocket connection the data passed to @soup_server_add_handler Soup session state object. #SoupSession is the object that controls client-side HTTP. A #SoupSession encapsulates all of the state that libsoup is keeping on behalf of your program; cached HTTP connections, authentication information, etc. It also keeps track of various global options and features that you are using. Most applications will only need a single #SoupSession; the primary reason you might need multiple sessions is if you need to have multiple independent authentication contexts. (Eg, you are connecting to a server and authenticating as two different users at different times; the easiest way to ensure that each [class@Message] is sent with the authentication information you intended is to use one session for the first user, and a second session for the other user.) Additional #SoupSession functionality is provided by [iface@SessionFeature] objects, which can be added to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type] For example, [class@Logger] provides support for logging HTTP traffic, [class@ContentDecoder] provides support for compressed response handling, and [class@ContentSniffer] provides support for HTML5-style response body content sniffing. Additionally, subtypes of [class@Auth] can be added as features, to add support for additional authentication types. All `SoupSession`s are created with a [class@AuthManager], and support for %SOUP_TYPE_AUTH_BASIC and %SOUP_TYPE_AUTH_DIGEST. Additionally, sessions using the plain #SoupSession class (rather than one of its deprecated subtypes) have a [class@ContentDecoder] by default. Note that all async methods will invoke their callbacks on the thread-default context at the time of the function call. Creates a #SoupSession with the default options. the new session. Creates a #SoupSession with the specified options. the new session. name of first property to set value of @optname1, followed by additional property/value pairs Cancels all pending requests in @session and closes all idle persistent connections. the session Adds @feature's functionality to @session. You cannot add multiple features of the same [alias@GLib.Type] to a session. See the main #SoupSession documentation for information on what features are present in sessions by default. a #SoupSession an object that implements #SoupSessionFeature If @feature_type is the type of a class that implements [iface@SessionFeature], this creates a new feature of that type and adds it to @session as with [method@Session.add_feature]. You can use this when you don't need to customize the new feature in any way. Adding multiple features of the same @feature_type is not allowed. If @feature_type is not a [iface@SessionFeature] type, this gives each existing feature on @session the chance to accept @feature_type as a "subfeature". This can be used to add new [class@Auth] types, for instance. See the main #SoupSession documentation for information on what features are present in sessions by default. a #SoupSession a #GType Get the value used by @session for the "Accept-Language" header on new requests. the accept language string a #SoupSession Gets whether @session automatically sets the "Accept-Language" header on new requests. %TRUE if @session sets "Accept-Language" header automatically, or %FALSE otherwise. a #SoupSession Gets the [class@Message] of the @result asynchronous operation This is useful to get the [class@Message] of an asynchronous operation started by @session from its [callback@Gio.AsyncReadyCallback]. a #SoupMessage or %NULL if @result is not a valid @session async operation result. a #SoupSession the #GAsyncResult passed to your callback Gets the feature in @session of type @feature_type. a #SoupSessionFeature, or %NULL. The feature is owned by @session. a #SoupSession the #GType of the feature to get Gets the feature in @session of type @feature_type, provided that it is not disabled for @msg. a #SoupSessionFeature. The feature is owned by @session. a #SoupSession the #GType of the feature to get a #SoupMessage Get the timeout in seconds for idle connection lifetime currently used by @session. the timeout in seconds a #SoupSession Get the [class@Gio.InetSocketAddress] to use for the client side of connections in @session. a #GInetSocketAddress a #SoupSession Get the maximum number of connections that @session can open at once. the maximum number of connections a #SoupSession Get the maximum number of connections that @session can open at once to a given host. the maximum number of connections per host a #SoupSession Get the [iface@Gio.ProxyResolver] currently used by @session. a #GProxyResolver or %NULL if proxies are disabled in @session a #SoupSession Gets the remote connectable if one set. the #GSocketConnectable a #SoupSession Get the timeout in seconds for socket I/O operations currently used by @session. the timeout in seconds a #SoupSession Get the [class@Gio.TlsDatabase] currently used by @session. a #GTlsDatabase a #SoupSession Get the [class@Gio.TlsInteraction] currently used by @session. a #GTlsInteraction a #SoupSession Get the value used by @session for the "User-Agent" header on new requests. the user agent string a #SoupSession Tests if @session has at a feature of type @feature_type (which can be the type of either a [iface@SessionFeature], or else a subtype of some class managed by another feature, such as [class@Auth]). %TRUE or %FALSE a #SoupSession the #GType of the class of features to check for Start a preconnection to @msg. Once the connection is done, it will remain in idle state so that it can be reused by future requests. If there's already an idle connection for the given @msg host, the operation finishes successfully without creating a new connection. If a new request for the given @msg host is made while the preconnect is still ongoing, the request will take the ownership of the connection and the preconnect operation will finish successfully (if there's a connection error it will be handled by the request). The operation finishes when the connection is done or an error occurred. a #SoupSession a #SoupMessage the I/O priority of the request a #GCancellable the callback to invoke when the operation finishes data for @progress_callback and @callback Complete a preconnect async operation started with [method@Session.preconnect_async]. %TRUE if the preconnect succeeded, or %FALSE in case of error. a #SoupSession the #GAsyncResult passed to your callback Removes @feature's functionality from @session. a #SoupSession a feature that has previously been added to @session Removes all features of type @feature_type (or any subclass of @feature_type) from @session. a #SoupSession a #GType Synchronously sends @msg and waits for the beginning of a response. On success, a [class@Gio.InputStream] will be returned which you can use to read the response body. ("Success" here means only that an HTTP response was received and understood; it does not necessarily mean that a 2xx class status code was received.) If non-%NULL, @cancellable can be used to cancel the request; [method@Session.send] will return a %G_IO_ERROR_CANCELLED error. Note that with requests that have side effects (eg, `POST`, `PUT`, `DELETE`) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state. If @msg is requeued due to a redirect or authentication, the initial (`3xx/401/407`) response body will be suppressed, and [method@Session.send] will only return once a final response has been received. a #GInputStream for reading the response body, or %NULL on error. a #SoupSession a #SoupMessage a #GCancellable Synchronously sends @msg and reads the response body. On success, a [struct@GLib.Bytes] will be returned with the response body. This function should only be used when the resource to be retrieved is not too long and can be stored in memory. See [method@Session.send] for more details on the general semantics. a #GBytes, or %NULL on error. a #SoupSession a #SoupMessage a #GCancellable Asynchronously sends @msg and reads the response body. When @callback is called, then either @msg has been sent, and its response body read, or else an error has occurred. This function should only be used when the resource to be retrieved is not too long and can be stored in memory. Call [method@Session.send_and_read_finish] to get a [struct@GLib.Bytes] with the response body. See [method@Session.send] for more details on the general semantics. a #SoupSession a #SoupMessage the I/O priority of the request a #GCancellable the callback to invoke data for @callback Gets the response to a [method@Session.send_and_read_async]. If successful, returns a [struct@GLib.Bytes] with the response body. a #GBytes, or %NULL on error. a #SoupSession the #GAsyncResult passed to your callback Synchronously sends @msg and splices the response body stream into @out_stream. See [method@Session.send] for more details on the general semantics. a #gssize containing the size of the data spliced, or -1 if an error occurred. a #SoupSession a #SoupMessage a #GOutputStream a set of #GOutputStreamSpliceFlags a #GCancellable 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. a #SoupSession a #SoupMessage a #GOutputStream a set of #GOutputStreamSpliceFlags the I/O priority of the request a #GCancellable the callback to invoke data for @callback Gets the response to a [method@Session.send_and_splice_async]. a #gssize containing the size of the data spliced, or -1 if an error occurred. a #SoupSession the #GAsyncResult passed to your callback Asynchronously sends @msg and waits for the beginning of a response. When @callback is called, then either @msg has been sent, and its response headers received, or else an error has occurred. Call [method@Session.send_finish] to get a [class@Gio.InputStream] for reading the response body. See [method@Session.send] for more details on the general semantics. a #SoupSession a #SoupMessage the I/O priority of the request a #GCancellable the callback to invoke data for @callback Gets the response to a [method@Session.send_async] call. If successful returns a [class@Gio.InputStream] that can be used to read the response body. a #GInputStream for reading the response body, or %NULL on error. a #SoupSession the #GAsyncResult passed to your callback Set the value to use for the "Accept-Language" header on [class@Message]s sent from @session. If @accept_language is %NULL then no "Accept-Language" will be included in requests. See [property@Session:accept-language] for more information. a #SoupSession the languages string Set whether @session will automatically set the "Accept-Language" header on requests using a value generated from system languages based on [func@GLib.get_language_names]. See [property@Session:accept-language-auto] for more information. a #SoupSession the value to set Set a timeout in seconds for idle connection lifetime to be used by @session on new connections. See [property@Session:idle-timeout] for more information. a #SoupSession a timeout in seconds Set a [iface@Gio.ProxyResolver] to be used by @session on new connections. If @proxy_resolver is %NULL then no proxies will be used. See [property@Session:proxy-resolver] for more information. a #SoupSession a #GProxyResolver or %NULL Set a timeout in seconds for socket I/O operations to be used by @session on new connections. See [property@Session:timeout] for more information. a #SoupSession a timeout in seconds Set a [class@GIo.TlsDatabase] to be used by @session on new connections. If @tls_database is %NULL then certificate validation will always fail. See [property@Session:tls-database] for more information. a #SoupSession a #GTlsDatabase Set a [class@Gio.TlsInteraction] to be used by @session on new connections. If @tls_interaction is %NULL then client certificate validation will always fail. See [property@Session:tls-interaction] for more information. a #SoupSession a #GTlsInteraction Set the value to use for the "User-Agent" header on [class@Message]s sent from @session. If @user_agent has trailing whitespace, @session will append its own product token (eg, `libsoup/3.0.0`) to the end of the header for you. If @user_agent is %NULL then no "User-Agent" will be included in requests. See [property@Session:user-agent] for more information. a #SoupSession the user agent string Asynchronously creates a [class@WebsocketConnection] to communicate with a remote server. All necessary WebSocket-related headers will be added to @msg, and it will then be sent and asynchronously processed normally (including handling of redirection and HTTP authentication). If the server returns "101 Switching Protocols", then @msg's status code and response headers will be updated, and then the WebSocket handshake will be completed. On success, [method@Session.websocket_connect_finish] will return a new [class@WebsocketConnection]. On failure it will return a #GError. If the server returns a status other than "101 Switching Protocols", then @msg will contain the complete response headers and body from the server's response, and [method@Session.websocket_connect_finish] will return %SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET. a #SoupSession #SoupMessage indicating the WebSocket server to connect to origin of the connection a %NULL-terminated array of protocols supported the I/O priority of the request a #GCancellable the callback to invoke data for @callback Gets the [class@WebsocketConnection] response to a [method@Session.websocket_connect_async] call. If successful, returns a [class@WebsocketConnection] that can be used to communicate with the server. a new #SoupWebsocketConnection, or %NULL on error. a #SoupSession the #GAsyncResult passed to your callback If non-%NULL, the value to use for the "Accept-Language" header on [class@Message]s sent from this session. Setting this will disable [property@Session:accept-language-auto]. If %TRUE, #SoupSession will automatically set the string for the "Accept-Language" header on every [class@Message] sent, based on the return value of [func@GLib.get_language_names]. Setting this will override any previous value of [property@Session:accept-language]. Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed. Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value. Sets the [class@Gio.InetSocketAddress] to use for the client side of the connection. Use this property if you want for instance to bind the local socket to a specific IP address. The maximum number of connections that the session can open at once. The maximum number of connections that the session can open at once to a given host. A [iface@Gio.ProxyResolver] to use with this session. If no proxy resolver is set, then the default proxy resolver will be used. See [func@Gio.ProxyResolver.get_default]. You can set it to %NULL if you don't want to use proxies, or set it to your own [iface@Gio.ProxyResolver] if you want to control what proxies get used. Sets a socket to make outgoing connections on. This will override the default behaviour of opening TCP/IP sockets to the hosts specified in the URIs. This function is not required for common HTTP usage, but only when connecting to a HTTP service that is not using standard TCP/IP sockets. An example of this is a local service that uses HTTP over UNIX-domain sockets, in that case a [class@Gio.UnixSocketAddress] can be passed to this function. The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request). Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value. Not to be confused with [property@Session:idle-timeout] (which is the length of time that idle persistent connections will be kept open). Sets the [class@Gio.TlsDatabase] to use for validating SSL/TLS certificates. If no certificate database is set, then the default database will be used. See [method@Gio.TlsBackend.get_default_database]. A [class@Gio.TlsInteraction] object that will be passed on to any [class@Gio.TlsConnection]s created by the session. This can be used to provide client-side certificates, for example. User-Agent string. If non-%NULL, the value to use for the "User-Agent" header on [class@Message]s sent from this session. RFC 2616 says: "The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests." The User-Agent header contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens. If you set a [property@Session:user-agent] property that has trailing whitespace, #SoupSession will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you. Emitted when a request is queued on @session. When sending a request, first [signal@Session::request-queued] is emitted, indicating that the session has become aware of the request. After a connection is available to send the request various [class@Message] signals are emitted as the message is processed. If the message is requeued, it will emit [signal@Message::restarted], which will then be followed by other [class@Message] signals when the message is re-sent. Eventually, the message will emit [signal@Message::finished]. Normally, this signals the completion of message processing. However, it is possible that the application will requeue the message from the "finished" handler. In that case the process will loop back. Eventually, a message will reach "finished" and not be requeued. At that point, the session will emit [signal@Session::request-unqueued] to indicate that it is done with the message. To sum up: [signal@Session::request-queued] and [signal@Session::request-unqueued] are guaranteed to be emitted exactly once, but [signal@Message::finished] (and all of the other [class@Message] signals) may be invoked multiple times for a given message. the request that was queued Emitted when a request is removed from @session's queue, indicating that @session is done with it. See [signal@Session::request-queued] for a detailed description of the message lifecycle within a session. the request that was unqueued A #SoupSession error. the server's response could not be parsed the server's response was in an unsupported format the message has been redirected too many times the message has been restarted too many times failed to redirect message because Location header was missing or empty in response failed to redirect message because Location header contains an invalid URI the message is already in the session queue. Messages can only be reused after unqueued. Registers error quark for SoupSession if needed. Error quark for SoupSession. Interface for miscellaneous [class@Session] features. #SoupSessionFeature is the interface used by classes that extend the functionality of a [class@Session]. Some features like HTTP authentication handling are implemented internally via `SoupSessionFeature`s. Other features can be added to the session by the application. (Eg, [class@Logger], [class@CookieJar].) See [method@Session.add_feature], etc, to add a feature to a session. The interface implemented by [iface@SessionFeature]s. These represent the known HTTP status code values, plus various network and internal errors. Note that no libsoup functions take or return this type directly; any function that works with status codes will accept unrecognized status codes as well. No status available. (Eg, the message has not been sent yet) 100 Continue (HTTP) 101 Switching Protocols (HTTP) 102 Processing (WebDAV) 200 Success (HTTP). Also used by many lower-level soup routines to indicate success. 201 Created (HTTP) 202 Accepted (HTTP) 203 Non-Authoritative Information (HTTP) 204 No Content (HTTP) 205 Reset Content (HTTP) 206 Partial Content (HTTP) 207 Multi-Status (WebDAV) 300 Multiple Choices (HTTP) 301 Moved Permanently (HTTP) 302 Found (HTTP) 302 Moved Temporarily (old name, RFC 2068) 303 See Other (HTTP) 304 Not Modified (HTTP) 305 Use Proxy (HTTP) 306 [Unused] (HTTP) 307 Temporary Redirect (HTTP) 308 Permanent Redirect (HTTP) 400 Bad Request (HTTP) 401 Unauthorized (HTTP) 402 Payment Required (HTTP) 403 Forbidden (HTTP) 404 Not Found (HTTP) 405 Method Not Allowed (HTTP) 406 Not Acceptable (HTTP) 407 Proxy Authentication Required (HTTP) shorter alias for %SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED 408 Request Timeout (HTTP) 409 Conflict (HTTP) 410 Gone (HTTP) 411 Length Required (HTTP) 412 Precondition Failed (HTTP) 413 Request Entity Too Large (HTTP) 414 Request-URI Too Long (HTTP) 415 Unsupported Media Type (HTTP) 416 Requested Range Not Satisfiable (HTTP) shorter alias for %SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE 417 Expectation Failed (HTTP) 421 Misdirected Request 422 Unprocessable Entity (WebDAV) 423 Locked (WebDAV) 424 Failed Dependency (WebDAV) 500 Internal Server Error (HTTP) 501 Not Implemented (HTTP) 502 Bad Gateway (HTTP) 503 Service Unavailable (HTTP) 504 Gateway Timeout (HTTP) 505 HTTP Version Not Supported (HTTP) 507 Insufficient Storage (WebDAV) 510 Not Extended (RFC 2774) Looks up the stock HTTP description of @status_code. *There is no reason for you to ever use this function.* If you wanted the textual description for the [property@Message:status-code] of a given [class@Message], you should just look at the message's [property@Message:reason-phrase]. However, you should only do that for use in debugging messages; HTTP reason phrases are not localized, and are not generally very descriptive anyway, and so they should never be presented to the user directly. Instead, you should create you own error messages based on the status code, and on what you were trying to do. the (terse, English) description of @status_code an HTTP status code Error codes for %SOUP_TLD_ERROR. A hostname was syntactically invalid. The passed-in "hostname" was actually an IP address (and thus has no base domain or public suffix). The passed-in hostname did not have enough components. Eg, calling [func@tld_get_base_domain] on <literal>"co.uk"</literal>. The passed-in hostname has no recognized public suffix. The Public Suffix List was not available. Registers error quark for soup_tld_get_base_domain() if needed. Error quark for Soup TLD functions. Marks a symbol unavailable before the given major and minor version. You should use `SOUP_AVAILABLE_IN_*` in order to handle versioning. the major version that introduced the symbol the minor version that introduced the symbol Enum values passed to [func@uri_copy] to indicate the components of the URI that should be updated with the given values. no component the URI scheme component the URI user component the URI password component the URI authentication parameters component the URI host component the URI port component the URI path component the URI query component the URI fragment component A macro that should be defined by the user prior to including `libsoup.h`. The definition should be one of the predefined libsoup version macros: %SOUP_VERSION_2_24, %SOUP_VERSION_2_26, ... This macro defines the earliest version of libsoup that the package is required to be able to compile against. If the compiler is configured to warn about the use of deprecated functions, then using functions that were deprecated in version %SOUP_VERSION_MIN_REQUIRED or earlier will cause warnings (but using functions deprecated in later releases will not). Pre-defined close codes that can be passed to [method@WebsocketConnection.close] or received from [method@WebsocketConnection.get_close_code]. However, other codes are also allowed. a normal, non-error close the client/server is going away a protocol error occurred the endpoint received data of a type that it does not support. reserved value indicating that no close code was present; must not be sent. reserved value indicating that the connection was closed abnormally; must not be sent. the endpoint received data that was invalid (eg, non-UTF-8 data in a text message). generic error code indicating some sort of policy violation. the endpoint received a message that is too big to process. the client is closing the connection because the server failed to negotiate a required extension. the server is closing the connection because it was unable to fulfill the request. reserved value indicating that the TLS handshake failed; must not be sent. The WebSocket Protocol Provides support for the [WebSocket](http://tools.ietf.org/html/rfc6455) protocol. To connect to a WebSocket server, create a [class@Session] and call [method@Session.websocket_connect_async]. To accept WebSocket connections, create a [class@Server] and add a handler to it with [method@Server.add_websocket_handler]. (Lower-level support is available via [func@websocket_client_prepare_handshake] and [func@websocket_client_verify_handshake], for handling the client side of the WebSocket handshake, and [func@websocket_server_process_handshake] for handling the server side.) #SoupWebsocketConnection handles the details of WebSocket communication. You can use [method@WebsocketConnection.send_text] and [method@WebsocketConnection.send_binary] to send data, and the [signal@WebsocketConnection::message] signal to receive data. (#SoupWebsocketConnection currently only supports asynchronous I/O.) Creates a #SoupWebsocketConnection on @stream with the given active @extensions. This should be called after completing the handshake to begin using the WebSocket protocol. a new #SoupWebsocketConnection a #GIOStream connected to the WebSocket server the URI of the connection the type of connection (client/side) the Origin of the client the subprotocol in use a #GList of #SoupWebsocketExtension objects Close the connection in an orderly fashion. Note that until the [signal@WebsocketConnection::closed] signal fires, the connection is not yet completely closed. The close message is not even sent until the main loop runs. The @code and @data are sent to the peer along with the close request. If @code is %SOUP_WEBSOCKET_CLOSE_NO_STATUS a close message with no body (without code and data) is sent. Note that the @data must be UTF-8 valid. the WebSocket close code close data Get the close code received from the WebSocket peer. This only becomes valid once the WebSocket is in the %SOUP_WEBSOCKET_STATE_CLOSED state. The value will often be in the [enum@WebsocketCloseCode] enumeration, but may also be an application defined close code. the close code or zero. the WebSocket Get the close data received from the WebSocket peer. This only becomes valid once the WebSocket is in the %SOUP_WEBSOCKET_STATE_CLOSED state. The data may be freed once the main loop is run, so copy it if you need to keep it around. the close data or %NULL the WebSocket Get the connection type (client/server) of the connection. the connection type the WebSocket Get the extensions chosen via negotiation with the peer. a #GList of #SoupWebsocketExtension objects the WebSocket Get the I/O stream the WebSocket is communicating over. the WebSocket's I/O stream. the WebSocket Gets the keepalive interval in seconds or 0 if disabled. the keepalive interval. the WebSocket Gets the keepalive pong timeout in seconds or 0 if disabled. the keepalive pong timeout. the WebSocket Gets the maximum payload size allowed for incoming packets. the maximum payload size. the WebSocket Get the origin of the WebSocket. the origin the WebSocket Get the protocol chosen via negotiation with the peer. the chosen protocol the WebSocket Get the current state of the WebSocket. the state the WebSocket Get the URI of the WebSocket. For servers this represents the address of the WebSocket, and for clients it is the address connected to. the URI the WebSocket Send a binary message to the peer. If @length is 0, @data may be %NULL. The message is queued to be sent and will be sent when the main loop is run. the WebSocket the message contents the length of @data Send a message of the given @type to the peer. Note that this method, allows to send text messages containing %NULL characters. The message is queued to be sent and will be sent when the main loop is run. the WebSocket the type of message contents the message data as #GBytes Send a %NULL-terminated text (UTF-8) message to the peer. If you need to send text messages containing %NULL characters use [method@WebsocketConnection.send_message] instead. The message is queued to be sent and will be sent when the main loop is run. the WebSocket the message contents Sets the interval in seconds on when to send a ping message which will serve as a keepalive message. If set to 0 the keepalive message is disabled. the WebSocket the interval to send a ping message or 0 to disable it Set the timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection. If set to 0 then the absence of pongs from keepalive pings is ignored. the WebSocket the timeout in seconds Sets the maximum payload size allowed for incoming packets. It does not limit the outgoing packet size. the WebSocket the maximum payload size The type of connection (client/server). List of [class@WebsocketExtension] objects that are active in the connection. The underlying IO stream the WebSocket is communicating over. The input and output streams must be pollable streams. Interval in seconds on when to send a ping message which will serve as a keepalive message. If set to 0 the keepalive message is disabled. Timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection. The WebSocket will be transitioned to a closed state when this happens. If set to 0 then the absence of pongs from keepalive pings is ignored. The maximum payload size for incoming packets. The protocol expects or 0 to not limit it. The client's Origin. The chosen protocol, or %NULL if a protocol was not agreed upon. The current state of the WebSocket. The URI of the WebSocket. For servers this represents the address of the WebSocket, and for clients it is the address connected to. Emitted when the connection has completely closed. This happens either due to an orderly close from the peer, one initiated via [method@WebsocketConnection.close] or a fatal error condition that caused a close. This signal will be emitted once. This signal will be emitted during an orderly close. Emitted when an error occurred on the WebSocket. This may be fired multiple times. Fatal errors will be followed by the [signal@WebsocketConnection::closed] signal being emitted. the error that occured Emitted when we receive a message from the peer. As a convenience, the @message data will always be %NULL-terminated, but the NUL byte will not be included in the length count. the type of message contents the message data Emitted when we receive a Pong frame (solicited or unsolicited) from the peer. As a convenience, the @message data will always be %NULL-terminated, but the NUL byte will not be included in the length count. the application data (if any) The abstract base class for [class@WebsocketConnection]. The type of a [class@WebsocketConnection]. unknown/invalid connection a client-side connection a server-side connection The type of data contained in a [signal@WebsocketConnection::message] signal. UTF-8 text binary data WebSocket-related errors. a generic error attempted to handshake with a server that does not appear to understand WebSockets. the WebSocket handshake failed because some detail was invalid (eg, incorrect accept key). the WebSocket handshake failed because the "Origin" header was not an allowed value. Registers error quark for SoupWebsocket if needed. Error quark for SoupWebsocket. A WebSocket extension #SoupWebsocketExtension is the base class for WebSocket extension objects. Configures @extension with the given @params. %TRUE if extension could be configured with the given parameters, or %FALSE otherwise a #SoupWebsocketExtension either %SOUP_WEBSOCKET_CONNECTION_CLIENT or %SOUP_WEBSOCKET_CONNECTION_SERVER the parameters Get the parameters strings to be included in the request header. If the extension doesn't include any parameter in the request, this function returns %NULL. a new allocated string with the parameters a #SoupWebsocketExtension Get the parameters strings to be included in the response header. If the extension doesn't include any parameter in the response, this function returns %NULL. a new allocated string with the parameters a #SoupWebsocketExtension Process a message after it's received. If the payload isn't changed the given @payload is just returned, otherwise [method@GLib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data. Extensions using reserved bits of the header will reset them in @header. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data Process a message before it's sent. If the payload isn't changed the given @payload is just returned, otherwise [method@Glib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data. Extensions using reserved bits of the header will change them in @header. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data Configures @extension with the given @params. %TRUE if extension could be configured with the given parameters, or %FALSE otherwise a #SoupWebsocketExtension either %SOUP_WEBSOCKET_CONNECTION_CLIENT or %SOUP_WEBSOCKET_CONNECTION_SERVER the parameters Get the parameters strings to be included in the request header. If the extension doesn't include any parameter in the request, this function returns %NULL. a new allocated string with the parameters a #SoupWebsocketExtension Get the parameters strings to be included in the response header. If the extension doesn't include any parameter in the response, this function returns %NULL. a new allocated string with the parameters a #SoupWebsocketExtension Process a message after it's received. If the payload isn't changed the given @payload is just returned, otherwise [method@GLib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data. Extensions using reserved bits of the header will reset them in @header. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data Process a message before it's sent. If the payload isn't changed the given @payload is just returned, otherwise [method@Glib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data. Extensions using reserved bits of the header will change them in @header. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data The class structure for the #SoupWebsocketExtension. the parent class the name of the extension called to configure the extension with the given parameters %TRUE if extension could be configured with the given parameters, or %FALSE otherwise a #SoupWebsocketExtension either %SOUP_WEBSOCKET_CONNECTION_CLIENT or %SOUP_WEBSOCKET_CONNECTION_SERVER the parameters called by the client to build the request header. It should include the parameters string starting with ';' a new allocated string with the parameters a #SoupWebsocketExtension called by the server to build the response header. It should include the parameters string starting with ';' a new allocated string with the parameters a #SoupWebsocketExtension called to process the payload data of a message before it's sent. Reserved bits of the header should be changed. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data called to process the payload data of a message after it's received. Reserved bits of the header should be cleared. the message payload data, or %NULL in case of error a #SoupWebsocketExtension the message header the payload data A SoupWebsocketExtensionDeflate is a [class@WebsocketExtension] implementing permessage-deflate (RFC 7692). This extension is used by default in a [class@Session] when [class@WebsocketExtensionManager] feature is present, and always used by [class@Server]. SoupWebsocketExtensionManager is the [iface@SessionFeature] that handles WebSockets extensions for a [class@Session]. A #SoupWebsocketExtensionManager is added to the session by default, and normally you don't need to worry about it at all. However, if you want to disable WebSocket extensions, you can remove the feature from the session with [method@Session.remove_feature_by_type] or disable it on individual requests with [method@Message.disable_feature]. The state of the WebSocket connection. the connection is ready to send messages the connection is in the process of closing down; messages may be received, but not sent the connection is completely closed down Like [func@CHECK_VERSION], but the check for soup_check_version is at runtime instead of compile time. This is useful for compiling against older versions of libsoup, but using features from newer versions. %TRUE if the version of the libsoup currently loaded is the same as or newer than the passed-in version. the major version to check the minor version to check the micro version to check Parses @header and returns a #SoupCookie. If @header contains multiple cookies, only the first one will be parsed. If @header does not have "path" or "domain" attributes, they will be defaulted from @origin. If @origin is %NULL, path will default to "/", but domain will be left as %NULL. Note that this is not a valid state for a #SoupCookie, and you will need to fill in some 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. a new #SoupCookie, or %NULL if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from @origin. a cookie string (eg, the value of a Set-Cookie header) origin of the cookie Frees @cookies. a #GSList of #SoupCookie Parses @msg's Cookie request header and returns a [struct@GLib.SList] of `SoupCookie`s. As the "Cookie" header, unlike "Set-Cookie", only contains cookie names and values, none of the other #SoupCookie fields will be filled in. (Thus, you can't generally pass a cookie returned from this method directly to [func@cookies_to_response].) a #GSList of `SoupCookie`s, which can be freed with [method@Cookie.free]. a #SoupMessage containing a "Cookie" request header Parses @msg's Set-Cookie response headers and returns a [struct@GLib.SList] of `SoupCookie`s. Cookies that do not specify "path" or "domain" attributes will have their values defaulted from @msg. a #GSList of `SoupCookie`s, which can be freed with [method@Cookie.free]. a #SoupMessage containing a "Set-Cookie" response header Serializes a [struct@GLib.SList] of #SoupCookie into a string suitable for setting as the value of the "Cookie" header. the serialization of @cookies a #GSList of #SoupCookie Adds the name and value of each cookie in @cookies to @msg's "Cookie" request. If @msg already has a "Cookie" request header, these cookies will be appended to the cookies already present. Be careful that you do not append the same cookies twice, eg, when requeuing a message. a #GSList of #SoupCookie a #SoupMessage Appends a "Set-Cookie" response header to @msg for each cookie in @cookies. This is in addition to any other "Set-Cookie" headers @msg may already have. a #GSList of #SoupCookie a #SoupMessage Parses @date_string and tries to extract a date from it. This recognizes all of the "HTTP-date" formats from RFC 2616, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading "0"s, etc.) a new #GDateTime, or %NULL if @date_string could not be parsed. The date as a string Converts @date to a string in the format described by @format. @date as a string or %NULL a #GDateTime the format to generate the date in Decodes @form. which is an urlencoded dataset as defined in the HTML 4.01 spec. a hash table containing the name/value pairs from @encoded_form, which you can free with [func@GLib.HashTable.destroy]. data of type "application/x-www-form-urlencoded" Decodes the "multipart/form-data" request in @multipart. this is a convenience method for the case when you have a single file upload control in a form. (Or when you don't have any file upload controls, but are still using "multipart/form-data" anyway.) Pass the name of the file upload control in @file_control_name, and [func@form_decode_multipart] will extract the uploaded file data into @filename, @content_type, and @file. All of the other form control data will be returned (as strings, as with [func@form_decode] in the returned [struct@GLib.HashTable]. You may pass %NULL for @filename, @content_type and/or @file if you do not care about those fields. [func@form_decode_multipart] may also return %NULL in those fields if the client did not provide that information. You must free the returned filename and content-type with [func@GLib.free], and the returned file data with [method@Glib.Bytes.unref]. If you have a form with more than one file upload control, you will need to decode it manually, using [ctor@Multipart.new_from_message] and [method@Multipart.get_part]. a hash table containing the name/value pairs (other than @file_control_name) from @msg, which you can free with [func@GLib.HashTable.destroy]. On error, it will return %NULL. a #SoupMultipart the name of the HTML file upload control return location for the name of the uploaded file return location for the MIME type of the uploaded file return location for the uploaded file data Encodes the given field names and values into a value of type "application/x-www-form-urlencoded". Encodes as defined in the HTML 4.01 spec. This method requires you to know the names of the form fields (or at the very least, the total number of fields) at compile time; for working with dynamic forms, use [func@form_encode_hash] or [func@form_encode_datalist]. See also: [ctor@Message.new_from_encoded_form]. the encoded form name of the first form field value of @first_field, followed by additional field names and values, terminated by %NULL. Encodes @form_data_set into a value of type "application/x-www-form-urlencoded". Encodes as defined in the HTML 4.01 spec. Unlike [func@form_encode_hash], this preserves the ordering of the form elements, which may be required in some situations. See also: [ctor@Message.new_from_encoded_form]. the encoded form a datalist containing name/value pairs Encodes @form_data_set into a value of type "application/x-www-form-urlencoded". Encodes as defined in the HTML 4.01 spec. Note that the HTML spec states that "The control names/values are listed in the order they appear in the document." Since this method takes a hash table, it cannot enforce that; if you care about the ordering of the form fields, use [func@form_encode_datalist]. See also: [ctor@Message.new_from_encoded_form]. the encoded form a hash table containing name/value pairs (as strings) See [func@form_encode]. This is mostly an internal method, used by various other methods such as [func@form_encode]. See also: [ctor@Message.new_from_encoded_form]. the encoded form name of the first form field pointer to additional values, as in [func@form_encode] Returns the major version number of the libsoup library. e.g. in libsoup version 2.42.0 this is 2. This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MAJOR_VERSION macro, which represents the major version of the libsoup headers you have included when compiling your code. the major version number of the libsoup library Returns the micro version number of the libsoup library. e.g. in libsoup version 2.42.0 this is 0. This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MICRO_VERSION macro, which represents the micro version of the libsoup headers you have included when compiling your code. the micro version number of the libsoup library Returns the minor version number of the libsoup library. e.g. in libsoup version 2.42.0 this is 42. This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MINOR_VERSION macro, which represents the minor version of the libsoup headers you have included when compiling your code. the minor version number of the libsoup library Parses @header to see if it contains the token @token (matched case-insensitively). Note that this can't be used with lists that have qvalues. whether or not @header contains @token An HTTP header suitable for parsing with [func@header_parse_list] a token Frees @list. a #GSList returned from [func@header_parse_list] or [func@header_parse_quality_list] Frees @param_list. a #GHashTable returned from [func@header_parse_param_list] or [func@header_parse_semi_param_list] 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. Alternatively, if @value is a non-ASCII UTF-8 string, it will be appended using RFC5987 syntax. Although in theory this is supposed to work anywhere in HTTP that uses this style of parameter, in reality, it can only be used portably with the Content-Disposition "filename" parameter. If @value is %NULL, this will just append @name to @string. a #GString being used to construct an HTTP header value a parameter name a parameter value, or %NULL Appends something like `name="value"` to @string, taking care to escape any quotes or backslashes in @value. If @value is (non-ASCII) UTF-8, this will instead use RFC 5987 encoding, just like [func@header_g_string_append_param]. a #GString being used to construct an HTTP header value a parameter name a parameter value Parses a header whose content is described by RFC2616 as `#something`. "something" does not itself contain commas, except as part of quoted-strings. a #GSList of list elements, as allocated strings a header value Parses a header which is a comma-delimited list of something like: `token [ "=" ( token | quoted-string ) ]`. Tokens that don't have an associated value will still be added to the resulting hash table, but with a %NULL value. This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header). a #GHashTable of list elements, which can be freed with [func@header_free_param_list]. a header value A strict version of [func@header_parse_param_list] that bails out if there are duplicate parameters. Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use [func@header_parse_param_list] instead. a #GHashTable of list elements, which can be freed with [func@header_free_param_list] or %NULL if there are duplicate elements. a header value Parses a header whose content is a list of items with optional "qvalue"s (eg, Accept, Accept-Charset, Accept-Encoding, Accept-Language, TE). If @unacceptable is not %NULL, then on return, it will contain the items with qvalue 0. Either way, those items will be removed from the main list. a #GSList of acceptable values (as allocated strings), highest-qvalue first. a header value on return, will contain a list of unacceptable values Parses a header which is a semicolon-delimited list of something like: `token [ "=" ( token | quoted-string ) ]`. Tokens that don't have an associated value will still be added to the resulting hash table, but with a %NULL value. This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header). a #GHashTable of list elements, which can be freed with [func@header_free_param_list]. a header value A strict version of [func@header_parse_semi_param_list] that bails out if there are duplicate parameters. Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use [func@header_parse_semi_param_list] instead. a #GHashTable of list elements, which can be freed with [func@header_free_param_list] or %NULL if there are duplicate elements. a header value Parses the headers of an HTTP request or response in @str and stores the results in @dest. Beware that @dest may be modified even on failure. This is a low-level method; normally you would use [func@headers_parse_request] or [func@headers_parse_response]. success or failure the header string (including the Request-Line or Status-Line, but not the trailing blank line) length of @str #SoupMessageHeaders to store the header values in Parses the headers of an HTTP request in @str and stores the results in @req_method, @req_path, @ver, and @req_headers. Beware that @req_headers may be modified even on failure. %SOUP_STATUS_OK if the headers could be parsed, or an HTTP error to be returned to the client if they could not be. the headers (up to, but not including, the trailing blank line) length of @str #SoupMessageHeaders to store the header values in if non-%NULL, will be filled in with the request method if non-%NULL, will be filled in with the request path if non-%NULL, will be filled in with the HTTP version Parses the headers of an HTTP response in @str and stores the results in @ver, @status_code, @reason_phrase, and @headers. Beware that @headers may be modified even on failure. success or failure. the headers (up to, but not including, the trailing blank line) length of @str #SoupMessageHeaders to store the header values in if non-%NULL, will be filled in with the HTTP version if non-%NULL, will be filled in with the status code if non-%NULL, will be filled in with the reason phrase Parses the HTTP Status-Line string in @status_line into @ver, @status_code, and @reason_phrase. @status_line must be terminated by either "\0" or "\r\n". %TRUE if @status_line was parsed successfully. an HTTP Status-Line if non-%NULL, will be filled in with the HTTP version if non-%NULL, will be filled in with the status code if non-%NULL, will be filled in with the reason phrase Initializes @iter for iterating @hdrs. a pointer to a %SoupMessageHeadersIter structure a %SoupMessageHeaders Registers error quark for SoupSession if needed. Error quark for SoupSession. soup-method.h contains a number of defines for standard HTTP and WebDAV headers. You do not need to use these defines; you can pass arbitrary strings to soup_message_new() if you prefer. The thing that these defines <emphasis>are</emphasis> useful for is performing quick comparisons against soup_message_get_method(); because #SoupMessage always contains an interned string, and these macros return interned strings, you can compare methods directly against these macros rather than needing to use strcmp(). This is most useful in #SoupServer handlers. Eg: <informalexample><programlisting> if (soup_message_get_method (msg) != SOUP_METHOD_GET &amp;&amp; soup_message_get_method (msg) != SOUP_METHOD_HEAD) { soup_message_set_status (msg, SOUP_METHOD_NOT_IMPLEMENTED); return; } </programlisting></informalexample> Looks up the stock HTTP description of @status_code. *There is no reason for you to ever use this function.* If you wanted the textual description for the [property@Message:status-code] of a given [class@Message], you should just look at the message's [property@Message:reason-phrase]. However, you should only do that for use in debugging messages; HTTP reason phrases are not localized, and are not generally very descriptive anyway, and so they should never be presented to the user directly. Instead, you should create you own error messages based on the status code, and on what you were trying to do. the (terse, English) description of @status_code an HTTP status code Looks whether the @domain passed as argument is a public domain suffix (.org, .com, .co.uk, etc) or not. Prior to libsoup 2.46, this function required that @domain be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format. %TRUE if it is a public domain, %FALSE otherwise. a domain name Registers error quark for soup_tld_get_base_domain() if needed. Error quark for Soup TLD functions. Finds the base domain for a given @hostname The base domain is composed by the top level domain (such as .org, .com, .co.uk, etc) plus the second level domain, for example for myhost.mydomain.com it will return mydomain.com. Note that %NULL will be returned for private URLs (those not ending with any well known TLD) because choosing a base domain for them would be totally arbitrary. Prior to libsoup 2.46, this function required that @hostname be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format (and the return value will be in the same format). a pointer to the start of the base domain in @hostname. If an error occurs, %NULL will be returned and @error set. a hostname 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. a new #GUri the #GUri to copy first #SoupURIComponent to update value of @first_component followed by additional components and values, terminated by %SOUP_URI_NONE Decodes the given data URI and returns its contents and @content_type. a #GBytes with the contents of @uri, or %NULL if @uri is not a valid data URI a data URI, in string form location to store content type Tests whether or not @uri1 and @uri2 are equal in all parts. %TRUE if equal otherwise %FALSE a #GUri another #GUri Adds the necessary headers to @msg to request a WebSocket handshake including supported WebSocket extensions. The message body and non-WebSocket-related headers are not modified. This is a low-level function; if you use [method@Session.websocket_connect_async] to create a WebSocket connection, it will call this for you. a #SoupMessage the "Origin" header to set list of protocols to offer list of supported extension types Looks at the response status code and headers in @msg and determines if they contain a valid WebSocket handshake response (given the handshake request in @msg's request headers). If @supported_extensions is non-%NULL, extensions included in the response "Sec-WebSocket-Extensions" are verified too. Accepted extensions are returned in @accepted_extensions parameter if non-%NULL. This is a low-level function; if you use [method@Session.websocket_connect_async] to create a WebSocket connection, it will call this for you. %TRUE if @msg contains a completed valid WebSocket handshake, %FALSE and an error if not. #SoupMessage containing both client and server sides of a WebSocket handshake list of supported extension types a #GList of #SoupWebsocketExtension objects Registers error quark for SoupWebsocket if needed. Error quark for SoupWebsocket. Examines the method and request headers in @msg and determines whether @msg contains a valid handshake request. If @origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. If @supported_extensions is non-%NULL, then only requests containing valid supported extensions in "Sec-WebSocket-Extensions" header will be accepted. Normally [func@websocket_server_process_handshake] will take care of this for you, and if you use [method@Server.add_websocket_handler] to handle accepting WebSocket connections, it will call that for you. However, this function may be useful if you need to perform more complicated validation; eg, accepting multiple different Origins, or handling different protocols depending on the path. %TRUE if @msg contained a valid WebSocket handshake, %FALSE and an error if not. #SoupServerMessage containing the client side of a WebSocket handshake expected Origin header allowed WebSocket protocols. list of supported extension types Examines the method and request headers in @msg and (assuming @msg contains a valid handshake request), fills in the handshake response. If @expected_origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. If @supported_extensions is non-%NULL, then only requests containing valid supported extensions in "Sec-WebSocket-Extensions" header will be accepted. The accepted extensions will be returned in @accepted_extensions parameter if non-%NULL. This is a low-level function; if you use [method@Server.add_websocket_handler] to handle accepting WebSocket connections, it will call this for you. %TRUE if @msg contained a valid WebSocket handshake request and was updated to contain a handshake response. %FALSE if not. #SoupServerMessage containing the client side of a WebSocket handshake expected Origin header allowed WebSocket protocols. list of supported extension types a #GList of #SoupWebsocketExtension objects