Core HTTP API

<refentry> <refmeta> <refentrytitle>SoupCookie</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupCookie</refentrytitle>

<refname>SoupCookie</refname> <refpurpose>HTTP Cookies</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupCookie</returnvalue> * </entry><entry>soup_cookie_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupCookie</returnvalue> * </entry><entry>soup_cookie_parse <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupCookie</returnvalue> * </entry><entry>soup_cookie_copy <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_free <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_name <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_cookie_get_name <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_value <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_cookie_get_value <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_domain <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_cookie_get_domain <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_path <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_cookie_get_path <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_max_age <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_expires <phrase>()</phrase></entry></row> <row><entry><returnvalue>GDateTime</returnvalue> * </entry><entry>soup_cookie_get_expires <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_secure <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_cookie_get_secure <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_http_only <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_cookie_get_http_only <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookie_set_same_site_policy <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupSameSitePolicy</returnvalue> </entry><entry>soup_cookie_get_same_site_policy <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_cookie_applies_to_uri <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_cookie_domain_matches <phrase>()</phrase></entry></row> <row><entry><returnvalue>char</returnvalue> * </entry><entry>soup_cookie_to_cookie_header <phrase>()</phrase></entry></row> <row><entry><returnvalue>char</returnvalue> * </entry><entry>soup_cookie_to_set_cookie_header <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSList</returnvalue> * </entry><entry>soup_cookies_from_request <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSList</returnvalue> * </entry><entry>soup_cookies_from_response <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookies_to_request <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookies_to_response <phrase>()</phrase></entry></row> <row><entry><returnvalue>char</returnvalue> * </entry><entry>soup_cookies_to_cookie_header <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_cookies_free <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupCookie</entry></row> <row><entry>#define</entry><entry>SOUP_COOKIE_MAX_AGE_ONE_HOUR</entry></row> <row><entry>#define</entry><entry>SOUP_COOKIE_MAX_AGE_ONE_DAY</entry></row> <row><entry>#define</entry><entry>SOUP_COOKIE_MAX_AGE_ONE_WEEK</entry></row> <row><entry>#define</entry><entry>SOUP_COOKIE_MAX_AGE_ONE_YEAR</entry></row> <row><entry>enum</entry><entry>SoupSameSitePolicy</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GBoxed <phrase>╰──</phrase> SoupCookie </screen> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para><type>SoupCookie</type> implements HTTP cookies, as described by <ulink>RFC 6265</ulink>.</para> <para>To have a <type>SoupSession</type> handle cookies for your appliction automatically, use a <type>SoupCookieJar</type>.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_cookie_new ()</title> <programlisting><returnvalue>SoupCookie</returnvalue> * soup_cookie_new (<parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>, <parameter>const <type>char</type> *domain</parameter>, <parameter>const <type>char</type> *path</parameter>, <parameter><type>int</type> max_age</parameter>);</programlisting> <para>Creates a new <type>SoupCookie</type> with the given attributes. (Use <function>soup_cookie_set_secure()</function> and <function>soup_cookie_set_http_only()</function> if you need to set those attributes on the returned cookie.)</para> <para>If <parameter>domain</parameter> starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has <parameter>domain</parameter> as a suffix). Otherwise, it is a hostname and must match exactly.</para> <para><parameter>max_age</parameter> 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 <literal>SOUP_COOKIE_MAX_AGE_ONE_HOUR</literal>, <literal>SOUP_COOKIE_MAX_AGE_ONE_DAY</literal>, <literal>SOUP_COOKIE_MAX_AGE_ONE_WEEK</literal> and <literal>SOUP_COOKIE_MAX_AGE_ONE_YEAR</literal> (or multiples thereof) to calculate this value. (If you really care about setting the exact time that the cookie will expire, use <function>soup_cookie_set_expires()</function>.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>name</para></entry> <entry><para>cookie name</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>cookie value</para></entry> <entry></entry></row> <row><entry><para>domain</para></entry> <entry><para>cookie domain or hostname</para></entry> <entry></entry></row> <row><entry><para>path</para></entry> <entry><para>cookie path, or <literal>NULL</literal></para></entry> <entry></entry></row> <row><entry><para>max_age</para></entry> <entry><para>max age of the cookie, or -1 for a session cookie</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a new <type>SoupCookie</type>.</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_parse ()</title> <programlisting><returnvalue>SoupCookie</returnvalue> * soup_cookie_parse (<parameter>const <type>char</type> *header</parameter>, <parameter><type>GUri</type> *origin</parameter>);</programlisting> <para>Parses <parameter>header</parameter> and returns a <type>SoupCookie</type>. (If <parameter>header</parameter> contains multiple cookies, only the first one will be parsed.)</para> <para>If <parameter>header</parameter> does not have "path" or "domain" attributes, they will be defaulted from <parameter>origin</parameter> . If <parameter>origin</parameter> is <literal>NULL</literal>, path will default to "/", but domain will be left as <literal>NULL</literal>. Note that this is not a valid state for a <type>SoupCookie</type>, and you will need to fill in some appropriate string for the domain if you want to actually make use of the cookie.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a cookie string (eg, the value of a Set-Cookie header)</para></entry> <entry></entry></row> <row><entry><para>origin</para></entry> <entry><para>origin of the cookie, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a new <type>SoupCookie</type>, or <literal>NULL</literal> if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from <parameter>origin</parameter> . </para> <para><emphasis>[nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_copy ()</title> <programlisting><returnvalue>SoupCookie</returnvalue> * soup_cookie_copy (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Copies <parameter>cookie</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a copy of <parameter>cookie</parameter> </para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_free ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_free (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Frees <parameter>cookie</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_name ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_name (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter>const <type>char</type> *name</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's name to <parameter>name</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>the new name</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_name ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_cookie_get_name (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's name</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's name</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_value ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_value (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's value to <parameter>value</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>the new value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_value ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_cookie_get_value (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's value</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's value</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_domain ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_domain (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter>const <type>char</type> *domain</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's domain to <parameter>domain</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>domain</para></entry> <entry><para>the new domain</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_domain ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_cookie_get_domain (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's domain</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's domain</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_path ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_path (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter>const <type>char</type> *path</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's path to <parameter>path</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>path</para></entry> <entry><para>the new path</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_path ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_cookie_get_path (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's path</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's path</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_max_age ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_max_age (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>int</type> max_age</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's max age to <parameter>max_age</parameter> . If <parameter>max_age</parameter> 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 <literal>SOUP_COOKIE_MAX_AGE_ONE_HOUR</literal>, <literal>SOUP_COOKIE_MAX_AGE_ONE_DAY</literal>, <literal>SOUP_COOKIE_MAX_AGE_ONE_WEEK</literal> and <literal>SOUP_COOKIE_MAX_AGE_ONE_YEAR</literal> (or multiples thereof) to calculate this value. (A value of 0 indicates that the cookie should be considered already-expired.)</para> <para>(This sets the same property as <function>soup_cookie_set_expires()</function>.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>max_age</para></entry> <entry><para>the new max age</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_expires ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_expires (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>GDateTime</type> *expires</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's expiration time to <parameter>expires</parameter> . If <parameter>expires</parameter> is <literal>NULL</literal>, <parameter>cookie</parameter> will be a session cookie and will expire at the end of the client's session.</para> <para>(This sets the same property as <function>soup_cookie_set_max_age()</function>.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>expires</para></entry> <entry><para>the new expiration time, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_expires ()</title> <programlisting><returnvalue>GDateTime</returnvalue> * soup_cookie_get_expires (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's expiration time.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>GDateTime</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para><parameter>cookie</parameter> 's expiration time, which is owned by <parameter>cookie</parameter> and should not be modified or freed. </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_secure ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_secure (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>gboolean</type> secure</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's secure attribute to <parameter>secure</parameter> . If <literal>TRUE</literal>, <parameter>cookie</parameter> will only be transmitted from the client to the server over secure (https) connections.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>secure</para></entry> <entry><para>the new value for the secure attribute</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_secure ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_cookie_get_secure (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's secure attribute</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's secure attribute</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_http_only ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_http_only (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>gboolean</type> http_only</parameter>);</programlisting> <para>Sets <parameter>cookie</parameter> 's HttpOnly attribute to <parameter>http_only</parameter> . If <literal>TRUE</literal>, <parameter>cookie</parameter> will be marked as "http only", meaning it should not be exposed to web page scripts or other untrusted code.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>http_only</para></entry> <entry><para>the new value for the HttpOnly attribute</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_http_only ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_cookie_get_http_only (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Gets <parameter>cookie</parameter> 's HttpOnly attribute</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <parameter>cookie</parameter> 's HttpOnly attribute</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_set_same_site_policy ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookie_set_same_site_policy (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>SoupSameSitePolicy</type> policy</parameter>);</programlisting> <para>When used in conjunction with <function>soup_cookie_jar_get_cookie_list_with_same_site_info()</function> this sets the policy of when this cookie should be exposed.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>policy</para></entry> <entry><para>a <type>SoupSameSitePolicy</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookie_get_same_site_policy ()</title> <programlisting><returnvalue>SoupSameSitePolicy</returnvalue> soup_cookie_get_same_site_policy (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Returns the same-site policy for this cookie.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a <type>SoupSameSitePolicy</type></para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_applies_to_uri ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_cookie_applies_to_uri (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter><type>GUri</type> *uri</parameter>);</programlisting> <para>Tests if <parameter>cookie</parameter> should be sent to <parameter>uri</parameter> .</para> <para>(At the moment, this does not check that <parameter>cookie</parameter> 's domain matches <parameter>uri</parameter> , because it assumes that the caller has already done that. But don't rely on that; it may change in the future.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>uri</para></entry> <entry><para>a <type>GUri</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>cookie</parameter> should be sent to <parameter>uri</parameter> , <literal>FALSE</literal> if not</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_domain_matches ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_cookie_domain_matches (<parameter><type>SoupCookie</type> *cookie</parameter>, <parameter>const <type>char</type> *host</parameter>);</programlisting> <para>Checks if the <parameter>cookie</parameter> 's domain and <parameter>host</parameter> match in the sense that <parameter>cookie</parameter> should be sent when making a request to <parameter>host</parameter> , or that <parameter>cookie</parameter> should be accepted when receiving a response from <parameter>host</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> <row><entry><para>host</para></entry> <entry><para>a URI</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if the domains match, <literal>FALSE</literal> otherwise</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_to_cookie_header ()</title> <programlisting><returnvalue>char</returnvalue> * soup_cookie_to_cookie_header (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Serializes <parameter>cookie</parameter> in the format used by the Cookie header (ie, for returning a cookie from a <type>SoupSession</type> to a server).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the header</para> </refsect3></refsect2>
<refsect2> <title>soup_cookie_to_set_cookie_header ()</title> <programlisting><returnvalue>char</returnvalue> * soup_cookie_to_set_cookie_header (<parameter><type>SoupCookie</type> *cookie</parameter>);</programlisting> <para>Serializes <parameter>cookie</parameter> in the format used by the Set-Cookie header (ie, for sending a cookie from a <type>SoupServer</type> to a client).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookie</para></entry> <entry><para>a <type>SoupCookie</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the header</para> </refsect3></refsect2>
<refsect2> <title>soup_cookies_from_request ()</title> <programlisting><returnvalue>GSList</returnvalue> * soup_cookies_from_request (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Parses <parameter>msg</parameter> 's Cookie request header and returns a <type>GSList</type> of <type>SoupCookie</type>s. As the "Cookie" header, unlike "Set-Cookie", only contains cookie names and values, none of the other <type>SoupCookie</type> fields will be filled in. (Thus, you can't generally pass a cookie returned from this method directly to <function>soup_cookies_to_response()</function>.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type> containing a "Cookie" request header</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GSList</type> of <type>SoupCookie</type>s, which can be freed with <function>soup_cookies_free()</function>. </para> <para><emphasis>[element-type SoupCookie][transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_cookies_from_response ()</title> <programlisting><returnvalue>GSList</returnvalue> * soup_cookies_from_response (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Parses <parameter>msg</parameter> 's Set-Cookie response headers and returns a <type>GSList</type> of <type>SoupCookie</type>s. Cookies that do not specify "path" or "domain" attributes will have their values defaulted from <parameter>msg</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type> containing a "Set-Cookie" response header</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GSList</type> of <type>SoupCookie</type>s, which can be freed with <function>soup_cookies_free()</function>. </para> <para><emphasis>[element-type SoupCookie][transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_cookies_to_request ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookies_to_request (<parameter><type>GSList</type> *cookies</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Adds the name and value of each cookie in <parameter>cookies</parameter> to <parameter>msg</parameter> 's "Cookie" request. (If <parameter>msg</parameter> 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.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookies</para></entry> <entry><para>a <type>GSList</type> of <type>SoupCookie</type>. </para></entry> <entry><emphasis>[element-type SoupCookie]</emphasis></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookies_to_response ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookies_to_response (<parameter><type>GSList</type> *cookies</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Appends a "Set-Cookie" response header to <parameter>msg</parameter> for each cookie in <parameter>cookies</parameter> . (This is in addition to any other "Set-Cookie" headers <parameter>msg</parameter> may already have.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookies</para></entry> <entry><para>a <type>GSList</type> of <type>SoupCookie</type>. </para></entry> <entry><emphasis>[element-type SoupCookie]</emphasis></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_cookies_to_cookie_header ()</title> <programlisting><returnvalue>char</returnvalue> * soup_cookies_to_cookie_header (<parameter><type>GSList</type> *cookies</parameter>);</programlisting> <para>Serializes a <type>GSList</type> of <type>SoupCookie</type> into a string suitable for setting as the value of the "Cookie" header.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookies</para></entry> <entry><para>a <type>GSList</type> of <type>SoupCookie</type>. </para></entry> <entry><emphasis>[element-type SoupCookie]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the serialization of <parameter>cookies</parameter> </para> </refsect3></refsect2>
<refsect2> <title>soup_cookies_free ()</title> <programlisting><returnvalue>void</returnvalue> soup_cookies_free (<parameter><type>GSList</type> *cookies</parameter>);</programlisting> <para>Frees <parameter>cookies</parameter> .</para> <para><emphasis>[skip]</emphasis></para><refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>cookies</para></entry> <entry><para>a <type>GSList</type> of <type>SoupCookie</type>. </para></entry> <entry><emphasis>[element-type SoupCookie]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupCookie</title> <programlisting>typedef struct _SoupCookie SoupCookie;</programlisting> <para>An HTTP cookie.</para> <para><parameter>name</parameter> and <parameter>value</parameter> will be set for all cookies. If the cookie is generated from a string that appears to have no name, then <parameter>name</parameter> will be the empty string.</para> <para><parameter>domain</parameter> and <parameter>path</parameter> give the host or domain, and path within that host/domain, to restrict this cookie to. If <parameter>domain</parameter> starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has <parameter>domain</parameter> as a suffix). Otherwise, it is a hostname and must match exactly.</para> <para><parameter>expires</parameter> will be non-<literal>NULL</literal> if the cookie uses either the original "expires" attribute, or the newer "max-age" attribute. If <parameter>expires</parameter> is <literal>NULL</literal>, it indicates that neither "expires" nor "max-age" was specified, and the cookie expires at the end of the session.</para> <para>If <parameter>http_only</parameter> 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.</para> </refsect2>
<refsect2> <title>SOUP_COOKIE_MAX_AGE_ONE_HOUR</title> <programlisting>#define SOUP_COOKIE_MAX_AGE_ONE_HOUR (60 * 60) </programlisting> <para>A constant corresponding to 1 hour, for use with <function>soup_cookie_new()</function> and <function>soup_cookie_set_max_age()</function>.</para> </refsect2>
<refsect2> <title>SOUP_COOKIE_MAX_AGE_ONE_DAY</title> <programlisting>#define SOUP_COOKIE_MAX_AGE_ONE_DAY (SOUP_COOKIE_MAX_AGE_ONE_HOUR * 24) </programlisting> <para>A constant corresponding to 1 day, for use with <function>soup_cookie_new()</function> and <function>soup_cookie_set_max_age()</function>.</para> </refsect2>
<refsect2> <title>SOUP_COOKIE_MAX_AGE_ONE_WEEK</title> <programlisting>#define SOUP_COOKIE_MAX_AGE_ONE_WEEK (SOUP_COOKIE_MAX_AGE_ONE_DAY * 7) </programlisting> <para>A constant corresponding to 1 week, for use with <function>soup_cookie_new()</function> and <function>soup_cookie_set_max_age()</function>.</para> </refsect2>
<refsect2> <title>SOUP_COOKIE_MAX_AGE_ONE_YEAR</title> <programlisting>#define SOUP_COOKIE_MAX_AGE_ONE_YEAR (SOUP_COOKIE_MAX_AGE_ONE_DAY * 365.2422) </programlisting> <para>A constant corresponding to 1 year, for use with <function>soup_cookie_new()</function> and <function>soup_cookie_set_max_age()</function>.</para> </refsect2>
<refsect2> <title>enum SoupSameSitePolicy</title> <para>Represents the same-site policies of a cookie.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_SAME_SITE_POLICY_NONE</para></entry> <entry><para>The cookie is exposed with both cross-site and same-site requests</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SAME_SITE_POLICY_LAX</para></entry> <entry><para>The cookie is withheld on cross-site requests but exposed on cross-site navigations</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SAME_SITE_POLICY_STRICT</para></entry> <entry><para>The cookie is only exposed for same-site requests</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>See Also</title> <para><type>SoupMessage</type>, <type>SoupCookieJar</type></para> </refsect1> </refentry>
<refentry> <refmeta> <refentrytitle>SoupMessage</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupMessage</refentrytitle>

<refname>SoupMessage</refname> <refpurpose>An HTTP request and response.</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_message_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_message_new_from_uri <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_message_new_from_encoded_form <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_message_new_from_multipart <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_request_body <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_request_body_from_bytes <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_message_new_options_ping <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_get_is_options_ping <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_is_options_ping <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupHTTPVersion</returnvalue> </entry><entry>soup_message_get_http_version <phrase>()</phrase></entry></row> <row><entry><returnvalue>GUri</returnvalue> * </entry><entry>soup_message_get_uri <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_uri <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_get_method <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_method <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupStatus</returnvalue> </entry><entry>soup_message_get_status <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_get_reason_phrase <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageHeaders</returnvalue> * </entry><entry>soup_message_get_request_headers <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageHeaders</returnvalue> * </entry><entry>soup_message_get_response_headers <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_is_keepalive <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint64</returnvalue> </entry><entry>soup_message_get_connection_id <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSocketAddress</returnvalue> * </entry><entry>soup_message_get_remote_address <phrase>()</phrase></entry></row> <row><entry><returnvalue>GTlsCertificate</returnvalue> * </entry><entry>soup_message_get_tls_peer_certificate <phrase>()</phrase></entry></row> <row><entry><returnvalue>GTlsCertificateFlags</returnvalue> </entry><entry>soup_message_get_tls_peer_certificate_errors <phrase>()</phrase></entry></row> <row><entry><returnvalue>GTlsProtocolVersion</returnvalue> </entry><entry>soup_message_get_tls_protocol_version <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_get_tls_ciphersuite_name <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_tls_client_certificate <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_tls_client_certificate_password_request_complete <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_first_party <phrase>()</phrase></entry></row> <row><entry><returnvalue>GUri</returnvalue> * </entry><entry>soup_message_get_first_party <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_message_add_header_handler <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_message_add_status_code_handler <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_flags <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageFlags</returnvalue> </entry><entry>soup_message_get_flags <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_add_flags <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_remove_flags <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_query_flags <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_disable_feature <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_is_feature_disabled <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessagePriority</returnvalue> </entry><entry>soup_message_get_priority <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_priority <phrase>()</phrase></entry></row> <row><entry><returnvalue>GUri</returnvalue> * </entry><entry>soup_message_get_site_for_cookies <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_site_for_cookies <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_get_is_top_level_navigation <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_set_is_top_level_navigation <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageMetrics</returnvalue> * </entry><entry>soup_message_get_metrics <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Properties</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><type>GUri</type> *</entry><entry>first-party</entry><entry>Read / Write</entry></row> <row><entry><type>SoupMessageFlags</type></entry><entry>flags</entry><entry>Read / Write</entry></row> <row><entry><type>SoupHTTPVersion</type></entry><entry>http-version</entry><entry>Read</entry></row> <row><entry><type>gboolean</type></entry><entry>is-options-ping</entry><entry>Read / Write</entry></row> <row><entry><type>gboolean</type></entry><entry>is-top-level-navigation</entry><entry>Read / Write</entry></row> <row><entry><type>char</type> *</entry><entry>method</entry><entry>Read / Write</entry></row> <row><entry><type>SoupMessagePriority</type></entry><entry>priority</entry><entry>Read / Write</entry></row> <row><entry><type>char</type> *</entry><entry>reason-phrase</entry><entry>Read</entry></row> <row><entry><type>GSocketAddress</type> *</entry><entry>remote-address</entry><entry>Read</entry></row> <row><entry><type>SoupMessageHeaders</type> *</entry><entry>request-headers</entry><entry>Read</entry></row> <row><entry><type>SoupMessageHeaders</type> *</entry><entry>response-headers</entry><entry>Read</entry></row> <row><entry><type>GUri</type> *</entry><entry>site-for-cookies</entry><entry>Read / Write</entry></row> <row><entry><type>guint</type></entry><entry>status-code</entry><entry>Read</entry></row> <row><entry><type>char</type> *</entry><entry>tls-ciphersuite-name</entry><entry>Read</entry></row> <row><entry><type>GTlsCertificate</type> *</entry><entry>tls-peer-certificate</entry><entry>Read</entry></row> <row><entry><type>GTlsCertificateFlags</type></entry><entry>tls-peer-certificate-errors</entry><entry>Read</entry></row> <row><entry><type>GTlsProtocolVersion</type></entry><entry>tls-protocol-version</entry><entry>Read</entry></row> <row><entry><type>GUri</type> *</entry><entry>uri</entry><entry>Read / Write</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Signals</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>gboolean</returnvalue></entry><entry>accept-certificate</entry><entry>Run Last</entry></row> <row><entry><returnvalue>gboolean</returnvalue></entry><entry>authenticate</entry><entry>Run Last</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>content-sniffed</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>finished</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>got-body</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>got-headers</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>got-informational</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>hsts-enforced</entry><entry>Run Last</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>network-event</entry><entry>Run First</entry></row> <row><entry><returnvalue>gboolean</returnvalue></entry><entry>request-certificate</entry><entry>Run Last</entry></row> <row><entry><returnvalue>gboolean</returnvalue></entry><entry>request-certificate-password</entry><entry>Run Last</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>restarted</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>starting</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>wrote-body</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>wrote-body-data</entry><entry>Run First</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>wrote-headers</entry><entry>Run First</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupMessage</entry></row> <row><entry>enum</entry><entry>SoupHTTPVersion</entry></row> <row><entry>enum</entry><entry>SoupMessageFlags</entry></row> <row><entry>enum</entry><entry>SoupMessagePriority</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GObject <phrase>╰──</phrase> SoupMessage </screen> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>A <type>SoupMessage</type> represents an HTTP message that is being sent or received.</para> <para>You would create a <type>SoupMessage</type> with <function>soup_message_new()</function> or <function>soup_message_new_from_uri()</function>, set up its fields appropriately, and send it.</para> <para>Note that libsoup's terminology here does not quite match the HTTP specification: in RFC 2616, an "HTTP-message" is <emphasis>either</emphasis> a Request, <emphasis>or</emphasis> a Response. In libsoup, a <type>SoupMessage</type> combines both the request and the response.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_message_new ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_message_new (<parameter>const <type>char</type> *method</parameter>, <parameter>const <type>char</type> *uri_string</parameter>);</programlisting> <para>Creates a new empty <type>SoupMessage</type>, which will connect to <parameter>uri</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>method</para></entry> <entry><para>the HTTP method for the created request</para></entry> <entry></entry></row> <row><entry><para>uri_string</para></entry> <entry><para>the destination endpoint (as a string)</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the new <type>SoupMessage</type> (or <literal>NULL</literal> if <parameter>uri</parameter> could not be parsed). </para> <para><emphasis>[transfer full][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_new_from_uri ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_message_new_from_uri (<parameter>const <type>char</type> *method</parameter>, <parameter><type>GUri</type> *uri</parameter>);</programlisting> <para>Creates a new empty <type>SoupMessage</type>, which will connect to <parameter>uri</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>method</para></entry> <entry><para>the HTTP method for the created request</para></entry> <entry></entry></row> <row><entry><para>uri</para></entry> <entry><para>the destination endpoint (as a <type>GUri</type>)</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the new <type>SoupMessage</type>. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_new_from_encoded_form ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_message_new_from_encoded_form (<parameter>const <type>char</type> *method</parameter>, <parameter>const <type>char</type> *uri_string</parameter>, <parameter><type>char</type> *encoded_form</parameter>);</programlisting> <para>Creates a new <type>SoupMessage</type> and sets it up to send the given <parameter>encoded_form</parameter> to <parameter>uri</parameter> via <parameter>method</parameter> . If <parameter>method</parameter> is "GET", it will include the form data into <parameter>uri</parameter> 's query field, and if <parameter>method</parameter> is "POST" or "PUT", it will be set as request body. This function takes the ownership of <parameter>encoded_form</parameter> , that will be released with <function>g_free()</function> when no longer in use. See also <function>soup_form_encode()</function>, <function>soup_form_encode_hash()</function> and <function>soup_form_encode_datalist()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>method</para></entry> <entry><para>the HTTP method for the created request (GET, POST or PUT)</para></entry> <entry></entry></row> <row><entry><para>uri_string</para></entry> <entry><para>the destination endpoint (as a string)</para></entry> <entry></entry></row> <row><entry><para>encoded_form</para></entry> <entry><para>a encoded form. </para></entry> <entry><emphasis>[transfer full]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the new <type>SoupMessage</type>, or <literal>NULL</literal> if <parameter>uri_string</parameter> could not be parsed or <parameter>method</parameter> is not "GET, "POST" or "PUT". </para> <para><emphasis>[transfer full][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_new_from_multipart ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_message_new_from_multipart (<parameter>const <type>char</type> *uri_string</parameter>, <parameter><type>SoupMultipart</type> *multipart</parameter>);</programlisting> <para>Creates a new <type>SoupMessage</type> and sets it up to send <parameter>multipart</parameter> to <parameter>uri_string</parameter> via POST.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>uri_string</para></entry> <entry><para>the destination endpoint (as a string)</para></entry> <entry></entry></row> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the new <type>SoupMessage</type>, or <literal>NULL</literal> if <parameter>uri_string</parameter> could not be parsed. </para> <para><emphasis>[transfer full][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_request_body ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_request_body (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *content_type</parameter>, <parameter><type>GInputStream</type> *stream</parameter>, <parameter><type>gssize</type> content_length</parameter>);</programlisting> <para>Set the request body of a <type>SoupMessage</type>. If <parameter>content_type</parameter> is <literal>NULL</literal> and <parameter>stream</parameter> is not <literal>NULL</literal> the Content-Type header will not be changed if present. The request body needs to be set again in case <parameter>msg</parameter> is restarted (in case of redirection or authentication).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>content_type</para></entry> <entry><para>MIME Content-Type of the body, or <literal>NULL</literal> if unknown. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>stream</para></entry> <entry><para>a <type>GInputStream</type> to read the request body from. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>content_length</para></entry> <entry><para>the byte length of <parameter>stream</parameter> or -1 if unknown</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_set_request_body_from_bytes ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_request_body_from_bytes (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *content_type</parameter>, <parameter><type>GBytes</type> *bytes</parameter>);</programlisting> <para>Set the request body of a <type>SoupMessage</type> from <type>GBytes</type>. If <parameter>content_type</parameter> is <literal>NULL</literal> and <parameter>bytes</parameter> is not <literal>NULL</literal> the Content-Type header will not be changed if present. The request body needs to be set again in case <parameter>msg</parameter> is restarted (in case of redirection or authentication).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>content_type</para></entry> <entry><para>MIME Content-Type of the body, or <literal>NULL</literal> if unknown. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>bytes</para></entry> <entry><para>a <type>GBytes</type> with the request body data. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_new_options_ping ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_message_new_options_ping (<parameter><type>GUri</type> *base_uri</parameter>);</programlisting> <para>Creates a new <type>SoupMessage</type> to send <literal>OPTIONS *</literal> to a server. The path of <parameter>base_uri</parameter> will be ignored.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>base_uri</para></entry> <entry><para>the destination endpoint (as a <type>GUri</type>)</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the new <type>SoupMessage</type>. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_is_options_ping ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_get_is_options_ping (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets whether <parameter>msg</parameter> is intended to be used to send <literal>OPTIONS *</literal> to a server.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if the message is options ping, or <literal>FALSE</literal> otherwise</para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_is_options_ping ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_is_options_ping (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>gboolean</type> is_options_ping</parameter>);</programlisting> <para>Set whether <parameter>msg</parameter> is intended to be used to send <literal>OPTIONS *</literal> to a server. When set to <literal>TRUE</literal>, the path of <type>“uri”</type> will be ignored and <type>“method”</type> set to <literal>SOUP_METHOD_OPTIONS</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>is_options_ping</para></entry> <entry><para>the value to set</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_http_version ()</title> <programlisting><returnvalue>SoupHTTPVersion</returnvalue> soup_message_get_http_version (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the HTTP version of <parameter>msg</parameter> . This is the minimum of the version from the request and the version from the response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the HTTP version</para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_uri ()</title> <programlisting><returnvalue>GUri</returnvalue> * soup_message_get_uri (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets <parameter>msg</parameter> 's URI</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the URI <parameter>msg</parameter> is targeted for. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_uri ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_uri (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GUri</type> *uri</parameter>);</programlisting> <para>Sets <parameter>msg</parameter> 's URI to <parameter>uri</parameter> . If <parameter>msg</parameter> has already been sent and you want to re-send it with the new URI, you need to send it again.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>uri</para></entry> <entry><para>the new <type>GUri</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_method ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_get_method (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns the method of this message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> A method such as <literal>SOUP_METHOD_GET</literal></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_method ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_method (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *method</parameter>);</programlisting> <para>Set <parameter>msg</parameter> 's HTTP method to <parameter>method</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>method</para></entry> <entry><para>the value to set</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_status ()</title> <programlisting><returnvalue>SoupStatus</returnvalue> soup_message_get_status (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns the set status of this message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> The <type>SoupStatus</type></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_reason_phrase ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_get_reason_phrase (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns the reason phrase for the status of this message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> Phrase or <literal>NULL</literal></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_request_headers ()</title> <programlisting><returnvalue>SoupMessageHeaders</returnvalue> * soup_message_get_request_headers (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns the headers sent with the request.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>The <type>SoupMessageHeaders</type>. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_response_headers ()</title> <programlisting><returnvalue>SoupMessageHeaders</returnvalue> * soup_message_get_response_headers (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns the headers recieved with the response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>The <type>SoupMessageHeaders</type>. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_is_keepalive ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_is_keepalive (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Determines whether or not <parameter>msg</parameter> 's connection can be kept alive for further requests after processing <parameter>msg</parameter> , based on the HTTP version, Connection header, etc.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal>.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_connection_id ()</title> <programlisting><returnvalue>guint64</returnvalue> soup_message_get_connection_id (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> An id or 0 if no connection.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_remote_address ()</title> <programlisting><returnvalue>GSocketAddress</returnvalue> * soup_message_get_remote_address (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Get the remote <type>GSocketAddress</type> of the connection associated with the message. The returned address can be <literal>NULL</literal> 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 <type>GProxyAddress</type>. If <type>“remote-connetable”</type> is set the returned address id for the connection ot the session's remote connectable.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GSocketAddress</type> or <literal>NULL</literal> if the connection hasn't been established. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_tls_peer_certificate ()</title> <programlisting><returnvalue>GTlsCertificate</returnvalue> * soup_message_get_tls_peer_certificate (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the peer's <type>GTlsCertificate</type> associated with <parameter>msg</parameter> 's connection. Note that this is not set yet during the emission of SoupMessage::accept-certificate signal.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para><parameter>msg</parameter> 's TLS peer certificate, or <literal>NULL</literal> if <parameter>msg</parameter> 's connection is not SSL. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_tls_peer_certificate_errors ()</title> <programlisting><returnvalue>GTlsCertificateFlags</returnvalue> soup_message_get_tls_peer_certificate_errors (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the errors associated with validating <parameter>msg</parameter> 's TLS peer certificate. Note that this is not set yet during the emission of SoupMessage::accept-certificate signal.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a <type>GTlsCertificateFlags</type> with <parameter>msg</parameter> 's TLS peer certificate errors.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_tls_protocol_version ()</title> <programlisting><returnvalue>GTlsProtocolVersion</returnvalue> soup_message_get_tls_protocol_version (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the TLS protocol version negotiated for <parameter>msg</parameter> 's connection. If the message connection is not SSL, <literal>G_TLS_PROTOCOL_VERSION_UNKNOWN</literal> is returned.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a <type>GTlsProtocolVersion</type></para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_tls_ciphersuite_name ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_get_tls_ciphersuite_name (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the name of the TLS ciphersuite negotiated for <parameter>msg</parameter> 's connection.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the name of the TLS ciphersuite, or <literal>NULL</literal> if <parameter>msg</parameter> 's connection is not SSL. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_tls_client_certificate ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_tls_client_certificate (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GTlsCertificate</type> *certificate</parameter>);</programlisting> <para>Sets the <parameter>certificate</parameter> to be used by <parameter>msg</parameter> 's connection when a client certificate is requested during the TLS handshake. You can call this as a response to <type>“request-certificate”</type> signal, or before the connection is started. If <parameter>certificate</parameter> is <literal>NULL</literal> the handshake will continue without providing a GTlsCertificate. Note that the <type>GTlsCertificate</type> set by this function will be ignored if <type>“tls-interaction”</type> is not <literal>NULL</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>certificate</para></entry> <entry><para>the <type>GTlsCertificate</type> to set, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_tls_client_certificate_password_request_complete ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_tls_client_certificate_password_request_complete (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Completes a certificate password request.</para> <para>You must call this as a response to <type>“request-certificate-password”</type> signal, to notify <parameter>msg</parameter> that the <type>GTlsPassword</type> has already been updated.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_set_first_party ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_first_party (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GUri</type> *first_party</parameter>);</programlisting> <para>Sets <parameter>first_party</parameter> as the main document <type>GUri</type> for <parameter>msg</parameter> . For details of when and how this is used refer to the documentation for <type>SoupCookieJarAcceptPolicy</type>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>first_party</para></entry> <entry><para>the <type>GUri</type> for the <parameter>msg</parameter> 's first party</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_first_party ()</title> <programlisting><returnvalue>GUri</returnvalue> * soup_message_get_first_party (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets <parameter>msg</parameter> 's first-party <type>GUri</type></para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the <parameter>msg</parameter> 's first party <type>GUri</type>. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_add_header_handler ()</title> <programlisting><returnvalue>guint</returnvalue> soup_message_add_header_handler (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *signal</parameter>, <parameter>const <type>char</type> *header</parameter>, <parameter><type>GCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Adds a signal handler to <parameter>msg</parameter> for <parameter>signal</parameter> , as with <function>g_signal_connect()</function>, but the <parameter>callback</parameter> will only be run if <parameter>msg</parameter> 's incoming messages headers (that is, the <literal>request_headers</literal>) contain a header named <parameter>header</parameter> .</para> <para><emphasis>[skip]</emphasis></para><refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>signal</para></entry> <entry><para>signal to connect the handler to.</para></entry> <entry></entry></row> <row><entry><para>header</para></entry> <entry><para>HTTP response header to match against</para></entry> <entry></entry></row> <row><entry><para>callback</para></entry> <entry><para>the header handler</para></entry> <entry></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data to pass to <parameter>handler_cb</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the handler ID from <function>g_signal_connect()</function></para> </refsect3></refsect2>
<refsect2> <title>soup_message_add_status_code_handler ()</title> <programlisting><returnvalue>guint</returnvalue> soup_message_add_status_code_handler (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *signal</parameter>, <parameter><type>guint</type> status_code</parameter>, <parameter><type>GCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Adds a signal handler to <parameter>msg</parameter> for <parameter>signal</parameter> , as with <function>g_signal_connect()</function>, but the <parameter>callback</parameter> will only be run if <parameter>msg</parameter> has the status <parameter>status_code</parameter> .</para> <para><parameter>signal</parameter> must be a signal that will be emitted after <parameter>msg</parameter> 's status is set (this means it can't be a "wrote" signal).</para> <para><emphasis>[skip]</emphasis></para><refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>signal</para></entry> <entry><para>signal to connect the handler to.</para></entry> <entry></entry></row> <row><entry><para>status_code</para></entry> <entry><para>status code to match against</para></entry> <entry></entry></row> <row><entry><para>callback</para></entry> <entry><para>the header handler</para></entry> <entry></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data to pass to <parameter>handler_cb</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the handler ID from <function>g_signal_connect()</function></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_flags ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_flags (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>SoupMessageFlags</type> flags</parameter>);</programlisting> <para>Sets the specified flags on <parameter>msg</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>flags</para></entry> <entry><para>a set of <type>SoupMessageFlags</type> values</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_flags ()</title> <programlisting><returnvalue>SoupMessageFlags</returnvalue> soup_message_get_flags (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the flags on <parameter>msg</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the flags</para> </refsect3></refsect2>
<refsect2> <title>soup_message_add_flags ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_add_flags (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>SoupMessageFlags</type> flags</parameter>);</programlisting> <para>Adds <parameter>flags</parameter> to the set of <parameter>msg</parameter> 's flags</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>flags</para></entry> <entry><para>a set of <type>SoupMessageFlags</type> values</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_remove_flags ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_remove_flags (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>SoupMessageFlags</type> flags</parameter>);</programlisting> <para>Removes <parameter>flags</parameter> from the set of <parameter>msg</parameter> 's flags</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>flags</para></entry> <entry><para>a set of <type>SoupMessageFlags</type> values</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_query_flags ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_query_flags (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>SoupMessageFlags</type> flags</parameter>);</programlisting> <para>Queries if <parameter>flags</parameter> are present in the set of <parameter>msg</parameter> 's flags</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>flags</para></entry> <entry><para>a set of <type>SoupMessageFlags</type> values</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>flags</parameter> are enabled in <parameter>msg</parameter> </para> </refsect3></refsect2>
<refsect2> <title>soup_message_disable_feature ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_disable_feature (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>This disables the actions of <type>SoupSessionFeature</type>s with the given <parameter>feature_type</parameter> (or a subclass of that type) on <parameter>msg</parameter> , so that <parameter>msg</parameter> is processed as though the feature(s) hadn't been added to the session. Eg, passing <type>SOUP_TYPE_CONTENT_SNIFFER</type> for <parameter>feature_type</parameter> will disable Content-Type sniffing on the message.</para> <para>You must call this before queueing <parameter>msg</parameter> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>the <type>GType</type> of a <type>SoupSessionFeature</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_is_feature_disabled ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_is_feature_disabled (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>Get whether <type>SoupSessionFeature</type>s of the given <parameter>feature_type</parameter> (or a subclass of that type) are disabled on <parameter>msg</parameter> . See <function>soup_message_disable_feature()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>the <type>GType</type> of a <type>SoupSessionFeature</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if feature is disabled, or <literal>FALSE</literal> otherwise.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_get_priority ()</title> <programlisting><returnvalue>SoupMessagePriority</returnvalue> soup_message_get_priority (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Retrieves the <type>SoupMessagePriority</type>. If not set this value defaults to <type>SOUP_MESSAGE_PRIORITY_NORMAL</type>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the priority of the message.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_priority ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_priority (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>SoupMessagePriority</type> priority</parameter>);</programlisting> <para>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.</para> <para>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).</para> <para>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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>priority</para></entry> <entry><para>the <type>SoupMessagePriority</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_site_for_cookies ()</title> <programlisting><returnvalue>GUri</returnvalue> * soup_message_get_site_for_cookies (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets <parameter>msg</parameter> 's site for cookies <type>GUri</type></para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the <parameter>msg</parameter> 's site for cookies <type>GUri</type>. </para> <para><emphasis>[transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_set_site_for_cookies ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_site_for_cookies (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GUri</type> *site_for_cookies</parameter>);</programlisting> <para>Sets <parameter>site_for_cookies</parameter> as the policy URL for same-site cookies for <parameter>msg</parameter> .</para> <para>It is either the URL of the top-level document or <literal>NULL</literal> 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.</para> <para>See the <ulink>same-site spec</ulink> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>site_for_cookies</para></entry> <entry><para>the <type>GUri</type> for the <parameter>msg</parameter> 's site for cookies. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_is_top_level_navigation ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_get_is_top_level_navigation (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Returns if this message is set as a top level navigation. Used for same-site policy checks.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_set_is_top_level_navigation ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_set_is_top_level_navigation (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>gboolean</type> is_top_level_navigation</parameter>);</programlisting> <para>See the <ulink>same-site spec</ulink> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>is_top_level_navigation</para></entry> <entry><para>if <literal>TRUE</literal> indicate the current request is a top-level navigation</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_get_metrics ()</title> <programlisting><returnvalue>SoupMessageMetrics</returnvalue> * soup_message_get_metrics (<parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Get the <type>SoupMessageMetrics</type> of <parameter>msg</parameter> . If the flag <literal>SOUP_MESSAGE_COLLECT_METRICS</literal> is not enabled for <parameter>msg</parameter> this will return <literal>NULL</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>The <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>SoupMessageMetrics</type>, or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupMessage</title> <programlisting>typedef struct _SoupMessage SoupMessage;</programlisting> <para>Represents an HTTP message being sent or received.</para> <para><parameter>status_code</parameter> will normally be a <type>SoupStatus</type> value, eg, <literal>SOUP_STATUS_OK</literal>, though of course it might actually be an unknown status code. <parameter>reason_phrase</parameter> is the actual text returned from the server, which may or may not correspond to the "standard" description of <parameter>status_code</parameter> . 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 <parameter>reason_phrase</parameter> in user-visible messages. Rather, you should look at <parameter>status_code</parameter> , and determine an end-user-appropriate message based on that and on what you were trying to do.</para> </refsect2>
<refsect2> <title>enum SoupHTTPVersion</title> <para>Indicates the HTTP protocol version being used.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_HTTP_1_0</para></entry> <entry><para>HTTP 1.0 (RFC 1945)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_HTTP_1_1</para></entry> <entry><para>HTTP 1.1 (RFC 2616)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_HTTP_2_0</para></entry> <entry><para>HTTP 2.0 (RFC 7540)</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>enum SoupMessageFlags</title> <para>Various flags that can be set on a <type>SoupMessage</type> to alter its behavior.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_MESSAGE_NO_REDIRECT</para></entry> <entry><para>The session should not follow redirect (3xx) responses received by this message.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_NEW_CONNECTION</para></entry> <entry><para>Requests that the message should be sent on a newly-created connection, not reusing an existing persistent connection. Note that messages with non-idempotent <type>“method”</type>s behave this way by default, unless <type>SOUP_MESSAGE_IDEMPOTENT</type> is set.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_IDEMPOTENT</para></entry> <entry><para>The message is considered idempotent, regardless its <type>“method”</type>, and allows reuse of existing idle connections, instead of always requiring a new one, unless <type>SOUP_MESSAGE_NEW_CONNECTION</type> is set.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE</para></entry> <entry><para>The <type>SoupAuthManager</type> 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 <type>“authenticate”</type> signal will be emitted, if you want to disable authentication for a message use <function>soup_message_disable_feature()</function> passing <type>SOUP_TYPE_AUTH_MANAGER</type> instead.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_COLLECT_METRICS</para></entry> <entry><para>Metrics will be collected for this message.</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>enum SoupMessagePriority</title> <para>Priorities that can be set on a <type>SoupMessage</type> to instruct the message queue to process it before any other message with lower priority.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_MESSAGE_PRIORITY_VERY_LOW</para></entry> <entry><para>The lowest priority, the messages with this priority will be the last ones to be attended.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_PRIORITY_LOW</para></entry> <entry><para>Use this for low priority messages, a <type>SoupMessage</type> with the default priority will be processed first.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_PRIORITY_NORMAL</para></entry> <entry><para>The default priotity, this is the priority assigned to the <type>SoupMessage</type> by default.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_PRIORITY_HIGH</para></entry> <entry><para>High priority, a <type>SoupMessage</type> with this priority will be processed before the ones with the default priority.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_PRIORITY_VERY_HIGH</para></entry> <entry><para>The highest priority, use this for very urgent <type>SoupMessage</type> as they will be the first ones to be attended.</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>Property Details</title> <refsect2><title>The <literal>“first-party”</literal> property</title> <programlisting> “first-party” <type>GUri</type> *</programlisting> <para>The <type>GUri</type> loaded in the application when the message was queued.</para> <para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“flags”</literal> property</title> <programlisting> “flags” <type>SoupMessageFlags</type></programlisting> <para>Various message options.</para><para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“http-version”</literal> property</title> <programlisting> “http-version” <type>SoupHTTPVersion</type></programlisting> <para>The HTTP protocol version to use.</para><para>Owner: SoupMessage</para> <para>Flags: Read</para> <para>Default value: SOUP_HTTP_1_1</para> </refsect2>
<refsect2><title>The <literal>“is-options-ping”</literal> property</title> <programlisting> “is-options-ping” <type>gboolean</type></programlisting> <para>The <type>SoupMessage</type> is intended to be used to send <literal>OPTIONS *</literal> to a server. When set to <literal>TRUE</literal>, the path of <type>“uri”</type> will be ignored and <type>“method”</type> set to <literal>SOUP_METHOD_OPTIONS</literal>.</para> <para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> <para>Default value: FALSE</para> </refsect2>
<refsect2><title>The <literal>“is-top-level-navigation”</literal> property</title> <programlisting> “is-top-level-navigation” <type>gboolean</type></programlisting> <para>Set when the message is navigating between top level domains.</para> <para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> <para>Default value: FALSE</para> </refsect2>
<refsect2><title>The <literal>“method”</literal> property</title> <programlisting> “method” <type>char</type> *</programlisting> <para>The message's HTTP method.</para><para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> <para>Default value: "GET"</para> </refsect2>
<refsect2><title>The <literal>“priority”</literal> property</title> <programlisting> “priority” <type>SoupMessagePriority</type></programlisting> <para>Sets the priority of the <type>SoupMessage</type>. See <function>soup_message_set_priority()</function> for further details.</para> <para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> <para>Default value: SOUP_MESSAGE_PRIORITY_NORMAL</para> </refsect2>
<refsect2><title>The <literal>“reason-phrase”</literal> property</title> <programlisting> “reason-phrase” <type>char</type> *</programlisting> <para>The HTTP response reason phrase.</para><para>Owner: SoupMessage</para> <para>Flags: Read</para> <para>Default value: NULL</para> </refsect2>
<refsect2><title>The <literal>“remote-address”</literal> property</title> <programlisting> “remote-address” <type>GSocketAddress</type> *</programlisting> <para>The remote <type>GSocketAddress</type> of the connection associated with the message</para> <para>Owner: SoupMessage</para> <para>Flags: Read</para> </refsect2>
<refsect2><title>The <literal>“request-headers”</literal> property</title> <programlisting> “request-headers” <type>SoupMessageHeaders</type> *</programlisting> <para>The HTTP request headers.</para><para>Owner: SoupMessage</para> <para>Flags: Read</para> </refsect2>
<refsect2><title>The <literal>“response-headers”</literal> property</title> <programlisting> “response-headers” <type>SoupMessageHeaders</type> *</programlisting> <para>The HTTP response headers.</para><para>Owner: SoupMessage</para> <para>Flags: Read</para> </refsect2>
<refsect2><title>The <literal>“site-for-cookies”</literal> property</title> <programlisting> “site-for-cookies” <type>GUri</type> *</programlisting> <para>The URI for the site to compare cookies against.</para><para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“status-code”</literal> property</title> <programlisting> “status-code” <type>guint</type></programlisting> <para>The HTTP response status code.</para><para>Owner: SoupMessage</para> <para>Flags: Read</para> <para>Allowed values: <= 999</para> <para>Default value: 0</para> </refsect2>
<refsect2><title>The <literal>“tls-ciphersuite-name”</literal> property</title> <programlisting> “tls-ciphersuite-name” <type>char</type> *</programlisting> <para>The Name of TLS ciphersuite negotiated for this message connection.</para> <para>Owner: SoupMessage</para> <para>Flags: Read</para> <para>Default value: NULL</para> </refsect2>
<refsect2><title>The <literal>“tls-peer-certificate”</literal> property</title> <programlisting> “tls-peer-certificate” <type>GTlsCertificate</type> *</programlisting> <para>The peer's <type>GTlsCertificate</type> associated with the message</para> <para>Owner: SoupMessage</para> <para>Flags: Read</para> </refsect2>
<refsect2><title>The <literal>“tls-peer-certificate-errors”</literal> property</title> <programlisting> “tls-peer-certificate-errors” <type>GTlsCertificateFlags</type></programlisting> <para>The verification errors on <type>“tls-peer-certificate”</type></para> <para>Owner: SoupMessage</para> <para>Flags: Read</para> </refsect2>
<refsect2><title>The <literal>“tls-protocol-version”</literal> property</title> <programlisting> “tls-protocol-version” <type>GTlsProtocolVersion</type></programlisting> <para>The TLS protocol version negotiated for the message connection.</para> <para>Owner: SoupMessage</para> <para>Flags: Read</para> <para>Default value: G_TLS_PROTOCOL_VERSION_UNKNOWN</para> </refsect2>
<refsect2><title>The <literal>“uri”</literal> property</title> <programlisting> “uri” <type>GUri</type> *</programlisting> <para>The message's Request-URI.</para><para>Owner: SoupMessage</para> <para>Flags: Read / Write</para> </refsect2> </refsect1>
<refsect1> <title>Signal Details</title> <refsect2><title>The <literal>“accept-certificate”</literal> signal</title> <programlisting><returnvalue>gboolean</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>GTlsCertificate</type> *tls_peer_certificate, <type>GTlsCertificateFlags</type> tls_peer_errors, <type>gpointer</type> user_data)</programlisting> <para>Emitted during the <parameter>msg</parameter> 's connection TLS handshake after an unacceptable TLS certificate has been received. You can return <literal>TRUE</literal> to accept <parameter>tls_certificate</parameter> despite <parameter>tls_errors</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>tls_peer_certificate</para></entry> <entry><para>the peer's <type>GTlsCertificate</type></para></entry> <entry></entry></row> <row><entry><para>tls_peer_errors</para></entry> <entry><para>the tls errors of <parameter>tls_certificate</parameter> </para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> to accept the TLS certificate and stop other handlers from being invoked, or <literal>FALSE</literal> to propagate the event further.</para> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“authenticate”</literal> signal</title> <programlisting><returnvalue>gboolean</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>SoupAuth</type> *auth, <type>gboolean</type> retrying, <type>gpointer</type> user_data)</programlisting> <para>Emitted when the message requires authentication. If credentials are available call <function>soup_auth_authenticate()</function> on <parameter>auth</parameter> . If these credentials fail, the signal will be emitted again, with <parameter>retrying</parameter> set to <literal>TRUE</literal>, which will continue until you return without calling <function>soup_auth_authenticate()</function> on <parameter>auth</parameter> .</para> <para>Note that this may be emitted before <parameter>msg</parameter> 's body has been fully read.</para> <para>You can authenticate <parameter>auth</parameter> asynchronously by calling <function>g_object_ref()</function> on <parameter>auth</parameter> and returning <literal>TRUE</literal>. The operation will complete once either <function>soup_auth_authenticate()</function> or <function>soup_auth_cancel()</function> are called.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>auth</para></entry> <entry><para>the <type>SoupAuth</type> to authenticate</para></entry> <entry></entry></row> <row><entry><para>retrying</para></entry> <entry><para><literal>TRUE</literal> if this is the second (or later) attempt</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> to stop other handlers from being invoked or <literal>FALSE</literal> to propagate the event further.</para> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“content-sniffed”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>char</type> *type, <type>GHashTable</type> *params, <type>gpointer</type> user_data)</programlisting> <para>This signal is emitted after <type>“got-headers”</type>. 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 <type>“got-headers”</type>, and <parameter>type</parameter> is <literal>NULL</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>type</para></entry> <entry><para>the content type that we got from sniffing</para></entry> <entry></entry></row> <row><entry><para>params</para></entry> <entry><para>a <type>GHashTable</type> with the parameters. </para></entry> <entry><emphasis>[element-type utf8 utf8]</emphasis></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“finished”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted when all HTTP processing is finished for a message. (After <type>“got_body”</type>).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“got-body”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted after receiving the complete message request body.</para> <para>See also <function>soup_message_add_header_handler()</function> and <function>soup_message_add_status_code_handler()</function>, which can be used to connect to a subset of emissions of this signal.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“got-headers”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted after receiving the Status-Line and response headers.</para> <para>See also <function>soup_message_add_header_handler()</function> and <function>soup_message_add_status_code_handler()</function>, which can be used to connect to a subset of emissions of this signal.</para> <para>If you cancel or requeue <parameter>msg</parameter> while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and <parameter>msg</parameter> '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 <type>“got_body”</type> handler rather than a <type>“got_headers”</type> handler, so that the existing HTTP connection can be reused.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“got-informational”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>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.</para> <para>If you cancel or requeue <parameter>msg</parameter> while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and <parameter>msg</parameter> 's connection will be closed.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“hsts-enforced”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted when <type>SoupHSTSEnforcer</type> has upgraded the protocol for <parameter>msg</parameter> to HTTPS as a result of matching its domain with a HSTS policy.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“network-event”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>GSocketClientEvent</type> event, <type>GIOStream</type> *connection, <type>gpointer</type> user_data)</programlisting> <para>Emitted to indicate that some network-related event related to <parameter>msg</parameter> has occurred. This essentially proxies the <type>“event”</type> signal, but only for events that occur while <parameter>msg</parameter> "owns" the connection; if <parameter>msg</parameter> 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 <literal>SOUP_MESSAGE_NEW_CONNECTION</literal> flag on it.)</para> <para>See <type>“event”</type> for more information on what the different values of <parameter>event</parameter> correspond to, and what <parameter>connection</parameter> will be in each case.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>event</para></entry> <entry><para>the network event</para></entry> <entry></entry></row> <row><entry><para>connection</para></entry> <entry><para>the current state of the network connection</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“request-certificate”</literal> signal</title> <programlisting><returnvalue>gboolean</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>GTlsClientConnection</type> *tls_connection, <type>gpointer</type> user_data)</programlisting> <para>Emitted during the <parameter>msg</parameter> 's connection TLS handshake when <parameter>tls_connection</parameter> requests a certificate from the client. You can set the client certificate by calling <function>soup_message_set_tls_client_certificate()</function> and returning <literal>TRUE</literal>. It's possible to handle the request asynchornously by returning <literal>TRUE</literal> and call <function>soup_message_set_tls_client_certificate()</function> later once the certificate is available. Note that this signal is not emitted if <type>“tls-interaction”</type> was set, or if <function>soup_message_set_tls_client_certificate()</function> was called before the connection TLS handshake started.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>tls_connection</para></entry> <entry><para>the <type>GTlsClientConnection</type></para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> to handle the request, or <literal>FALSE</literal> to make the connection fail with <literal>G_TLS_ERROR_CERTIFICATE_REQUIRED</literal>.</para> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“request-certificate-password”</literal> signal</title> <programlisting><returnvalue>gboolean</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>GTlsPassword</type> *tls_password, <type>gpointer</type> user_data)</programlisting> <para>Emitted during the <parameter>msg</parameter> 's connection TLS handshake when <parameter>tls_connection</parameter> requests a certificate password from the client. You can set the certificate password on <parameter>password</parameter> , then call <function>soup_message_tls_client_certificate_password_request_complete()</function> and return <literal>TRUE</literal> to handle the signal synchronously. It's possible to handle the request asynchornously by calling <function>g_object_ref()</function> on <parameter>password</parameter> , then returning <literal>TRUE</literal> and call <function>soup_message_tls_client_certificate_password_request_complete()</function> later after setting the password on <parameter>password</parameter> . Note that this signal is not emitted if <type>“tls-interaction”</type> was set.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>tls_password</para></entry> <entry><para>the <type>GTlsPassword</type></para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> to handle the request, or <literal>FALSE</literal> to make the connection fail with <literal>G_TLS_ERROR_CERTIFICATE_REQUIRED</literal>.</para> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“restarted”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted when a request that was already sent once is now being sent again (eg, because the first attempt received a redirection response, or because we needed to use authentication).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“starting”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted just before a message is sent.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“wrote-body”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted immediately after writing the complete body for a message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“wrote-body-data”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>guint</type> chunk_size, <type>gpointer</type> user_data)</programlisting> <para>Emitted immediately after writing a portion of the message body to the network.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><para>chunk_size</para></entry> <entry><para>the number of bytes written</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2>
<refsect2><title>The <literal>“wrote-headers”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted immediately after writing the request headers for a message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the message</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run First</para> </refsect2> </refsect1>
<refsect1> <title>See Also</title> <para><type>SoupMessageHeaders</type></para> </refsect1> </refentry>
<refentry> <refmeta> <refentrytitle>SoupMessageHeaders</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupMessageHeaders</refentrytitle>

<refname>SoupMessageHeaders</refname> <refpurpose>HTTP message headers</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupMessageHeaders</returnvalue> * </entry><entry>soup_message_headers_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageHeaders</returnvalue> * </entry><entry>soup_message_headers_ref <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_unref <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_append <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_replace <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_remove <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_clear <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_clean_connection_headers <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_headers_get_one <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_headers_get_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageHeadersType</returnvalue> </entry><entry>soup_message_headers_get_headers_type <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_header_contains <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_header_equals <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry><phrase>(</phrase>*SoupMessageHeadersForeachFunc<phrase>)</phrase> <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_foreach <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_iter_init <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_iter_next <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupEncoding</returnvalue> </entry><entry>soup_message_headers_get_encoding <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_encoding <phrase>()</phrase></entry></row> <row><entry><returnvalue>goffset</returnvalue> </entry><entry>soup_message_headers_get_content_length <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_content_length <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupExpectation</returnvalue> </entry><entry>soup_message_headers_get_expectations <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_expectations <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_message_headers_get_content_type <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_content_type <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_get_content_disposition <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_content_disposition <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_get_ranges <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_ranges <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_range <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_free_ranges <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_message_headers_get_content_range <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_message_headers_set_content_range <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupMessageHeaders</entry></row> <row><entry>enum</entry><entry>SoupMessageHeadersType</entry></row> <row><entry></entry><entry>SoupMessageHeadersIter</entry></row> <row><entry>enum</entry><entry>SoupEncoding</entry></row> <row><entry>enum</entry><entry>SoupExpectation</entry></row> <row><entry></entry><entry>SoupRange</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GBoxed <phrase>╰──</phrase> SoupMessageHeaders </screen> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para><type>SoupMessageHeaders</type> represents the HTTP message headers associated with a request or response.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_message_headers_new ()</title> <programlisting><returnvalue>SoupMessageHeaders</returnvalue> * soup_message_headers_new (<parameter><type>SoupMessageHeadersType</type> type</parameter>);</programlisting> <para>Creates a <type>SoupMessageHeaders</type>. (<type>SoupMessage</type> does this automatically for its own headers. You would only need to use this method if you are manually parsing or generating message headers.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>type</para></entry> <entry><para>the type of headers</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a new <type>SoupMessageHeaders</type></para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_ref ()</title> <programlisting><returnvalue>SoupMessageHeaders</returnvalue> * soup_message_headers_ref (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Atomically increments the reference count of <parameter>hdrs</parameter> by one.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the passed in <type>SoupMessageHeaders</type></para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_unref ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_unref (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Atomically decrements the reference count of <parameter>hdrs</parameter> by one. When the reference count reaches zero, the resources allocated by <parameter>hdrs</parameter> are freed</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_append ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_append (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Appends a new header with name <parameter>name</parameter> and value <parameter>value</parameter> to <parameter>hdrs</parameter> . (If there is an existing header with name <parameter>name</parameter> , then this creates a second one, which is only allowed for list-valued headers; see also <function>soup_message_headers_replace()</function>.)</para> <para>The caller is expected to make sure that <parameter>name</parameter> and <parameter>value</parameter> are syntactically correct.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>the header name to add</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>the new value of <parameter>name</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_replace ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_replace (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Replaces the value of the header <parameter>name</parameter> in <parameter>hdrs</parameter> with <parameter>value</parameter> . (See also <function>soup_message_headers_append()</function>.)</para> <para>The caller is expected to make sure that <parameter>name</parameter> and <parameter>value</parameter> are syntactically correct.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>the header name to replace</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>the new value of <parameter>name</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_remove ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_remove (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>);</programlisting> <para>Removes <parameter>name</parameter> from <parameter>hdrs</parameter> . If there are multiple values for <parameter>name</parameter> , they are all removed.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>the header name to remove</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_clear ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_clear (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Clears <parameter>hdrs</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_clean_connection_headers ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_clean_connection_headers (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Removes all the headers listed in the Connection header.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_one ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_headers_get_one (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>);</programlisting> <para>Gets the value of header <parameter>name</parameter> in <parameter>hdrs</parameter> . Use this for headers whose values are <emphasis>not</emphasis> comma-delimited lists, and which therefore can only appear at most once in the headers. For list-valued headers, use <function>soup_message_headers_get_list()</function>.</para> <para>If <parameter>hdrs</parameter> 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.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>header name. </para></entry> <entry><emphasis>[in]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the header's value or <literal>NULL</literal> if not found. </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_list ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_headers_get_list (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>);</programlisting> <para>Gets the value of header <parameter>name</parameter> in <parameter>hdrs</parameter> . 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 <function>soup_message_headers_get_one()</function>.</para> <para>If <parameter>name</parameter> appears multiple times in <parameter>hdrs</parameter> , <function>soup_message_headers_get_list()</function> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>header name</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the header's value or <literal>NULL</literal> if not found. </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_headers_type ()</title> <programlisting><returnvalue>SoupMessageHeadersType</returnvalue> soup_message_headers_get_headers_type (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Gets the type of headers.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the header's type.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_header_contains ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_header_contains (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *token</parameter>);</programlisting> <para>Checks whether the list-valued header <parameter>name</parameter> is present in <parameter>hdrs</parameter> , and contains a case-insensitive match for <parameter>token</parameter> .</para> <para>(If <parameter>name</parameter> is present in <parameter>hdrs</parameter> , then this is equivalent to calling <function>soup_header_contains()</function> on its value.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>header name</para></entry> <entry></entry></row> <row><entry><para>token</para></entry> <entry><para>token to look for</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if the header is present and contains <parameter>token</parameter> , <literal>FALSE</literal> otherwise.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_header_equals ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_header_equals (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Checks whether the header <parameter>name</parameter> is present in <parameter>hdrs</parameter> and is (case-insensitively) equal to <parameter>value</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>header name</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>expected value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if the header is present and its value is <parameter>value</parameter> , <literal>FALSE</literal> otherwise.</para> </refsect3></refsect2>
<refsect2> <title>SoupMessageHeadersForeachFunc ()</title> <programlisting><returnvalue>void</returnvalue> <phrase>(</phrase>*SoupMessageHeadersForeachFunc<phrase>)</phrase> (<parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>The callback passed to <function>soup_message_headers_foreach()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>name</para></entry> <entry><para>the header name</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>the header value</para></entry> <entry></entry></row> <row><entry><para>user_data</para></entry> <entry><para>the data passed to <function>soup_message_headers_foreach()</function></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_foreach ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_foreach (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>SoupMessageHeadersForeachFunc</type> func</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Calls <parameter>func</parameter> once for each header value in <parameter>hdrs</parameter> .</para> <para>Beware that unlike <function>soup_message_headers_get_list()</function>, 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 <function>soup_message_headers_append()</function> 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.)</para> <para>You may not modify the headers from <parameter>func</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>func</para></entry> <entry><para>callback function to run for each header. </para></entry> <entry><emphasis>[scope call]</emphasis></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data to pass to <parameter>func</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_iter_init ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_iter_init (<parameter><type>SoupMessageHeadersIter</type> *iter</parameter>, <parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Initializes <parameter>iter</parameter> for iterating <parameter>hdrs</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>iter</para></entry> <entry><para>a pointer to a <literal>SoupMessageHeadersIter</literal> structure. </para></entry> <entry><emphasis>[out][transfer none]</emphasis></entry></row> <row><entry><para>hdrs</para></entry> <entry><para>a <literal>SoupMessageHeaders</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_iter_next ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_iter_next (<parameter><type>SoupMessageHeadersIter</type> *iter</parameter>, <parameter>const <type>char</type> **name</parameter>, <parameter>const <type>char</type> **value</parameter>);</programlisting> <para>Yields the next name/value pair in the <literal>SoupMessageHeaders</literal> being iterated by <parameter>iter</parameter> . If <parameter>iter</parameter> has already yielded the last header, then <function>soup_message_headers_iter_next()</function> will return <literal>FALSE</literal> and <parameter>name</parameter> and <parameter>value</parameter> will be unchanged.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>iter</para></entry> <entry><para>a <literal>SoupMessageHeadersIter</literal>. </para></entry> <entry><emphasis>[inout][transfer none]</emphasis></entry></row> <row><entry><para>name</para></entry> <entry><para>pointer to a variable to return the header name in. </para></entry> <entry><emphasis>[out][transfer none]</emphasis></entry></row> <row><entry><para>value</para></entry> <entry><para>pointer to a variable to return the header value in. </para></entry> <entry><emphasis>[out][transfer none]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if another name and value were returned, <literal>FALSE</literal> if the end of the headers has been reached.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_encoding ()</title> <programlisting><returnvalue>SoupEncoding</returnvalue> soup_message_headers_get_encoding (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Gets the message body encoding that <parameter>hdrs</parameter> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the encoding declared by <parameter>hdrs</parameter> .</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_encoding ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_encoding (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>SoupEncoding</type> encoding</parameter>);</programlisting> <para>Sets the message body encoding that <parameter>hdrs</parameter> will declare. In particular, you should use this if you are going to send a request or response in chunked encoding.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>encoding</para></entry> <entry><para>a <type>SoupEncoding</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_content_length ()</title> <programlisting><returnvalue>goffset</returnvalue> soup_message_headers_get_content_length (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Gets the message body length that <parameter>hdrs</parameter> declare. This will only be non-0 if <function>soup_message_headers_get_encoding()</function> returns <literal>SOUP_ENCODING_CONTENT_LENGTH</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the message body length declared by <parameter>hdrs</parameter> .</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_content_length ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_content_length (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>goffset</type> content_length</parameter>);</programlisting> <para>Sets the message body length that <parameter>hdrs</parameter> will declare, and sets <parameter>hdrs</parameter> 's encoding to <literal>SOUP_ENCODING_CONTENT_LENGTH</literal>.</para> <para>You do not normally need to call this; if <parameter>hdrs</parameter> 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 <function>soup_message_headers_set_content_length()</function> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>content_length</para></entry> <entry><para>the message body length</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_expectations ()</title> <programlisting><returnvalue>SoupExpectation</returnvalue> soup_message_headers_get_expectations (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>);</programlisting> <para>Gets the expectations declared by <parameter>hdrs</parameter> 's "Expect" header. Currently this will either be <literal>SOUP_EXPECTATION_CONTINUE</literal> or <literal>SOUP_EXPECTATION_UNRECOGNIZED</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the contents of <parameter>hdrs</parameter> 's "Expect" header</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_expectations ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_expectations (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>SoupExpectation</type> expectations</parameter>);</programlisting> <para>Sets <parameter>hdrs</parameter> 's "Expect" header according to <parameter>expectations</parameter> .</para> <para>Currently <literal>SOUP_EXPECTATION_CONTINUE</literal> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>expectations</para></entry> <entry><para>the expectations to set</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_content_type ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_message_headers_get_content_type (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>GHashTable</type> **params</parameter>);</programlisting> <para>Looks up the "Content-Type" header in <parameter>hdrs</parameter> , parses it, and returns its value in *<parameter>content_type</parameter> and *<parameter>params</parameter> . <parameter>params</parameter> can be <literal>NULL</literal> if you are only interested in the content type itself.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>params</para></entry> <entry><para>return location for the Content-Type parameters (eg, "charset"), or <literal>NULL</literal>. </para></entry> <entry><emphasis>[out][element-type utf8 utf8][optional][transfer full]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a string with the value of the "Content-Type" header or <literal>NULL</literal> if <parameter>hdrs</parameter> does not contain that header or it cannot be parsed (in which case *<parameter>params</parameter> will be unchanged). </para> <para><emphasis>[nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_content_type ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_content_type (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *content_type</parameter>, <parameter><type>GHashTable</type> *params</parameter>);</programlisting> <para>Sets the "Content-Type" header in <parameter>hdrs</parameter> to <parameter>content_type</parameter> , optionally with additional parameters specified in <parameter>params</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>content_type</para></entry> <entry><para>the MIME type</para></entry> <entry></entry></row> <row><entry><para>params</para></entry> <entry><para>additional parameters, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable][element-type utf8 utf8]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_content_disposition ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_get_content_disposition (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>char</type> **disposition</parameter>, <parameter><type>GHashTable</type> **params</parameter>);</programlisting> <para>Looks up the "Content-Disposition" header in <parameter>hdrs</parameter> , parses it, and returns its value in *<parameter>disposition</parameter> and *<parameter>params</parameter> . <parameter>params</parameter> can be <literal>NULL</literal> if you are only interested in the disposition-type.</para> <para>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 <parameter>params</parameter> 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.)</para> <para>Content-Disposition is also used in "multipart/form-data", however this is handled automatically by <type>SoupMultipart</type> and the associated form methods.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>disposition</para></entry> <entry><para>return location for the disposition-type, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[out][transfer full]</emphasis></entry></row> <row><entry><para>params</para></entry> <entry><para>return location for the Content-Disposition parameters, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[out][transfer full][element-type utf8 utf8]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>hdrs</parameter> contains a "Content-Disposition" header, <literal>FALSE</literal> if not (in which case *<parameter>disposition</parameter> and *<parameter>params</parameter> will be unchanged).</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_content_disposition ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_content_disposition (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter>const <type>char</type> *disposition</parameter>, <parameter><type>GHashTable</type> *params</parameter>);</programlisting> <para>Sets the "Content-Disposition" header in <parameter>hdrs</parameter> to <parameter>disposition</parameter> , optionally with additional parameters specified in <parameter>params</parameter> .</para> <para>See <function>soup_message_headers_get_content_disposition()</function> for a discussion of how Content-Disposition is used in HTTP.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>disposition</para></entry> <entry><para>the disposition-type</para></entry> <entry></entry></row> <row><entry><para>params</para></entry> <entry><para>additional parameters, or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable][element-type utf8 utf8]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_ranges ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_get_ranges (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>goffset</type> total_length</parameter>, <parameter><type>SoupRange</type> **ranges</parameter>, <parameter><type>int</type> *length</parameter>);</programlisting> <para>Parses <parameter>hdrs</parameter> 's Range header and returns an array of the requested byte ranges. The returned array must be freed with <function>soup_message_headers_free_ranges()</function>.</para> <para>If <parameter>total_length</parameter> 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 <parameter>total_length</parameter> is 0, then some ranges may have an end value of -1, as described under <type>SoupRange</type>, and some of the ranges may be redundant.</para> <para>Beware that even if given a <parameter>total_length</parameter> , this function does not check that the ranges are satisfiable.</para> <note><para> <type>SoupServer</type> has built-in handling for range requests. If your server handler returns a <literal>SOUP_STATUS_OK</literal> 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 <literal>SOUP_STATUS_PARTIAL_CONTENT</literal> response containing only the range(s) requested by the client. The only time you need to process the Range header yourself is if either you need to stream the response body rather than returning it all at once, or you do not already have the complete response body available, and only want to generate the parts that were actually requested by the client. </para></note> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>total_length</para></entry> <entry><para>the total_length of the response body</para></entry> <entry></entry></row> <row><entry><para>ranges</para></entry> <entry><para>return location for an array of <type>SoupRange</type>. </para></entry> <entry><emphasis>[out][array length=length]</emphasis></entry></row> <row><entry><para>length</para></entry> <entry><para>the length of the returned array</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>hdrs</parameter> contained a syntactically-valid "Range" header, <literal>FALSE</literal> otherwise (in which case <parameter>range</parameter> and <parameter>length</parameter> will not be set).</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_ranges ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_ranges (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>SoupRange</type> *ranges</parameter>, <parameter><type>int</type> length</parameter>);</programlisting> <para>Sets <parameter>hdrs</parameter> 's Range header to request the indicated ranges. (If you only want to request a single range, you can use <function>soup_message_headers_set_range()</function>.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>ranges</para></entry> <entry><para>an array of <type>SoupRange</type></para></entry> <entry></entry></row> <row><entry><para>length</para></entry> <entry><para>the length of <parameter>range</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_range ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_range (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>goffset</type> start</parameter>, <parameter><type>goffset</type> end</parameter>);</programlisting> <para>Sets <parameter>hdrs</parameter> 's Range header to request the indicated range. <parameter>start</parameter> and <parameter>end</parameter> are interpreted as in a <type>SoupRange</type>.</para> <para>If you need to request multiple ranges, use <function>soup_message_headers_set_ranges()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>start</para></entry> <entry><para>the start of the range to request</para></entry> <entry></entry></row> <row><entry><para>end</para></entry> <entry><para>the end of the range to request</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_free_ranges ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_free_ranges (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>SoupRange</type> *ranges</parameter>);</programlisting> <para>Frees the array of ranges returned from <function>soup_message_headers_get_ranges()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>ranges</para></entry> <entry><para>an array of <type>SoupRange</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_get_content_range ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_message_headers_get_content_range (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>goffset</type> *start</parameter>, <parameter><type>goffset</type> *end</parameter>, <parameter><type>goffset</type> *total_length</parameter>);</programlisting> <para>Parses <parameter>hdrs</parameter> 's Content-Range header and returns it in <parameter>start</parameter> , <parameter>end</parameter> , and <parameter>total_length</parameter> . If the total length field in the header was specified as "*", then <parameter>total_length</parameter> will be set to -1.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>start</para></entry> <entry><para>return value for the start of the range. </para></entry> <entry><emphasis>[out]</emphasis></entry></row> <row><entry><para>end</para></entry> <entry><para>return value for the end of the range. </para></entry> <entry><emphasis>[out]</emphasis></entry></row> <row><entry><para>total_length</para></entry> <entry><para>return value for the total length of the resource, or <literal>NULL</literal> if you don't care. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>hdrs</parameter> contained a "Content-Range" header containing a byte range which could be parsed, <literal>FALSE</literal> otherwise.</para> </refsect3></refsect2>
<refsect2> <title>soup_message_headers_set_content_range ()</title> <programlisting><returnvalue>void</returnvalue> soup_message_headers_set_content_range (<parameter><type>SoupMessageHeaders</type> *hdrs</parameter>, <parameter><type>goffset</type> start</parameter>, <parameter><type>goffset</type> end</parameter>, <parameter><type>goffset</type> total_length</parameter>);</programlisting> <para>Sets <parameter>hdrs</parameter> 's Content-Range header according to the given values. (Note that <parameter>total_length</parameter> is the total length of the entire resource that this is a range of, not simply <parameter>end</parameter> - <parameter>start</parameter> + 1.)</para> <note><para> <type>SoupServer</type> has built-in handling for range requests, and you do not normally need to call this function youself. See <function>soup_message_headers_get_ranges()</function> for more details. </para></note> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>hdrs</para></entry> <entry><para>a <type>SoupMessageHeaders</type></para></entry> <entry></entry></row> <row><entry><para>start</para></entry> <entry><para>the start of the range</para></entry> <entry></entry></row> <row><entry><para>end</para></entry> <entry><para>the end of the range</para></entry> <entry></entry></row> <row><entry><para>total_length</para></entry> <entry><para>the total length of the resource, or -1 if unknown</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupMessageHeaders</title> <programlisting>typedef struct _SoupMessageHeaders SoupMessageHeaders;</programlisting> <para>The HTTP message headers associated with a request or response.</para> </refsect2>
<refsect2> <title>enum SoupMessageHeadersType</title> <para>Value passed to <function>soup_message_headers_new()</function> to set certain default behaviors.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_MESSAGE_HEADERS_REQUEST</para></entry> <entry><para>request headers</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_HEADERS_RESPONSE</para></entry> <entry><para>response headers</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_MESSAGE_HEADERS_MULTIPART</para></entry> <entry><para>multipart body part headers</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>SoupMessageHeadersIter</title> <programlisting>typedef struct { } SoupMessageHeadersIter; </programlisting> <para>An opaque type used to iterate over a <literal>SoupMessageHeaders</literal> structure.</para> <para>After intializing the iterator with <function>soup_message_headers_iter_init()</function>, call <function>soup_message_headers_iter_next()</function> to fetch data from it.</para> <para>You may not modify the headers while iterating over them.</para> </refsect2>
<refsect2> <title>enum SoupEncoding</title> <para>How a message body is encoded for transport</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_ENCODING_UNRECOGNIZED</para></entry> <entry><para>unknown / error</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_ENCODING_NONE</para></entry> <entry><para>no body is present (which is not the same as a 0-length body, and only occurs in certain places)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_ENCODING_CONTENT_LENGTH</para></entry> <entry><para>Content-Length encoding</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_ENCODING_EOF</para></entry> <entry><para>Response body ends when the connection is closed</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_ENCODING_CHUNKED</para></entry> <entry><para>chunked encoding (currently only supported for response)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_ENCODING_BYTERANGES</para></entry> <entry><para>multipart/byteranges (Reserved for future use: NOT CURRENTLY IMPLEMENTED)</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>enum SoupExpectation</title> <para>Represents the parsed value of the "Expect" header.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_EXPECTATION_UNRECOGNIZED</para></entry> <entry><para>any unrecognized expectation</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_EXPECTATION_CONTINUE</para></entry> <entry><para>"100-continue"</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>SoupRange</title> <programlisting>typedef struct { goffset start; goffset end; } SoupRange; </programlisting> <para>Represents a byte range as used in the Range header.</para> <para>If <parameter>end</parameter> is non-negative, then <parameter>start</parameter> and <parameter>end</parameter> represent the bounds of of the range, counting from 0. (Eg, the first 500 bytes would be represented as <parameter>start</parameter> = 0 and <parameter>end</parameter> = 499.)</para> <para>If <parameter>end</parameter> is -1 and <parameter>start</parameter> is non-negative, then this represents a range starting at <parameter>start</parameter> and ending with the last byte of the requested resource body. (Eg, all but the first 500 bytes would be <parameter>start</parameter> = 500, and <parameter>end</parameter> = -1.)</para> <para>If <parameter>end</parameter> is -1 and <parameter>start</parameter> is negative, then it represents a "suffix range", referring to the last -<parameter>start</parameter> bytes of the resource body. (Eg, the last 500 bytes would be <parameter>start</parameter> = -500 and <parameter>end</parameter> = -1.)</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para><type>goffset</type> <structfield>start</structfield>;</para></entry> <entry><para>the start of the range</para></entry> <entry></entry> </row> <row><entry><para><type>goffset</type> <structfield>end</structfield>;</para></entry> <entry><para>the end of the range</para></entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3> </refsect2> </refsect1>
<refsect1> <title>See Also</title> <para><type>SoupMessage</type></para> </refsect1> </refentry>
<refentry> <refmeta> <refentrytitle>SoupHeaders</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupHeaders</refentrytitle>

<refname>SoupHeaders</refname> <refpurpose>Functions to help working with HTTP Headers</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_headers_parse_request <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_headers_parse_response <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_headers_parse_status_line <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_headers_parse <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSList</returnvalue> * </entry><entry>soup_header_parse_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSList</returnvalue> * </entry><entry>soup_header_parse_quality_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_header_free_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_header_contains <phrase>()</phrase></entry></row> <row><entry><returnvalue>GHashTable</returnvalue> * </entry><entry>soup_header_parse_param_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>GHashTable</returnvalue> * </entry><entry>soup_header_parse_semi_param_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>GHashTable</returnvalue> * </entry><entry>soup_header_parse_param_list_strict <phrase>()</phrase></entry></row> <row><entry><returnvalue>GHashTable</returnvalue> * </entry><entry>soup_header_parse_semi_param_list_strict <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_header_free_param_list <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_header_g_string_append_param <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_header_g_string_append_param_quoted <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>These are utility functions to help working with HTTP headers.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_headers_parse_request ()</title> <programlisting><returnvalue>guint</returnvalue> soup_headers_parse_request (<parameter>const <type>char</type> *str</parameter>, <parameter><type>int</type> len</parameter>, <parameter><type>SoupMessageHeaders</type> *req_headers</parameter>, <parameter><type>char</type> **req_method</parameter>, <parameter><type>char</type> **req_path</parameter>, <parameter><type>SoupHTTPVersion</type> *ver</parameter>);</programlisting> <para>Parses the headers of an HTTP request in <parameter>str</parameter> and stores the results in <parameter>req_method</parameter> , <parameter>req_path</parameter> , <parameter>ver</parameter> , and <parameter>req_headers</parameter> .</para> <para>Beware that <parameter>req_headers</parameter> may be modified even on failure.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>str</para></entry> <entry><para>the headers (up to, but not including, the trailing blank line)</para></entry> <entry></entry></row> <row><entry><para>len</para></entry> <entry><para>length of <parameter>str</parameter> </para></entry> <entry></entry></row> <row><entry><para>req_headers</para></entry> <entry><para><type>SoupMessageHeaders</type> to store the header values in</para></entry> <entry></entry></row> <row><entry><para>req_method</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the request method. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>req_path</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the request path. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>ver</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the HTTP version. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>SOUP_STATUS_OK</literal> if the headers could be parsed, or an HTTP error to be returned to the client if they could not be.</para> </refsect3></refsect2>
<refsect2> <title>soup_headers_parse_response ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_headers_parse_response (<parameter>const <type>char</type> *str</parameter>, <parameter><type>int</type> len</parameter>, <parameter><type>SoupMessageHeaders</type> *headers</parameter>, <parameter><type>SoupHTTPVersion</type> *ver</parameter>, <parameter><type>guint</type> *status_code</parameter>, <parameter><type>char</type> **reason_phrase</parameter>);</programlisting> <para>Parses the headers of an HTTP response in <parameter>str</parameter> and stores the results in <parameter>ver</parameter> , <parameter>status_code</parameter> , <parameter>reason_phrase</parameter> , and <parameter>headers</parameter> .</para> <para>Beware that <parameter>headers</parameter> may be modified even on failure.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>str</para></entry> <entry><para>the headers (up to, but not including, the trailing blank line)</para></entry> <entry></entry></row> <row><entry><para>len</para></entry> <entry><para>length of <parameter>str</parameter> </para></entry> <entry></entry></row> <row><entry><para>headers</para></entry> <entry><para><type>SoupMessageHeaders</type> to store the header values in</para></entry> <entry></entry></row> <row><entry><para>ver</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the HTTP version. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>status_code</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the status code. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>reason_phrase</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the reason phrase. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> success or failure.</para> </refsect3></refsect2>
<refsect2> <title>soup_headers_parse_status_line ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_headers_parse_status_line (<parameter>const <type>char</type> *status_line</parameter>, <parameter><type>SoupHTTPVersion</type> *ver</parameter>, <parameter><type>guint</type> *status_code</parameter>, <parameter><type>char</type> **reason_phrase</parameter>);</programlisting> <para>Parses the HTTP Status-Line string in <parameter>status_line</parameter> into <parameter>ver</parameter> , <parameter>status_code</parameter> , and <parameter>reason_phrase</parameter> . <parameter>status_line</parameter> must be terminated by either "\0" or "\r\n".</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status_line</para></entry> <entry><para>an HTTP Status-Line</para></entry> <entry></entry></row> <row><entry><para>ver</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the HTTP version. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>status_code</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the status code. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> <row><entry><para>reason_phrase</para></entry> <entry><para>if non-<literal>NULL</literal>, will be filled in with the reason phrase. </para></entry> <entry><emphasis>[out][optional]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>status_line</parameter> was parsed successfully.</para> </refsect3></refsect2>
<refsect2> <title>soup_headers_parse ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_headers_parse (<parameter>const <type>char</type> *str</parameter>, <parameter><type>int</type> len</parameter>, <parameter><type>SoupMessageHeaders</type> *dest</parameter>);</programlisting> <para>Parses the headers of an HTTP request or response in <parameter>str</parameter> and stores the results in <parameter>dest</parameter> . Beware that <parameter>dest</parameter> may be modified even on failure.</para> <para>This is a low-level method; normally you would use <function>soup_headers_parse_request()</function> or <function>soup_headers_parse_response()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>str</para></entry> <entry><para>the header string (including the Request-Line or Status-Line, but not the trailing blank line)</para></entry> <entry></entry></row> <row><entry><para>len</para></entry> <entry><para>length of <parameter>str</parameter> </para></entry> <entry></entry></row> <row><entry><para>dest</para></entry> <entry><para><type>SoupMessageHeaders</type> to store the header values in</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> success or failure</para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_list ()</title> <programlisting><returnvalue>GSList</returnvalue> * soup_header_parse_list (<parameter>const <type>char</type> *header</parameter>);</programlisting> <para>Parses a header whose content is described by RFC2616 as "<type>something</type>", where "something" does not itself contain commas, except as part of quoted-strings.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GSList</type> of list elements, as allocated strings. </para> <para><emphasis>[transfer full][element-type utf8]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_quality_list ()</title> <programlisting><returnvalue>GSList</returnvalue> * soup_header_parse_quality_list (<parameter>const <type>char</type> *header</parameter>, <parameter><type>GSList</type> **unacceptable</parameter>);</programlisting> <para>Parses a header whose content is a list of items with optional "qvalue"s (eg, Accept, Accept-Charset, Accept-Encoding, Accept-Language, TE).</para> <para>If <parameter>unacceptable</parameter> is not <literal>NULL</literal>, then on return, it will contain the items with qvalue 0. Either way, those items will be removed from the main list.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> <row><entry><para>unacceptable</para></entry> <entry><para>on return, will contain a list of unacceptable values. </para></entry> <entry><emphasis>[out][optional][transfer full][element-type utf8]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GSList</type> of acceptable values (as allocated strings), highest-qvalue first. </para> <para><emphasis>[transfer full][element-type utf8]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_free_list ()</title> <programlisting><returnvalue>void</returnvalue> soup_header_free_list (<parameter><type>GSList</type> *list</parameter>);</programlisting> <para>Frees <parameter>list</parameter> .</para> <para><emphasis>[skip]</emphasis></para><refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>list</para></entry> <entry><para>a <type>GSList</type> returned from <function>soup_header_parse_list()</function> or <function>soup_header_parse_quality_list()</function></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_header_contains ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_header_contains (<parameter>const <type>char</type> *header</parameter>, <parameter>const <type>char</type> *token</parameter>);</programlisting> <para>Parses <parameter>header</parameter> to see if it contains the token <parameter>token</parameter> (matched case-insensitively). Note that this can't be used with lists that have qvalues.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>An HTTP header suitable for parsing with <function>soup_header_parse_list()</function></para></entry> <entry></entry></row> <row><entry><para>token</para></entry> <entry><para>a token</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> whether or not <parameter>header</parameter> contains <parameter>token</parameter> </para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_param_list ()</title> <programlisting><returnvalue>GHashTable</returnvalue> * soup_header_parse_param_list (<parameter>const <type>char</type> *header</parameter>);</programlisting> <para>Parses a header which is a comma-delimited list of something like: <literal>token [ "=" ( token | quoted-string ) ]</literal>.</para> <para>Tokens that don't have an associated value will still be added to the resulting hash table, but with a <literal>NULL</literal> value.</para> <para>This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GHashTable</type> of list elements, which can be freed with <function>soup_header_free_param_list()</function>. </para> <para><emphasis>[element-type utf8 utf8][transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_semi_param_list ()</title> <programlisting><returnvalue>GHashTable</returnvalue> * soup_header_parse_semi_param_list (<parameter>const <type>char</type> *header</parameter>);</programlisting> <para>Parses a header which is a semicolon-delimited list of something like: <literal>token [ "=" ( token | quoted-string ) ]</literal>.</para> <para>Tokens that don't have an associated value will still be added to the resulting hash table, but with a <literal>NULL</literal> value.</para> <para>This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GHashTable</type> of list elements, which can be freed with <function>soup_header_free_param_list()</function>. </para> <para><emphasis>[element-type utf8 utf8][transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_param_list_strict ()</title> <programlisting><returnvalue>GHashTable</returnvalue> * soup_header_parse_param_list_strict (<parameter>const <type>char</type> *header</parameter>);</programlisting> <para>A strict version of <function>soup_header_parse_param_list()</function> 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 <function>soup_header_parse_param_list()</function> instead.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GHashTable</type> of list elements, which can be freed with <function>soup_header_free_param_list()</function> or <literal>NULL</literal> if there are duplicate elements. </para> <para><emphasis>[element-type utf8 utf8][transfer full][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_parse_semi_param_list_strict ()</title> <programlisting><returnvalue>GHashTable</returnvalue> * soup_header_parse_semi_param_list_strict (<parameter>const <type>char</type> *header</parameter>);</programlisting> <para>A strict version of <function>soup_header_parse_semi_param_list()</function> 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 <function>soup_header_parse_semi_param_list()</function> instead.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>header</para></entry> <entry><para>a header value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GHashTable</type> of list elements, which can be freed with <function>soup_header_free_param_list()</function> or <literal>NULL</literal> if there are duplicate elements. </para> <para><emphasis>[element-type utf8 utf8][transfer full][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_header_free_param_list ()</title> <programlisting><returnvalue>void</returnvalue> soup_header_free_param_list (<parameter><type>GHashTable</type> *param_list</parameter>);</programlisting> <para>Frees <parameter>param_list</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>param_list</para></entry> <entry><para>a <type>GHashTable</type> returned from <function>soup_header_parse_param_list()</function> or <function>soup_header_parse_semi_param_list()</function>. </para></entry> <entry><emphasis>[element-type utf8 utf8]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_header_g_string_append_param ()</title> <programlisting><returnvalue>void</returnvalue> soup_header_g_string_append_param (<parameter><type>GString</type> *string</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Appends something like <literal><parameter>name</parameter> =<parameter>value</parameter> </literal> to <parameter>string</parameter> , taking care to quote <parameter>value</parameter> if needed, and if so, to escape any quotes or backslashes in <parameter>value</parameter> .</para> <para>Alternatively, if <parameter>value</parameter> 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.</para> <para>If <parameter>value</parameter> is <literal>NULL</literal>, this will just append <parameter>name</parameter> to <parameter>string</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>string</para></entry> <entry><para>a <type>GString</type> being used to construct an HTTP header value</para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>a parameter name</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>a parameter value, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_header_g_string_append_param_quoted ()</title> <programlisting><returnvalue>void</returnvalue> soup_header_g_string_append_param_quoted (<parameter><type>GString</type> *string</parameter>, <parameter>const <type>char</type> *name</parameter>, <parameter>const <type>char</type> *value</parameter>);</programlisting> <para>Appends something like <literal><parameter>name</parameter> ="<parameter>value</parameter> "</literal> to <parameter>string</parameter> , taking care to escape any quotes or backslashes in <parameter>value</parameter> .</para> <para>If <parameter>value</parameter> is (non-ASCII) UTF-8, this will instead use RFC 5987 encoding, just like <function>soup_header_g_string_append_param()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>string</para></entry> <entry><para>a <type>GString</type> being used to construct an HTTP header value</para></entry> <entry></entry></row> <row><entry><para>name</para></entry> <entry><para>a parameter name</para></entry> <entry></entry></row> <row><entry><para>value</para></entry> <entry><para>a parameter value</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
</refentry>
<refentry> <refmeta> <refentrytitle>SoupMethod</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupMethod</refentrytitle>

<refname>SoupMethod</refname> <refpurpose>HTTP method definitions</refpurpose>

<refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry>#define</entry><entry>SOUP_METHOD_OPTIONS</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_GET</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_HEAD</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_PUT</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_POST</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_DELETE</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_TRACE</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_CONNECT</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_PROPFIND</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_PROPPATCH</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_MKCOL</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_COPY</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_MOVE</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_LOCK</entry></row> <row><entry>#define</entry><entry>SOUP_METHOD_UNLOCK</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>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 <function>soup_message_new()</function> if you prefer.</para> <para>The thing that these defines <emphasis>are</emphasis> useful for is performing quick comparisons against <function>soup_message_get_method()</function>; because <type>SoupMessage</type> always contains an interned string, and these macros return interned strings, you can compare methods directly against these macros rather than needing to use <function>strcmp()</function>. This is most useful in <type>SoupServer</type> handlers. Eg:</para> <informalexample><programlisting> if (soup_message_get_method (msg) != SOUP_METHOD_GET && soup_message_get_method (msg) != SOUP_METHOD_HEAD) { soup_message_set_status (msg, SOUP_METHOD_NOT_IMPLEMENTED); return; } </programlisting></informalexample> </refsect1> <refsect1> <title>Functions</title> <para></para> </refsect1> <refsect1> <title>Types and Values</title> <refsect2> <title>SOUP_METHOD_OPTIONS</title> <programlisting>#define SOUP_METHOD_OPTIONS _SOUP_INTERN_METHOD (OPTIONS) </programlisting> <para>"OPTIONS" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_GET</title> <programlisting>#define SOUP_METHOD_GET _SOUP_INTERN_METHOD (GET) </programlisting> <para>"GET" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_HEAD</title> <programlisting>#define SOUP_METHOD_HEAD _SOUP_INTERN_METHOD (HEAD) </programlisting> <para>"HEAD" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_PUT</title> <programlisting>#define SOUP_METHOD_PUT _SOUP_INTERN_METHOD (PUT) </programlisting> <para>"PUT" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_POST</title> <programlisting>#define SOUP_METHOD_POST _SOUP_INTERN_METHOD (POST) </programlisting> <para>"POST" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_DELETE</title> <programlisting>#define SOUP_METHOD_DELETE _SOUP_INTERN_METHOD (DELETE) </programlisting> <para>"DELETE" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_TRACE</title> <programlisting>#define SOUP_METHOD_TRACE _SOUP_INTERN_METHOD (TRACE) </programlisting> <para>"TRACE" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_CONNECT</title> <programlisting>#define SOUP_METHOD_CONNECT _SOUP_INTERN_METHOD (CONNECT) </programlisting> <para>"CONNECT" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_PROPFIND</title> <programlisting>#define SOUP_METHOD_PROPFIND _SOUP_INTERN_METHOD (PROPFIND) </programlisting> <para>"PROPFIND" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_PROPPATCH</title> <programlisting>#define SOUP_METHOD_PROPPATCH _SOUP_INTERN_METHOD (PROPPATCH) </programlisting> <para>"PROPPATCH" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_MKCOL</title> <programlisting>#define SOUP_METHOD_MKCOL _SOUP_INTERN_METHOD (MKCOL) </programlisting> <para>"MKCOL" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_COPY</title> <programlisting>#define SOUP_METHOD_COPY _SOUP_INTERN_METHOD (COPY) </programlisting> <para>"COPY" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_MOVE</title> <programlisting>#define SOUP_METHOD_MOVE _SOUP_INTERN_METHOD (MOVE) </programlisting> <para>"MOVE" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_LOCK</title> <programlisting>#define SOUP_METHOD_LOCK _SOUP_INTERN_METHOD (LOCK) </programlisting> <para>"LOCK" as an interned string.</para> </refsect2>
<refsect2> <title>SOUP_METHOD_UNLOCK</title> <programlisting>#define SOUP_METHOD_UNLOCK _SOUP_INTERN_METHOD (UNLOCK) </programlisting> <para>"UNLOCK" as an interned string.</para> </refsect2> </refsect1>
</refentry>
<refentry> <refmeta> <refentrytitle>SoupMultipart</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupMultipart</refentrytitle>

<refname>SoupMultipart</refname> <refpurpose>multipart HTTP message bodies</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupMultipart</returnvalue> * </entry><entry>soup_multipart_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMultipart</returnvalue> * </entry><entry>soup_multipart_new_from_message <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_free <phrase>()</phrase></entry></row> <row><entry><returnvalue>int</returnvalue> </entry><entry>soup_multipart_get_length <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_multipart_get_part <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_append_part <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_append_form_string <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_append_form_file <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_to_message <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupMultipart</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GBoxed <phrase>╰──</phrase> SoupMultipart </screen> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>Functions to use multi-part HTTP messages.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_multipart_new ()</title> <programlisting><returnvalue>SoupMultipart</returnvalue> * soup_multipart_new (<parameter>const <type>char</type> *mime_type</parameter>);</programlisting> <para>Creates a new empty <type>SoupMultipart</type> with a randomly-generated boundary string. Note that <parameter>mime_type</parameter> must be the full MIME type, including "multipart/".</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>mime_type</para></entry> <entry><para>the MIME type of the multipart to create.</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a new empty <type>SoupMultipart</type> of the given <parameter>mime_type</parameter> </para> <para>See also: <function>soup_message_new_from_multipart()</function></para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_new_from_message ()</title> <programlisting><returnvalue>SoupMultipart</returnvalue> * soup_multipart_new_from_message (<parameter><type>SoupMessageHeaders</type> *headers</parameter>, <parameter><type>GBytes</type> *body</parameter>);</programlisting> <para>Parses <parameter>headers</parameter> and <parameter>body</parameter> to form a new <type>SoupMultipart</type></para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>headers</para></entry> <entry><para>the headers of the HTTP message to parse</para></entry> <entry></entry></row> <row><entry><para>body</para></entry> <entry><para>the body of the HTTP message to parse</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a new <type>SoupMultipart</type> (or <literal>NULL</literal> if the message couldn't be parsed or wasn't multipart). </para> <para><emphasis>[nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_free ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_free (<parameter><type>SoupMultipart</type> *multipart</parameter>);</programlisting> <para>Frees <parameter>multipart</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_multipart_get_length ()</title> <programlisting><returnvalue>int</returnvalue> soup_multipart_get_length (<parameter><type>SoupMultipart</type> *multipart</parameter>);</programlisting> <para>Gets the number of body parts in <parameter>multipart</parameter> </para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the number of body parts in <parameter>multipart</parameter> </para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_get_part ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_multipart_get_part (<parameter><type>SoupMultipart</type> *multipart</parameter>, <parameter><type>int</type> part</parameter>, <parameter><type>SoupMessageHeaders</type> **headers</parameter>, <parameter><type>GBytes</type> **body</parameter>);</programlisting> <para>Gets the indicated body part from <parameter>multipart</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> <row><entry><para>part</para></entry> <entry><para>the part number to get (counting from 0)</para></entry> <entry></entry></row> <row><entry><para>headers</para></entry> <entry><para>return location for the MIME part headers. </para></entry> <entry><emphasis>[out][transfer none]</emphasis></entry></row> <row><entry><para>body</para></entry> <entry><para>return location for the MIME part body. </para></entry> <entry><emphasis>[out][transfer none]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> on success, <literal>FALSE</literal> if <parameter>part</parameter> is out of range (in which case <parameter>headers</parameter> and <parameter>body</parameter> won't be set)</para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_append_part ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_append_part (<parameter><type>SoupMultipart</type> *multipart</parameter>, <parameter><type>SoupMessageHeaders</type> *headers</parameter>, <parameter><type>GBytes</type> *body</parameter>);</programlisting> <para>Adds a new MIME part to <parameter>multipart</parameter> with the given headers and body. (The multipart will make its own copies of <parameter>headers</parameter> and <parameter>body</parameter> , so you should free your copies if you are not using them for anything else.)</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> <row><entry><para>headers</para></entry> <entry><para>the MIME part headers</para></entry> <entry></entry></row> <row><entry><para>body</para></entry> <entry><para>the MIME part body</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_multipart_append_form_string ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_append_form_string (<parameter><type>SoupMultipart</type> *multipart</parameter>, <parameter>const <type>char</type> *control_name</parameter>, <parameter>const <type>char</type> *data</parameter>);</programlisting> <para>Adds a new MIME part containing <parameter>data</parameter> to <parameter>multipart</parameter> , using "Content-Disposition: form-data", as per the HTML forms specification.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a multipart (presumably of type "multipart/form-data")</para></entry> <entry></entry></row> <row><entry><para>control_name</para></entry> <entry><para>the name of the control associated with <parameter>data</parameter> </para></entry> <entry></entry></row> <row><entry><para>data</para></entry> <entry><para>the body data</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_multipart_append_form_file ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_append_form_file (<parameter><type>SoupMultipart</type> *multipart</parameter>, <parameter>const <type>char</type> *control_name</parameter>, <parameter>const <type>char</type> *filename</parameter>, <parameter>const <type>char</type> *content_type</parameter>, <parameter><type>GBytes</type> *body</parameter>);</programlisting> <para>Adds a new MIME part containing <parameter>body</parameter> to <parameter>multipart</parameter> , using "Content-Disposition: form-data", as per the HTML forms specification.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a multipart (presumably of type "multipart/form-data")</para></entry> <entry></entry></row> <row><entry><para>control_name</para></entry> <entry><para>the name of the control associated with this file</para></entry> <entry></entry></row> <row><entry><para>filename</para></entry> <entry><para>the name of the file, or <literal>NULL</literal> if not known</para></entry> <entry></entry></row> <row><entry><para>content_type</para></entry> <entry><para>the MIME type of the file, or <literal>NULL</literal> if not known</para></entry> <entry></entry></row> <row><entry><para>body</para></entry> <entry><para>the file data</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_multipart_to_message ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_to_message (<parameter><type>SoupMultipart</type> *multipart</parameter>, <parameter><type>SoupMessageHeaders</type> *dest_headers</parameter>, <parameter><type>GBytes</type> **dest_body</parameter>);</programlisting> <para>Serializes <parameter>multipart</parameter> to <parameter>dest_headers</parameter> and <parameter>dest_body</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipart</type></para></entry> <entry></entry></row> <row><entry><para>dest_headers</para></entry> <entry><para>the headers of the HTTP message to serialize <parameter>multipart</parameter> to</para></entry> <entry></entry></row> <row><entry><para>dest_body</para></entry> <entry><para>the body of the HTTP message to serialize <parameter>multipart</parameter> to. </para></entry> <entry><emphasis>[out]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupMultipart</title> <programlisting>typedef struct _SoupMultipart SoupMultipart;</programlisting> <para>Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046. Of particular interest to HTTP are <literal>multipart/byte-ranges</literal> and <literal>multipart/form-data</literal>.</para> <para>Although the headers of a <type>SoupMultipart</type> 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 <type>SoupMultipart</type> for handling real MIME multiparts.</para> </refsect2> </refsect1> <refsect1> <title>See Also</title> <para><type>SoupMessageBody</type>, <type>SoupMessageHeaders</type></para> </refsect1> </refentry>
<refentry> <refmeta> <refentrytitle>SoupMultipartInputStream</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupMultipartInputStream</refentrytitle>

<refname>SoupMultipartInputStream</refname> <refpurpose>Multipart input handling stream</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupMultipartInputStream</returnvalue> * </entry><entry>soup_multipart_input_stream_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessageHeaders</returnvalue> * </entry><entry>soup_multipart_input_stream_get_headers <phrase>()</phrase></entry></row> <row><entry><returnvalue>GInputStream</returnvalue> * </entry><entry>soup_multipart_input_stream_next_part <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_multipart_input_stream_next_part_async <phrase>()</phrase></entry></row> <row><entry><returnvalue>GInputStream</returnvalue> * </entry><entry>soup_multipart_input_stream_next_part_finish <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Properties</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><type>SoupMessage</type> *</entry><entry>message</entry><entry>Read / Write / Construct Only</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupMultipartInputStream</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GObject <phrase>╰──</phrase> GInputStream <phrase>╰──</phrase> GFilterInputStream <phrase>╰──</phrase> SoupMultipartInputStream </screen> </refsect1> <refsect1> <title>Implemented Interfaces</title> <para> SoupMultipartInputStream implements GPollableInputStream.</para> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>This adds support for the multipart responses. For handling the multiple parts the user needs to wrap the <type>GInputStream</type> obtained by sending the request with a <type>SoupMultipartInputStream</type> and use <function>soup_multipart_input_stream_next_part()</function> before reading. Responses which are not wrapped will be treated like non-multipart responses.</para> <para>Note that although <type>SoupMultipartInputStream</type> is a <type>GInputStream</type>, you should not read directly from it, and the results are undefined if you do.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_multipart_input_stream_new ()</title> <programlisting><returnvalue>SoupMultipartInputStream</returnvalue> * soup_multipart_input_stream_new (<parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GInputStream</type> *base_stream</parameter>);</programlisting> <para>Creates a new <type>SoupMultipartInputStream</type> that wraps the <type>GInputStream</type> obtained by sending the <type>SoupMessage</type>. Reads should not be done directly through this object, use the input streams returned by <function>soup_multipart_input_stream_next_part()</function> or its async counterpart instead.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>msg</para></entry> <entry><para>the <type>SoupMessage</type> the response is related to.</para></entry> <entry></entry></row> <row><entry><para>base_stream</para></entry> <entry><para>the <type>GInputStream</type> returned by sending the request.</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> a new <type>SoupMultipartInputStream</type></para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_input_stream_get_headers ()</title> <programlisting><returnvalue>SoupMessageHeaders</returnvalue> * soup_multipart_input_stream_get_headers (<parameter><type>SoupMultipartInputStream</type> *multipart</parameter>);</programlisting> <para>Obtains the headers for the part currently being processed. Note that the <type>SoupMessageHeaders</type> that are returned are owned by the <type>SoupMultipartInputStream</type> and will be replaced when a call is made to <function>soup_multipart_input_stream_next_part()</function> or its async counterpart, so if keeping the headers is required, a copy must be made.</para> <para>Note that if a part had no headers at all an empty <type>SoupMessageHeaders</type> will be returned.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipartInputStream</type>.</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>SoupMessageHeaders</type> containing the headers for the part currently being processed or <literal>NULL</literal> if the headers failed to parse. </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_input_stream_next_part ()</title> <programlisting><returnvalue>GInputStream</returnvalue> * soup_multipart_input_stream_next_part (<parameter><type>SoupMultipartInputStream</type> *multipart</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Obtains an input stream for the next part. When dealing with a multipart response the input stream needs to be wrapped in a <type>SoupMultipartInputStream</type> and this function or its async counterpart need to be called to obtain the first part for reading.</para> <para>After calling this function, <function>soup_multipart_input_stream_get_headers()</function> 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>the <type>SoupMultipartInputStream</type></para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type></para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>a <type>GError</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a new <type>GInputStream</type>, or <literal>NULL</literal> if there are no more parts. </para> <para><emphasis>[nullable][transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_multipart_input_stream_next_part_async ()</title> <programlisting><returnvalue>void</returnvalue> soup_multipart_input_stream_next_part_async (<parameter><type>SoupMultipartInputStream</type> *multipart</parameter>, <parameter><type>int</type> io_priority</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GAsyncReadyCallback</type> callback</parameter>, <parameter><type>gpointer</type> data</parameter>);</programlisting> <para>Obtains a <type>GInputStream</type> for the next request. See <function>soup_multipart_input_stream_next_part()</function> for details on the workflow.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>the <type>SoupMultipartInputStream</type>.</para></entry> <entry></entry></row> <row><entry><para>io_priority</para></entry> <entry><para>the I/O priority for the request.</para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>.</para></entry> <entry></entry></row> <row><entry><para>callback</para></entry> <entry><para>callback to call when request is satisfied.</para></entry> <entry></entry></row> <row><entry><para>data</para></entry> <entry><para>data for <parameter>callback</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_multipart_input_stream_next_part_finish ()</title> <programlisting><returnvalue>GInputStream</returnvalue> * soup_multipart_input_stream_next_part_finish (<parameter><type>SoupMultipartInputStream</type> *multipart</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Finishes an asynchronous request for the next part.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>multipart</para></entry> <entry><para>a <type>SoupMultipartInputStream</type>.</para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>a <type>GAsyncResult</type>.</para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>a <type>GError</type> location to store any error, or <literal>NULL</literal> to ignore.</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a newly created <type>GInputStream</type> for reading the next part or <literal>NULL</literal> if there are no more parts. </para> <para><emphasis>[nullable][transfer full]</emphasis></para> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupMultipartInputStream</title> <programlisting>typedef struct _SoupMultipartInputStream SoupMultipartInputStream;</programlisting> <para>Class for handling streams of multipart messages.</para> </refsect2> </refsect1> <refsect1> <title>Property Details</title> <refsect2><title>The <literal>“message”</literal> property</title> <programlisting> “message” <type>SoupMessage</type> *</programlisting> <para>The SoupMessage.</para><para>Owner: SoupMultipartInputStream</para> <para>Flags: Read / Write / Construct Only</para> </refsect2> </refsect1> </refentry>
<refentry> <refmeta> <refentrytitle>SoupSession</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupSession</refentrytitle>

<refname>SoupSession</refname> <refpurpose>Soup session state object</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>SoupSession</returnvalue> * </entry><entry>soup_session_new <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupSession</returnvalue> * </entry><entry>soup_session_new_with_options <phrase>()</phrase></entry></row> <row><entry><returnvalue>GInetSocketAddress</returnvalue> * </entry><entry>soup_session_get_local_address <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_session_get_max_conns <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_session_get_max_conns_per_host <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_proxy_resolver <phrase>()</phrase></entry></row> <row><entry><returnvalue>GProxyResolver</returnvalue> * </entry><entry>soup_session_get_proxy_resolver <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_tls_database <phrase>()</phrase></entry></row> <row><entry><returnvalue>GTlsDatabase</returnvalue> * </entry><entry>soup_session_get_tls_database <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_tls_interaction <phrase>()</phrase></entry></row> <row><entry><returnvalue>GTlsInteraction</returnvalue> * </entry><entry>soup_session_get_tls_interaction <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_timeout <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_session_get_timeout <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_idle_timeout <phrase>()</phrase></entry></row> <row><entry><returnvalue>guint</returnvalue> </entry><entry>soup_session_get_idle_timeout <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_user_agent <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_session_get_user_agent <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_accept_language <phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_session_get_accept_language <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_set_accept_language_auto <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_session_get_accept_language_auto <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupMessage</returnvalue> * </entry><entry>soup_session_get_async_result_message <phrase>()</phrase></entry></row> <row><entry><returnvalue>GSocketConnectable</returnvalue> * </entry><entry>soup_session_get_remote_connectable <phrase>()</phrase></entry></row> <row><entry><returnvalue>GInputStream</returnvalue> * </entry><entry>soup_session_send <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_send_async <phrase>()</phrase></entry></row> <row><entry><returnvalue>GInputStream</returnvalue> * </entry><entry>soup_session_send_finish <phrase>()</phrase></entry></row> <row><entry><returnvalue>GBytes</returnvalue> * </entry><entry>soup_session_send_and_read <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_send_and_read_async <phrase>()</phrase></entry></row> <row><entry><returnvalue>GBytes</returnvalue> * </entry><entry>soup_session_send_and_read_finish <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_websocket_connect_async <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupWebsocketConnection</returnvalue> * </entry><entry>soup_session_websocket_connect_finish <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_abort <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_add_feature <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_add_feature_by_type <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_remove_feature <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_remove_feature_by_type <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupSessionFeature</returnvalue> * </entry><entry>soup_session_get_feature <phrase>()</phrase></entry></row> <row><entry><returnvalue>SoupSessionFeature</returnvalue> * </entry><entry>soup_session_get_feature_for_message <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_session_has_feature <phrase>()</phrase></entry></row> <row><entry><returnvalue>void</returnvalue> </entry><entry>soup_session_preconnect_async <phrase>()</phrase></entry></row> <row><entry><returnvalue>gboolean</returnvalue> </entry><entry>soup_session_preconnect_finish <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Properties</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><type>char</type> *</entry><entry>accept-language</entry><entry>Read / Write</entry></row> <row><entry><type>gboolean</type></entry><entry>accept-language-auto</entry><entry>Read / Write</entry></row> <row><entry><type>guint</type></entry><entry>idle-timeout</entry><entry>Read / Write</entry></row> <row><entry><type>GInetSocketAddress</type> *</entry><entry>local-address</entry><entry>Read / Write / Construct Only</entry></row> <row><entry><type>int</type></entry><entry>max-conns</entry><entry>Read / Write / Construct Only</entry></row> <row><entry><type>int</type></entry><entry>max-conns-per-host</entry><entry>Read / Write / Construct Only</entry></row> <row><entry><type>GProxyResolver</type> *</entry><entry>proxy-resolver</entry><entry>Read / Write</entry></row> <row><entry><type>GSocketConnectable</type> *</entry><entry>remote-connectable</entry><entry>Read / Write / Construct Only</entry></row> <row><entry><type>guint</type></entry><entry>timeout</entry><entry>Read / Write</entry></row> <row><entry><type>GTlsDatabase</type> *</entry><entry>tls-database</entry><entry>Read / Write</entry></row> <row><entry><type>GTlsInteraction</type> *</entry><entry>tls-interaction</entry><entry>Read / Write</entry></row> <row><entry><type>char</type> *</entry><entry>user-agent</entry><entry>Read / Write</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Signals</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><returnvalue>void</returnvalue></entry><entry>request-queued</entry><entry>Run Last</entry></row> <row><entry><returnvalue>void</returnvalue></entry><entry>request-unqueued</entry><entry>Run Last</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry></entry><entry>SoupSession</entry></row> <row><entry>enum</entry><entry>SoupSessionError</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Object Hierarchy</title> <screen> GObject <phrase>╰──</phrase> SoupSession </screen> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para><type>SoupSession</type> is the object that controls client-side HTTP. A <type>SoupSession</type> 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.</para> <para>Most applications will only need a single <type>SoupSession</type>; 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 <type>SoupMessage</type> 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.)</para> <para>Additional <type>SoupSession</type> functionality is provided by <type>SoupSessionFeature</type> objects, which can be added to a session with <function>soup_session_add_feature()</function> or <function>soup_session_add_feature_by_type()</function> For example, <type>SoupLogger</type> provides support for logging HTTP traffic, <type>SoupContentDecoder</type> provides support for compressed response handling, and <type>SoupContentSniffer</type> provides support for HTML5-style response body content sniffing. Additionally, subtypes of <type>SoupAuth</type> can be added as features, to add support for additional authentication types.</para> <para>All <type>SoupSessions</type> are created with a <type>SoupAuthManager</type>, and support for <literal>SOUP_TYPE_AUTH_BASIC</literal> and <literal>SOUP_TYPE_AUTH_DIGEST</literal>. Additionally, sessions using the plain <type>SoupSession</type> class (rather than one of its deprecated subtypes) have a <type>SoupContentDecoder</type> by default.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>soup_session_new ()</title> <programlisting><returnvalue>SoupSession</returnvalue> * soup_session_new (<parameter><type>void</type></parameter>);</programlisting> <para>Creates a <type>SoupSession</type> with the default options.</para> <refsect3> <title>Returns</title> <para> the new session.</para> </refsect3></refsect2>
<refsect2> <title>soup_session_new_with_options ()</title> <programlisting><returnvalue>SoupSession</returnvalue> * soup_session_new_with_options (<parameter>const <type>char</type> *optname1</parameter>, <parameter>...</parameter>);</programlisting> <para>Creates a <type>SoupSession</type> with the specified options.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>optname1</para></entry> <entry><para>name of first property to set</para></entry> <entry></entry></row> <row><entry><para>...</para></entry> <entry><para>value of <parameter>optname1</parameter> , followed by additional property/value pairs</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the new session.</para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_local_address ()</title> <programlisting><returnvalue>GInetSocketAddress</returnvalue> * soup_session_get_local_address (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the <type>GInetSocketAddress</type> to use for the client side of connections in <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GInetSocketAddress</type> or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_max_conns ()</title> <programlisting><returnvalue>guint</returnvalue> soup_session_get_max_conns (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the maximum number of connections that <parameter>session</parameter> can open at once.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the maximum number of connections</para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_max_conns_per_host ()</title> <programlisting><returnvalue>guint</returnvalue> soup_session_get_max_conns_per_host (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the maximum number of connections that <parameter>session</parameter> can open at once to a given host.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the maximum number of connections per host</para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_proxy_resolver ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_proxy_resolver (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GProxyResolver</type> *proxy_resolver</parameter>);</programlisting> <para>Set a <type>GProxyResolver</type> to be used by <parameter>session</parameter> on new connections. If <parameter>proxy_resolver</parameter> is <literal>NULL</literal> then no proxies will be used. See <type>“proxy-resolver”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>proxy_resolver</para></entry> <entry><para>a <type>GProxyResolver</type> or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_proxy_resolver ()</title> <programlisting><returnvalue>GProxyResolver</returnvalue> * soup_session_get_proxy_resolver (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the <type>GProxyResolver</type> currently used by <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GProxyResolver</type> or <literal>NULL</literal> if proxies are disabled in <parameter>session</parameter> . </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_tls_database ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_tls_database (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GTlsDatabase</type> *tls_database</parameter>);</programlisting> <para>Set a <type>GTlsDatabase</type> to be used by <parameter>session</parameter> on new connections. If <parameter>tls_database</parameter> is <literal>NULL</literal> then certificate validation will always fail. See <type>“tls-database”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>tls_database</para></entry> <entry><para>a <type>GTlsDatabase</type> or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_tls_database ()</title> <programlisting><returnvalue>GTlsDatabase</returnvalue> * soup_session_get_tls_database (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the <type>GTlsDatabase</type> currently used by <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GTlsDatabase</type> or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_tls_interaction ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_tls_interaction (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GTlsInteraction</type> *tls_interaction</parameter>);</programlisting> <para>Set a <type>GTlsInteraction</type> to be used by <parameter>session</parameter> on new connections. If <parameter>tls_interaction</parameter> is <literal>NULL</literal> then client certificate validation will always fail. See <type>“tls-interaction”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>tls_interaction</para></entry> <entry><para>a <type>GTlsInteraction</type> or <literal>NULL</literal>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_tls_interaction ()</title> <programlisting><returnvalue>GTlsInteraction</returnvalue> * soup_session_get_tls_interaction (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the <type>GTlsInteraction</type> currently used by <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GTlsInteraction</type> or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_timeout ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_timeout (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>guint</type> timeout</parameter>);</programlisting> <para>Set a timeout in seconds for socket I/O operations to be used by <parameter>session</parameter> on new connections. See <type>“timeout”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>timeout</para></entry> <entry><para>a timeout in seconds</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_timeout ()</title> <programlisting><returnvalue>guint</returnvalue> soup_session_get_timeout (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the timeout in seconds for socket I/O operations currently used by <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the timeout in seconds</para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_idle_timeout ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_idle_timeout (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>guint</type> timeout</parameter>);</programlisting> <para>Set a timeout in seconds for idle connection lifetime to be used by <parameter>session</parameter> on new connections. See <type>“idle-timeout”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>timeout</para></entry> <entry><para>a timeout in seconds</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_idle_timeout ()</title> <programlisting><returnvalue>guint</returnvalue> soup_session_get_idle_timeout (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the timeout in seconds for idle connection lifetime currently used by <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the timeout in seconds</para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_user_agent ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_user_agent (<parameter><type>SoupSession</type> *session</parameter>, <parameter>const <type>char</type> *user_agent</parameter>);</programlisting> <para>Set the value to use for the "User-Agent" header on <type>SoupMessage</type>s sent from <parameter>session</parameter> . If <parameter>user_agent</parameter> has trailing whitespace, <parameter>session</parameter> will append its own product token (eg, "<literal>libsoup/3.0.0</literal>") to the end of the header for you. If <parameter>user_agent</parameter> is <literal>NULL</literal> then no "User-Agent" will be included in requests. See <type>“user-agent”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>user_agent</para></entry> <entry><para>the user agent string</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_user_agent ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_session_get_user_agent (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the value used by <parameter>session</parameter> for the "User-Agent" header on new requests.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the user agent string or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_accept_language ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_accept_language (<parameter><type>SoupSession</type> *session</parameter>, <parameter>const <type>char</type> *accept_language</parameter>);</programlisting> <para>Set the value to use for the "Accept-Language" header on <type>SoupMessage</type>s sent from <parameter>session</parameter> . If <parameter>accept_language</parameter> is <literal>NULL</literal> then no "Accept-Language" will be included in requests. See <type>“accept-language”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>accept_language</para></entry> <entry><para>the languages string</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_accept_language ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_session_get_accept_language (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the value used by <parameter>session</parameter> for the "Accept-Language" header on new requests.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the accept language string or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_set_accept_language_auto ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_set_accept_language_auto (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>gboolean</type> accept_language_auto</parameter>);</programlisting> <para>Set whether <parameter>session</parameter> will automatically set the "Accept-Language" header on requests using a value generated from system languages based on <function>g_get_language_names()</function>. See <type>“accept-language-auto”</type> for more information.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>accept_language_auto</para></entry> <entry><para>the value to set</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_accept_language_auto ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_session_get_accept_language_auto (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get whether <parameter>session</parameter> automatically sets the "Accept-Language" header on new requests.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if <parameter>session</parameter> sets "Accept-Language" header automatically, or <literal>FALSE</literal> otherwise.</para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_async_result_message ()</title> <programlisting><returnvalue>SoupMessage</returnvalue> * soup_session_get_async_result_message (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>);</programlisting> <para>Gets the <type>SoupMessage</type> of the <parameter>result</parameter> asynchronous operation This is useful to get the <type>SoupMessage</type> of an asynchronous operation started by <parameter>session</parameter> from its <type>GAsyncReadyCallback</type>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>the <type>GAsyncResult</type> passed to your callback</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>SoupMessage</type> or <literal>NULL</literal> if <parameter>result</parameter> is not a valid <parameter>session</parameter> async operation result. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_remote_connectable ()</title> <programlisting><returnvalue>GSocketConnectable</returnvalue> * soup_session_get_remote_connectable (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Get the remote connectable if one set.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>the <type>GSocketConnectable</type> or <literal>NULL</literal>. </para> <para><emphasis>[transfer none][nullable]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_send ()</title> <programlisting><returnvalue>GInputStream</returnvalue> * soup_session_send (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Synchronously sends <parameter>msg</parameter> and waits for the beginning of a response. On success, a <type>GInputStream</type> 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.)</para> <para>If non-<literal>NULL</literal>, <parameter>cancellable</parameter> can be used to cancel the request; <function>soup_session_send()</function> will return a <literal>G_IO_ERROR_CANCELLED</literal> error. Note that with requests that have side effects (eg, <literal>POST</literal>, <literal>PUT</literal>, <literal>DELETE</literal>) 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.</para> <para>If <parameter>msg</parameter> is requeued due to a redirect or authentication, the initial (3xx/401/407) response body will be suppressed, and <function>soup_session_send()</function> will only return once a final response has been received.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type>. </para></entry> <entry><emphasis>[transfer none]</emphasis></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GInputStream</type> for reading the response body, or <literal>NULL</literal> on error. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_send_async ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_send_async (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>int</type> io_priority</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GAsyncReadyCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Asynchronously sends <parameter>msg</parameter> and waits for the beginning of a response. When <parameter>callback</parameter> is called, then either <parameter>msg</parameter> has been sent, and its response headers received, or else an error has occurred. Call <function>soup_session_send_finish()</function> to get a <type>GInputStream</type> for reading the response body.</para> <para>See <function>soup_session_send()</function> for more details on the general semantics.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type>. </para></entry> <entry><emphasis>[transfer none]</emphasis></entry></row> <row><entry><para>io_priority</para></entry> <entry><para>the I/O priority of the request</para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>callback</para></entry> <entry><para>the callback to invoke. </para></entry> <entry><emphasis>[scope async]</emphasis></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data for <parameter>callback</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_send_finish ()</title> <programlisting><returnvalue>GInputStream</returnvalue> * soup_session_send_finish (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Gets the response to a <function>soup_session_send_async()</function> call and (if successful), returns a <type>GInputStream</type> that can be used to read the response body.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>the <type>GAsyncResult</type> passed to your callback</para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GInputStream</type> for reading the response body, or <literal>NULL</literal> on error. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_send_and_read ()</title> <programlisting><returnvalue>GBytes</returnvalue> * soup_session_send_and_read (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Synchronously sends <parameter>msg</parameter> and reads the response body. On success, a <type>GBytes</type> 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.</para> <para>See <function>soup_session_send()</function> for more details on the general semantics.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type>. </para></entry> <entry><emphasis>[transfer none]</emphasis></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GBytes</type>, or <literal>NULL</literal> on error. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_send_and_read_async ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_send_and_read_async (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>int</type> io_priority</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GAsyncReadyCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Asynchronously sends <parameter>msg</parameter> and reads the response body. When <parameter>callback</parameter> is called, then either <parameter>msg</parameter> 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 <function>soup_session_send_and_read_finish()</function> to get a <type>GBytes</type> with the response body.</para> <para>See <function>soup_session_send()</function> for more details on the general semantics.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type>. </para></entry> <entry><emphasis>[transfer none]</emphasis></entry></row> <row><entry><para>io_priority</para></entry> <entry><para>the I/O priority of the request</para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>callback</para></entry> <entry><para>the callback to invoke. </para></entry> <entry><emphasis>[scope async]</emphasis></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data for <parameter>callback</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_send_and_read_finish ()</title> <programlisting><returnvalue>GBytes</returnvalue> * soup_session_send_and_read_finish (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Gets the response to a <function>soup_session_send_and_read_async()</function> call and (if successful), returns a <type>GBytes</type> with the response body.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>the <type>GAsyncResult</type> passed to your callback</para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>GBytes</type>, or <literal>NULL</literal> on error. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_websocket_connect_async ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_websocket_connect_async (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter>const <type>char</type> *origin</parameter>, <parameter><type>char</type> **protocols</parameter>, <parameter><type>int</type> io_priority</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GAsyncReadyCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Asynchronously creates a <type>SoupWebsocketConnection</type> to communicate with a remote server.</para> <para>All necessary WebSocket-related headers will be added to <parameter>msg</parameter> , and it will then be sent and asynchronously processed normally (including handling of redirection and HTTP authentication).</para> <para>If the server returns "101 Switching Protocols", then <parameter>msg</parameter> 's status code and response headers will be updated, and then the WebSocket handshake will be completed. On success, <function>soup_session_websocket_connect_finish()</function> will return a new <type>SoupWebsocketConnection</type>. On failure it will return a <type>GError</type>.</para> <para>If the server returns a status other than "101 Switching Protocols", then <parameter>msg</parameter> will contain the complete response headers and body from the server's response, and <function>soup_session_websocket_connect_finish()</function> will return <literal>SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET</literal>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para><type>SoupMessage</type> indicating the WebSocket server to connect to</para></entry> <entry></entry></row> <row><entry><para>origin</para></entry> <entry><para>origin of the connection. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>protocols</para></entry> <entry><para>a <literal>NULL</literal>-terminated array of protocols supported. </para></entry> <entry><emphasis>[nullable][array zero-terminated=1]</emphasis></entry></row> <row><entry><para>io_priority</para></entry> <entry><para>the I/O priority of the request</para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>callback</para></entry> <entry><para>the callback to invoke. </para></entry> <entry><emphasis>[scope async]</emphasis></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data for <parameter>callback</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_websocket_connect_finish ()</title> <programlisting><returnvalue>SoupWebsocketConnection</returnvalue> * soup_session_websocket_connect_finish (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Gets the <type>SoupWebsocketConnection</type> response to a <function>soup_session_websocket_connect_async()</function> call and (if successful), returns a <type>SoupWebsocketConnection</type> that can be used to communicate with the server.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>the <type>GAsyncResult</type> passed to your callback</para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a new <type>SoupWebsocketConnection</type>, or <literal>NULL</literal> on error. </para> <para><emphasis>[transfer full]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_abort ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_abort (<parameter><type>SoupSession</type> *session</parameter>);</programlisting> <para>Cancels all pending requests in <parameter>session</parameter> and closes all idle persistent connections.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>the session</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_add_feature ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_add_feature (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupSessionFeature</type> *feature</parameter>);</programlisting> <para>Adds <parameter>feature</parameter> 's functionality to <parameter>session</parameter> . You cannot add multiple features of the same <type>GType</type> to a session.</para> <para>See the main <type>SoupSession</type> documentation for information on what features are present in sessions by default.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature</para></entry> <entry><para>an object that implements <type>SoupSessionFeature</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_add_feature_by_type ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_add_feature_by_type (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>If <parameter>feature_type</parameter> is the type of a class that implements <type>SoupSessionFeature</type>, this creates a new feature of that type and adds it to <parameter>session</parameter> as with <function>soup_session_add_feature()</function>. You can use this when you don't need to customize the new feature in any way. Adding multiple features of the same <parameter>feature_type</parameter> is not allowed.</para> <para>If <parameter>feature_type</parameter> is not a <type>SoupSessionFeature</type> type, this gives each existing feature on <parameter>session</parameter> the chance to accept <parameter>feature_type</parameter> as a "subfeature". This can be used to add new <type>SoupAuth</type> types, for instance.</para> <para>See the main <type>SoupSession</type> documentation for information on what features are present in sessions by default.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>a <type>GType</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_remove_feature ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_remove_feature (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupSessionFeature</type> *feature</parameter>);</programlisting> <para>Removes <parameter>feature</parameter> 's functionality from <parameter>session</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature</para></entry> <entry><para>a feature that has previously been added to <parameter>session</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_remove_feature_by_type ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_remove_feature_by_type (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>Removes all features of type <parameter>feature_type</parameter> (or any subclass of <parameter>feature_type</parameter> ) from <parameter>session</parameter> . You can also remove standard features from the session at construct time by using the SoupSession:remove-feature-by-type property.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>a <type>GType</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_get_feature ()</title> <programlisting><returnvalue>SoupSessionFeature</returnvalue> * soup_session_get_feature (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>Gets the feature in <parameter>session</parameter> of type <parameter>feature_type</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>the <type>GType</type> of the feature to get</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>SoupSessionFeature</type>, or <literal>NULL</literal>. The feature is owned by <parameter>session</parameter> . </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_get_feature_for_message ()</title> <programlisting><returnvalue>SoupSessionFeature</returnvalue> * soup_session_get_feature_for_message (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GType</type> feature_type</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>);</programlisting> <para>Gets the feature in <parameter>session</parameter> of type <parameter>feature_type</parameter> , provided that it is not disabled for <parameter>msg</parameter> .</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>the <type>GType</type> of the feature to get</para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para>a <type>SoupSessionFeature</type>, or <literal>NULL</literal>. The feature is owned by <parameter>session</parameter> . </para> <para><emphasis>[nullable][transfer none]</emphasis></para> </refsect3></refsect2>
<refsect2> <title>soup_session_has_feature ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_session_has_feature (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GType</type> feature_type</parameter>);</programlisting> <para>Tests if <parameter>session</parameter> has at a feature of type <parameter>feature_type</parameter> (which can be the type of either a <type>SoupSessionFeature</type>, or else a subtype of some class managed by another feature, such as <type>SoupAuth</type>).</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>feature_type</para></entry> <entry><para>the <type>GType</type> of the class of features to check for</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>soup_session_preconnect_async ()</title> <programlisting><returnvalue>void</returnvalue> soup_session_preconnect_async (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>SoupMessage</type> *msg</parameter>, <parameter><type>int</type> io_priority</parameter>, <parameter><type>GCancellable</type> *cancellable</parameter>, <parameter><type>GAsyncReadyCallback</type> callback</parameter>, <parameter><type>gpointer</type> user_data</parameter>);</programlisting> <para>Start a preconnection to <parameter>msg</parameter> . 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 <parameter>msg</parameter> host, the operation finishes successfully without creating a new connection. If a new request for the given <parameter>msg</parameter> 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).</para> <para>The operation finishes when the connection is done or an error occurred.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>a <type>SoupMessage</type></para></entry> <entry></entry></row> <row><entry><para>io_priority</para></entry> <entry><para>the I/O priority of the request</para></entry> <entry></entry></row> <row><entry><para>cancellable</para></entry> <entry><para>a <type>GCancellable</type>. </para></entry> <entry><emphasis>[nullable]</emphasis></entry></row> <row><entry><para>callback</para></entry> <entry><para>the callback to invoke when the operation finishes. </para></entry> <entry><emphasis>[nullable][scope async]</emphasis></entry></row> <row><entry><para>user_data</para></entry> <entry><para>data for <parameter>progress_callback</parameter> and <parameter>callback</parameter> </para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3></refsect2>
<refsect2> <title>soup_session_preconnect_finish ()</title> <programlisting><returnvalue>gboolean</returnvalue> soup_session_preconnect_finish (<parameter><type>SoupSession</type> *session</parameter>, <parameter><type>GAsyncResult</type> *result</parameter>, <parameter><type>GError</type> **error</parameter>);</programlisting> <para>Complete a preconnect async operation started with <function>soup_session_preconnect_async()</function>.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>a <type>SoupSession</type></para></entry> <entry></entry></row> <row><entry><para>result</para></entry> <entry><para>the <type>GAsyncResult</type> passed to your callback</para></entry> <entry></entry></row> <row><entry><para>error</para></entry> <entry><para>return location for a <type>GError</type>, or <literal>NULL</literal></para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> if the preconnect succeeded, or <literal>FALSE</literal> in case of error.</para> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>SoupSession</title> <programlisting>typedef struct _SoupSession SoupSession;</programlisting> <para>Class managing options and state for <type>SoupMessage</type>s.</para> </refsect2>
<refsect2> <title>enum SoupSessionError</title> <para>A <type>SoupSession</type> error.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_SESSION_ERROR_PARSING</para></entry> <entry><para>the server's response could not be parsed</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_ENCODING</para></entry> <entry><para>the server's response was in an unsupported format</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS</para></entry> <entry><para>the message has been redirected too many times</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_TOO_MANY_RESTARTS</para></entry> <entry><para>the message has been restarted too many times</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION</para></entry> <entry><para>failed to redirect message because Location header was missing or empty in response</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_REDIRECT_BAD_URI</para></entry> <entry><para>failed to redirect message because Location header contains an invalid URI</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE</para></entry> <entry><para>the message is already in the session queue. Messages can only be reused after unqueued.</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1>
<refsect1> <title>Property Details</title> <refsect2><title>The <literal>“accept-language”</literal> property</title> <programlisting> “accept-language” <type>char</type> *</programlisting> <para>If non-<literal>NULL</literal>, the value to use for the "Accept-Language" header on <type>SoupMessage</type>s sent from this session.</para> <para>Setting this will disable <type>“accept-language-auto”</type>.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> <para>Default value: NULL</para> </refsect2>
<refsect2><title>The <literal>“accept-language-auto”</literal> property</title> <programlisting> “accept-language-auto” <type>gboolean</type></programlisting> <para>If <literal>TRUE</literal>, <type>SoupSession</type> will automatically set the string for the "Accept-Language" header on every <type>SoupMessage</type> sent, based on the return value of <function>g_get_language_names()</function>.</para> <para>Setting this will override any previous value of <type>“accept-language”</type>.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> <para>Default value: FALSE</para> </refsect2>
<refsect2><title>The <literal>“idle-timeout”</literal> property</title> <programlisting> “idle-timeout” <type>guint</type></programlisting> <para>Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed.</para> <para>Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call <function>soup_session_abort()</function> after setting this if you want to ensure that all future connections will have this timeout value.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> <para>Default value: 60</para> </refsect2>
<refsect2><title>The <literal>“local-address”</literal> property</title> <programlisting> “local-address” <type>GInetSocketAddress</type> *</programlisting> <para>Sets the <type>GInetSocketAddress</type> to use for the client side of the connection.</para> <para>Use this property if you want for instance to bind the local socket to a specific IP address.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write / Construct Only</para> </refsect2>
<refsect2><title>The <literal>“max-conns”</literal> property</title> <programlisting> “max-conns” <type>int</type></programlisting> <para>The maximum number of connections that the session can open at once.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write / Construct Only</para> <para>Allowed values: >= 1</para> <para>Default value: 10</para> </refsect2>
<refsect2><title>The <literal>“max-conns-per-host”</literal> property</title> <programlisting> “max-conns-per-host” <type>int</type></programlisting> <para>The maximum number of connections that the session can open at once to a given host.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write / Construct Only</para> <para>Allowed values: >= 1</para> <para>Default value: 2</para> </refsect2>
<refsect2><title>The <literal>“proxy-resolver”</literal> property</title> <programlisting> “proxy-resolver” <type>GProxyResolver</type> *</programlisting> <para>A <type>GProxyResolver</type> to use with this session.</para> <para>If no proxy resolver is set, then the default proxy resolver will be used. See <function>g_proxy_resolver_get_default()</function>. You can set it to <literal>NULL</literal> if you don't want to use proxies, or set it to your own <type>GProxyResolver</type> if you want to control what proxies get used.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“remote-connectable”</literal> property</title> <programlisting> “remote-connectable” <type>GSocketConnectable</type> *</programlisting> <para>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.</para> <para>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 <type>GUnixSocketAddress</type> can be passed to this function.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write / Construct Only</para> </refsect2>
<refsect2><title>The <literal>“timeout”</literal> property</title> <programlisting> “timeout” <type>guint</type></programlisting> <para>The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request).</para> <para>Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call <function>soup_session_abort()</function> after setting this if you want to ensure that all future connections will have this timeout value.</para> <para>Not to be confused with <type>“idle-timeout”</type> (which is the length of time that idle persistent connections will be kept open).</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> <para>Default value: 0</para> </refsect2>
<refsect2><title>The <literal>“tls-database”</literal> property</title> <programlisting> “tls-database” <type>GTlsDatabase</type> *</programlisting> <para>Sets the <type>GTlsDatabase</type> to use for validating SSL/TLS certificates.</para> <para>If no certificate database is set, then the default database will be used. See <function>g_tls_backend_get_default_database()</function>.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“tls-interaction”</literal> property</title> <programlisting> “tls-interaction” <type>GTlsInteraction</type> *</programlisting> <para>A <type>GTlsInteraction</type> object that will be passed on to any <type>GTlsConnections</type> created by the session. (This can be used to provide client-side certificates, for example.)</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> </refsect2>
<refsect2><title>The <literal>“user-agent”</literal> property</title> <programlisting> “user-agent” <type>char</type> *</programlisting> <para>If non-<literal>NULL</literal>, the value to use for the "User-Agent" header on <type>SoupMessage</type>s sent from this session.</para> <para>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."</para> <para>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.</para> <para>If you set a <type>“user_agent”</type> property that has trailing whitespace, <type>SoupSession</type> will append its own product token (eg, "<literal>libsoup/2.3.2</literal>") to the end of the header for you.</para> <para>Owner: SoupSession</para> <para>Flags: Read / Write</para> <para>Default value: NULL</para> </refsect2> </refsect1>
<refsect1> <title>Signal Details</title> <refsect2><title>The <literal>“request-queued”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupSession</type> *session, <type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted when a request is queued on <parameter>session</parameter> .</para> <para>When sending a request, first <type>“request_queued”</type> is emitted, indicating that the session has become aware of the request.</para> <para>After a connection is available to send the request various <type>SoupMessage</type> signals are emitted as the message is processed. If the message is requeued, it will emit <type>“restarted”</type>, which will then be followed by other <type>SoupMessage</type> signals when the message is re-sent.</para> <para>Eventually, the message will emit <type>“finished”</type>. 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.</para> <para>Eventually, a message will reach "finished" and not be requeued. At that point, the session will emit <type>“request_unqueued”</type> to indicate that it is done with the message.</para> <para>To sum up: <type>“request_queued”</type> and <type>“request_unqueued”</type> are guaranteed to be emitted exactly once, but <type>“finished”</type> (and all of the other <type>SoupMessage</type> signals) may be invoked multiple times for a given message.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>the session</para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>the request that was queued</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run Last</para> </refsect2>
<refsect2><title>The <literal>“request-unqueued”</literal> signal</title> <programlisting><returnvalue>void</returnvalue> user_function (<type>SoupSession</type> *session, <type>SoupMessage</type> *msg, <type>gpointer</type> user_data)</programlisting> <para>Emitted when a request is removed from <parameter>session</parameter> 's queue, indicating that <parameter>session</parameter> is done with it. See <type>“request_queued”</type> for a detailed description of the message lifecycle within a session.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>session</para></entry> <entry><para>the session</para></entry> <entry></entry></row> <row><entry><para>msg</para></entry> <entry><para>the request that was unqueued</para></entry> <entry></entry></row> <row><entry><simpara>user_data</simpara></entry> <entry><simpara>user data set when the signal handler was connected.</simpara></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><para>Flags: Run Last</para> </refsect2> </refsect1>
</refentry>
<refentry> <refmeta> <refentrytitle>SoupStatus</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBSOUP-3.0 Library</refmiscinfo> </refmeta>

<refentrytitle>SoupStatus</refentrytitle>

<refname>SoupStatus</refname> <refpurpose>HTTP (and libsoup) status codes</refpurpose>

<refsect1> <title>Functions</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry>#define</entry><entry>SOUP_STATUS_IS_INFORMATIONAL<phrase>()</phrase></entry></row> <row><entry>#define</entry><entry>SOUP_STATUS_IS_SUCCESSFUL<phrase>()</phrase></entry></row> <row><entry>#define</entry><entry>SOUP_STATUS_IS_REDIRECTION<phrase>()</phrase></entry></row> <row><entry>#define</entry><entry>SOUP_STATUS_IS_CLIENT_ERROR<phrase>()</phrase></entry></row> <row><entry>#define</entry><entry>SOUP_STATUS_IS_SERVER_ERROR<phrase>()</phrase></entry></row> <row><entry>const <returnvalue>char</returnvalue> * </entry><entry>soup_status_get_phrase <phrase>()</phrase></entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1> <title>Types and Values</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <tbody> <row><entry>enum</entry><entry>SoupStatus</entry></row> </tbody> </tgroup> </informaltable> </refsect1> <refsect1><title>Includes</title><synopsis>#include <libsoup/soup.h> </synopsis></refsect1> <refsect1> <title>Description</title> <para>HTTP (and libsoup) status codes.</para> </refsect1> <refsect1> <title>Functions</title> <refsect2> <title>SOUP_STATUS_IS_INFORMATIONAL()</title> <programlisting>#define SOUP_STATUS_IS_INFORMATIONAL(status) ((status) >= 100 && (status) < 200) </programlisting> <para>Tests if <parameter>status</parameter> is an Informational (1xx) response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>SOUP_STATUS_IS_SUCCESSFUL()</title> <programlisting>#define SOUP_STATUS_IS_SUCCESSFUL(status) ((status) >= 200 && (status) < 300) </programlisting> <para>Tests if <parameter>status</parameter> is a Successful (2xx) response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>SOUP_STATUS_IS_REDIRECTION()</title> <programlisting>#define SOUP_STATUS_IS_REDIRECTION(status) ((status) >= 300 && (status) < 400) </programlisting> <para>Tests if <parameter>status</parameter> is a Redirection (3xx) response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>SOUP_STATUS_IS_CLIENT_ERROR()</title> <programlisting>#define SOUP_STATUS_IS_CLIENT_ERROR(status) ((status) >= 400 && (status) < 500) </programlisting> <para>Tests if <parameter>status</parameter> is a Client Error (4xx) response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>SOUP_STATUS_IS_SERVER_ERROR()</title> <programlisting>#define SOUP_STATUS_IS_SERVER_ERROR(status) ((status) >= 500 && (status) < 600) </programlisting> <para>Tests if <parameter>status</parameter> is a Server Error (5xx) response.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> <literal>TRUE</literal> or <literal>FALSE</literal></para> </refsect3></refsect2>
<refsect2> <title>soup_status_get_phrase ()</title> <programlisting>const <returnvalue>char</returnvalue> * soup_status_get_phrase (<parameter><type>guint</type> status_code</parameter>);</programlisting> <para>Looks up the stock HTTP description of <parameter>status_code</parameter> .</para> <para><emphasis>There is no reason for you to ever use this function.</emphasis> If you wanted the textual description for the <type>“status_code”</type> of a given <type>SoupMessage</type>, you should just look at the message's <type>“reason_phrase”</type>. 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.</para> <refsect3> <title>Parameters</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>status_code</para></entry> <entry><para>an HTTP status code</para></entry> <entry></entry></row> </tbody></tgroup></informaltable> </refsect3><refsect3> <title>Returns</title> <para> the (terse, English) description of <parameter>status_code</parameter> </para> </refsect3></refsect2> </refsect1>
<refsect1> <title>Types and Values</title> <refsect2> <title>enum SoupStatus</title> <para>These represent the known HTTP status code values, plus various network and internal errors.</para> <para>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.</para> <refsect3> <title>Members</title> <informaltable> <tgroup> <colspec></colspec> <colspec></colspec> <colspec></colspec> <tbody> <row><entry><para>SOUP_STATUS_NONE</para></entry> <entry><para>No status available. (Eg, the message has not been sent yet)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_CONTINUE</para></entry> <entry><para>100 Continue (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_SWITCHING_PROTOCOLS</para></entry> <entry><para>101 Switching Protocols (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PROCESSING</para></entry> <entry><para>102 Processing (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_OK</para></entry> <entry><para>200 Success (HTTP). Also used by many lower-level soup routines to indicate success.</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_CREATED</para></entry> <entry><para>201 Created (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_ACCEPTED</para></entry> <entry><para>202 Accepted (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NON_AUTHORITATIVE</para></entry> <entry><para>203 Non-Authoritative Information (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NO_CONTENT</para></entry> <entry><para>204 No Content (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_RESET_CONTENT</para></entry> <entry><para>205 Reset Content (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PARTIAL_CONTENT</para></entry> <entry><para>206 Partial Content (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_MULTI_STATUS</para></entry> <entry><para>207 Multi-Status (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_MULTIPLE_CHOICES</para></entry> <entry><para>300 Multiple Choices (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_MOVED_PERMANENTLY</para></entry> <entry><para>301 Moved Permanently (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_FOUND</para></entry> <entry><para>302 Found (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_MOVED_TEMPORARILY</para></entry> <entry><para>302 Moved Temporarily (old name, RFC 2068)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_SEE_OTHER</para></entry> <entry><para>303 See Other (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_MODIFIED</para></entry> <entry><para>304 Not Modified (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_USE_PROXY</para></entry> <entry><para>305 Use Proxy (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL</para></entry> <entry><para>306 [Unused] (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_TEMPORARY_REDIRECT</para></entry> <entry><para>307 Temporary Redirect (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PERMANENT_REDIRECT</para></entry> <entry><para>308 Permanent Redirect (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_BAD_REQUEST</para></entry> <entry><para>400 Bad Request (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_UNAUTHORIZED</para></entry> <entry><para>401 Unauthorized (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PAYMENT_REQUIRED</para></entry> <entry><para>402 Payment Required (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_FORBIDDEN</para></entry> <entry><para>403 Forbidden (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_FOUND</para></entry> <entry><para>404 Not Found (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_METHOD_NOT_ALLOWED</para></entry> <entry><para>405 Method Not Allowed (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_ACCEPTABLE</para></entry> <entry><para>406 Not Acceptable (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED</para></entry> <entry><para>407 Proxy Authentication Required (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PROXY_UNAUTHORIZED</para></entry> <entry><para>shorter alias for <literal>SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED</literal></para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_REQUEST_TIMEOUT</para></entry> <entry><para>408 Request Timeout (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_CONFLICT</para></entry> <entry><para>409 Conflict (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_GONE</para></entry> <entry><para>410 Gone (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_LENGTH_REQUIRED</para></entry> <entry><para>411 Length Required (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_PRECONDITION_FAILED</para></entry> <entry><para>412 Precondition Failed (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE</para></entry> <entry><para>413 Request Entity Too Large (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_REQUEST_URI_TOO_LONG</para></entry> <entry><para>414 Request-URI Too Long (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE</para></entry> <entry><para>415 Unsupported Media Type (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE</para></entry> <entry><para>416 Requested Range Not Satisfiable (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_INVALID_RANGE</para></entry> <entry><para>shorter alias for <literal>SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE</literal></para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_EXPECTATION_FAILED</para></entry> <entry><para>417 Expectation Failed (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_MISDIRECTED_REQUEST</para></entry> <entry><para>421 Misdirected Request</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_UNPROCESSABLE_ENTITY</para></entry> <entry><para>422 Unprocessable Entity (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_LOCKED</para></entry> <entry><para>423 Locked (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_FAILED_DEPENDENCY</para></entry> <entry><para>424 Failed Dependency (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_INTERNAL_SERVER_ERROR</para></entry> <entry><para>500 Internal Server Error (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_IMPLEMENTED</para></entry> <entry><para>501 Not Implemented (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_BAD_GATEWAY</para></entry> <entry><para>502 Bad Gateway (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_SERVICE_UNAVAILABLE</para></entry> <entry><para>503 Service Unavailable (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_GATEWAY_TIMEOUT</para></entry> <entry><para>504 Gateway Timeout (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED</para></entry> <entry><para>505 HTTP Version Not Supported (HTTP)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_INSUFFICIENT_STORAGE</para></entry> <entry><para>507 Insufficient Storage (WebDAV)</para> </entry> <entry></entry> </row> <row><entry><para>SOUP_STATUS_NOT_EXTENDED</para></entry> <entry><para>510 Not Extended (RFC 2774)</para> </entry> <entry></entry> </row> </tbody></tgroup></informaltable> </refsect3></refsect2> </refsect1> </refentry>