soup

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package soup was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Index

Constants

View Source
const (
	// A constant corresponding to 1 day.
	//
	// For use with [ctor@Cookie.new] and [method@Cookie.set_max_age].
	COOKIE_MAX_AGE_ONE_DAY int = 0
	// A constant corresponding to 1 hour.
	//
	// For use with [ctor@Cookie.new] and [method@Cookie.set_max_age].
	COOKIE_MAX_AGE_ONE_HOUR int = 3600
	// A constant corresponding to 1 week.
	//
	// For use with [ctor@Cookie.new] and [method@Cookie.set_max_age].
	COOKIE_MAX_AGE_ONE_WEEK int = 0
	// A constant corresponding to 1 year.
	//
	// For use with [ctor@Cookie.new] and [method@Cookie.set_max_age].
	COOKIE_MAX_AGE_ONE_YEAR int = 0
)
View Source
const (
	// A macro containing the value
	// `multipart/form-data`; the MIME type used for
	// posting form data that contains files to be uploaded.
	FORM_MIME_TYPE_MULTIPART string = "multipart/form-data"
	// A macro containing the value
	// `application/x-www-form-urlencoded`; the default
	// MIME type for POSTing HTML form data.
	FORM_MIME_TYPE_URLENCODED string = "application/x-www-form-urlencoded"
)
View Source
const (
	// Like [func@get_major_version], but from the headers used at application
	// compile time, rather than from the library linked against at application run
	// time.
	MAJOR_VERSION int = 3
	// Like [func@get_micro_version], but from the headers used at
	// application compile time, rather than from the library linked
	// against at application run time.
	MICRO_VERSION int = 5
	// Like [func@get_minor_version], but from the headers used at
	// application compile time, rather than from the library linked
	// against at application run time.
	MINOR_VERSION int = 6
	// A macro that should be defined by the user prior to including
	// `libsoup.h`.
	//
	// The definition should be one of the predefined libsoup
	// version macros: %SOUP_VERSION_2_24, %SOUP_VERSION_2_26, ...
	//
	// This macro defines the earliest version of libsoup that the package
	// is required to be able to compile against.
	//
	// If the compiler is configured to warn about the use of deprecated
	// functions, then using functions that were deprecated in version
	// %SOUP_VERSION_MIN_REQUIRED or earlier will cause warnings (but
	// using functions deprecated in later releases will not).
	VERSION_MIN_REQUIRED int = 2
)
View Source
const (
	// An expiration date that is always in the past.
	HSTS_POLICY_MAX_AGE_PAST int = 0
)
View Source
const (
	// The set of #GUriFlags libsoup expects all #GUri to use.
	HTTP_URI_FLAGS int = 482
)

Variables

This section is empty.

Functions

func AuthBasicGLibType

func AuthBasicGLibType() types.GType

func AuthDigestGLibType

func AuthDigestGLibType() types.GType

func AuthDomainBasicGLibType

func AuthDomainBasicGLibType() types.GType

func AuthDomainDigestEncodePassword

func AuthDomainDigestEncodePassword(UsernameVar string, RealmVar string, PasswordVar string) string

Encodes the username/realm/password triplet for Digest authentication.

That is, it returns a stringified MD5 hash of @username, @realm, and @password concatenated together. This is the form that is needed as the return value of #SoupAuthDomainDigest's auth handler.

For security reasons, you should store the encoded hash, rather than storing the cleartext password itself and calling this method only when you need to verify it. This way, if your server is compromised, the attackers will not gain access to cleartext passwords which might also be usable at other sites. (Note also that the encoded password returned by this method is identical to the encoded password stored in an Apache .htdigest file.)

func AuthDomainDigestGLibType

func AuthDomainDigestGLibType() types.GType

func AuthDomainGLibType

func AuthDomainGLibType() types.GType

func AuthGLibType

func AuthGLibType() types.GType

func AuthManagerGLibType

func AuthManagerGLibType() types.GType

func AuthNTLMGLibType

func AuthNTLMGLibType() types.GType

func AuthNegotiateGLibType

func AuthNegotiateGLibType() types.GType

func AuthNegotiateSupported

func AuthNegotiateSupported() bool

Indicates whether libsoup was built with GSSAPI support.

If this is %FALSE, %SOUP_TYPE_AUTH_NEGOTIATE will still be defined and can still be added to a [class@Session], but libsoup will never attempt to actually use this auth type.

func CacheGLibType

func CacheGLibType() types.GType

func CacheTypeGLibType

func CacheTypeGLibType() types.GType

func CacheabilityGLibType

func CacheabilityGLibType() types.GType

func CheckVersion

func CheckVersion(MajorVar uint, MinorVar uint, MicroVar uint) bool

Like [func@CHECK_VERSION], but the check for soup_check_version is at runtime instead of compile time.

This is useful for compiling against older versions of libsoup, but using features from newer versions.

func ContentDecoderGLibType

func ContentDecoderGLibType() types.GType

func ContentSnifferGLibType

func ContentSnifferGLibType() types.GType

func CookieGLibType

func CookieGLibType() types.GType

func CookieJarAcceptPolicyGLibType

func CookieJarAcceptPolicyGLibType() types.GType

func CookieJarDBGLibType

func CookieJarDBGLibType() types.GType

func CookieJarGLibType

func CookieJarGLibType() types.GType

func CookieJarTextGLibType

func CookieJarTextGLibType() types.GType

func CookiesFree

func CookiesFree(CookiesVar *glib.SList)

Frees @cookies.

func CookiesFromRequest

func CookiesFromRequest(MsgVar *Message) *glib.SList

Parses @msg's Cookie request header and returns a [struct@GLib.SList] of `SoupCookie`s.

As the "Cookie" header, unlike "Set-Cookie", only contains cookie names and values, none of the other #SoupCookie fields will be filled in. (Thus, you can't generally pass a cookie returned from this method directly to [func@cookies_to_response].)

func CookiesFromResponse

func CookiesFromResponse(MsgVar *Message) *glib.SList

Parses @msg's Set-Cookie response headers and returns a [struct@GLib.SList] of `SoupCookie`s.

Cookies that do not specify "path" or "domain" attributes will have their values defaulted from @msg.

func CookiesToCookieHeader

func CookiesToCookieHeader(CookiesVar *glib.SList) string

Serializes a [struct@GLib.SList] of #SoupCookie into a string suitable for setting as the value of the "Cookie" header.

func CookiesToRequest

func CookiesToRequest(CookiesVar *glib.SList, MsgVar *Message)

Adds the name and value of each cookie in @cookies to @msg's "Cookie" request.

If @msg already has a "Cookie" request header, these cookies will be appended to the cookies already present. Be careful that you do not append the same cookies twice, eg, when requeuing a message.

func CookiesToResponse

func CookiesToResponse(CookiesVar *glib.SList, MsgVar *Message)

Appends a "Set-Cookie" response header to @msg for each cookie in @cookies.

This is in addition to any other "Set-Cookie" headers @msg may already have.

func DateFormatGLibType

func DateFormatGLibType() types.GType

func DateTimeNewFromHttpString

func DateTimeNewFromHttpString(DateStringVar string) *glib.DateTime

Parses @date_string and tries to extract a date from it.

This recognizes all of the "HTTP-date" formats from RFC 2616, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading "0"s, etc.)

func DateTimeToString

func DateTimeToString(DateVar *glib.DateTime, FormatVar DateFormat) string

Converts @date to a string in the format described by @format.

func EncodingGLibType

func EncodingGLibType() types.GType

func ExpectationGLibType

func ExpectationGLibType() types.GType

func FormDecode

func FormDecode(EncodedFormVar string) *glib.HashTable

Decodes @form.

which is an urlencoded dataset as defined in the HTML 4.01 spec.

func FormDecodeMultipart

func FormDecodeMultipart(MultipartVar *Multipart, FileControlNameVar *string, FilenameVar *string, ContentTypeVar *string, FileVar **glib.Bytes) *glib.HashTable

Decodes the "multipart/form-data" request in @multipart.

this is a convenience method for the case when you have a single file upload control in a form. (Or when you don't have any file upload controls, but are still using "multipart/form-data" anyway.) Pass the name of the file upload control in @file_control_name, and [func@form_decode_multipart] will extract the uploaded file data into @filename, @content_type, and @file. All of the other form control data will be returned (as strings, as with [func@form_decode] in the returned [struct@GLib.HashTable].

You may pass %NULL for @filename, @content_type and/or @file if you do not care about those fields. [func@form_decode_multipart] may also return %NULL in those fields if the client did not provide that information. You must free the returned filename and content-type with [func@GLib.free], and the returned file data with [method@Glib.Bytes.unref].

If you have a form with more than one file upload control, you will need to decode it manually, using [ctor@Multipart.new_from_message] and [method@Multipart.get_part].

func FormEncode

func FormEncode(FirstFieldVar string, varArgs ...interface{}) string

Encodes the given field names and values into a value of type "application/x-www-form-urlencoded".

Encodes as defined in the HTML 4.01 spec.

This method requires you to know the names of the form fields (or at the very least, the total number of fields) at compile time; for working with dynamic forms, use [func@form_encode_hash] or [func@form_encode_datalist].

See also: [ctor@Message.new_from_encoded_form].

func FormEncodeDatalist

func FormEncodeDatalist(FormDataSetVar **glib.Data) string

Encodes @form_data_set into a value of type "application/x-www-form-urlencoded".

Encodes as defined in the HTML 4.01 spec. Unlike [func@form_encode_hash], this preserves the ordering of the form elements, which may be required in some situations.

See also: [ctor@Message.new_from_encoded_form].

func FormEncodeHash

func FormEncodeHash(FormDataSetVar *glib.HashTable) string

Encodes @form_data_set into a value of type "application/x-www-form-urlencoded".

Encodes as defined in the HTML 4.01 spec.

Note that the HTML spec states that "The control names/values are listed in the order they appear in the document." Since this method takes a hash table, it cannot enforce that; if you care about the ordering of the form fields, use [func@form_encode_datalist].

See also: [ctor@Message.new_from_encoded_form].

func FormEncodeValist

func FormEncodeValist(FirstFieldVar string, ArgsVar []interface{}) string

See [func@form_encode].

This is mostly an internal method, used by various other methods such as [func@form_encode].

See also: [ctor@Message.new_from_encoded_form].

func GetMajorVersion

func GetMajorVersion() uint

Returns the major version number of the libsoup library.

e.g. in libsoup version 2.42.0 this is 2.

This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MAJOR_VERSION macro, which represents the major version of the libsoup headers you have included when compiling your code.

func GetMicroVersion

func GetMicroVersion() uint

Returns the micro version number of the libsoup library.

e.g. in libsoup version 2.42.0 this is 0.

This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MICRO_VERSION macro, which represents the micro version of the libsoup headers you have included when compiling your code.

func GetMinorVersion

func GetMinorVersion() uint

Returns the minor version number of the libsoup library.

e.g. in libsoup version 2.42.0 this is 42.

This function is in the library, so it represents the libsoup library your code is running against. Contrast with the #SOUP_MINOR_VERSION macro, which represents the minor version of the libsoup headers you have included when compiling your code.

func HSTSEnforcerDBGLibType

func HSTSEnforcerDBGLibType() types.GType

func HSTSEnforcerGLibType

func HSTSEnforcerGLibType() types.GType

func HSTSPolicyGLibType

func HSTSPolicyGLibType() types.GType

func HTTPVersionGLibType

func HTTPVersionGLibType() types.GType

func HeaderContains

func HeaderContains(HeaderVar string, TokenVar string) bool

Parses @header to see if it contains the token @token (matched case-insensitively).

Note that this can't be used with lists that have qvalues.

func HeaderFreeList

func HeaderFreeList(ListVar *glib.SList)

Frees @list.

func HeaderFreeParamList

func HeaderFreeParamList(ParamListVar *glib.HashTable)

Frees @param_list.

func HeaderGStringAppendParam

func HeaderGStringAppendParam(StringVar *glib.String, NameVar string, ValueVar *string)

Appends something like `name=value` to @string, taking care to quote @value if needed, and if so, to escape any quotes or backslashes in @value.

Alternatively, if @value is a non-ASCII UTF-8 string, it will be appended using RFC5987 syntax. Although in theory this is supposed to work anywhere in HTTP that uses this style of parameter, in reality, it can only be used portably with the Content-Disposition "filename" parameter.

If @value is %NULL, this will just append @name to @string.

func HeaderGStringAppendParamQuoted

func HeaderGStringAppendParamQuoted(StringVar *glib.String, NameVar string, ValueVar string)

Appends something like `name="value"` to @string, taking care to escape any quotes or backslashes in @value.

If @value is (non-ASCII) UTF-8, this will instead use RFC 5987 encoding, just like [func@header_g_string_append_param].

func HeaderParseList

func HeaderParseList(HeaderVar string) *glib.SList

Parses a header whose content is described by RFC2616 as `#something`.

"something" does not itself contain commas, except as part of quoted-strings.

func HeaderParseParamList

func HeaderParseParamList(HeaderVar string) *glib.HashTable

Parses a header which is a comma-delimited list of something like: `token [ "=" ( token | quoted-string ) ]`.

Tokens that don't have an associated value will still be added to the resulting hash table, but with a %NULL value.

This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header).

func HeaderParseParamListStrict

func HeaderParseParamListStrict(HeaderVar string) *glib.HashTable

A strict version of [func@header_parse_param_list] that bails out if there are duplicate parameters.

Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use [func@header_parse_param_list] instead.

func HeaderParseQualityList

func HeaderParseQualityList(HeaderVar string, UnacceptableVar **glib.SList) *glib.SList

Parses a header whose content is a list of items with optional "qvalue"s (eg, Accept, Accept-Charset, Accept-Encoding, Accept-Language, TE).

If @unacceptable is not %NULL, then on return, it will contain the items with qvalue 0. Either way, those items will be removed from the main list.

func HeaderParseSemiParamList

func HeaderParseSemiParamList(HeaderVar string) *glib.HashTable

Parses a header which is a semicolon-delimited list of something like: `token [ "=" ( token | quoted-string ) ]`.

Tokens that don't have an associated value will still be added to the resulting hash table, but with a %NULL value.

This also handles RFC5987 encoding (which in HTTP is mostly used for giving UTF8-encoded filenames in the Content-Disposition header).

func HeaderParseSemiParamListStrict

func HeaderParseSemiParamListStrict(HeaderVar string) *glib.HashTable

A strict version of [func@header_parse_semi_param_list] that bails out if there are duplicate parameters.

Note that this function will treat RFC5987-encoded parameters as duplicated if an ASCII version is also present. For header fields that might contain RFC5987-encoded parameters, use [func@header_parse_semi_param_list] instead.

func HeadersParse

func HeadersParse(StrVar string, LenVar int, DestVar *MessageHeaders) bool

Parses the headers of an HTTP request or response in @str and stores the results in @dest.

Beware that @dest may be modified even on failure.

This is a low-level method; normally you would use [func@headers_parse_request] or [func@headers_parse_response].

func HeadersParseRequest

func HeadersParseRequest(StrVar string, LenVar int, ReqHeadersVar *MessageHeaders, ReqMethodVar *string, ReqPathVar *string, VerVar *HTTPVersion) uint

Parses the headers of an HTTP request in @str and stores the results in @req_method, @req_path, @ver, and @req_headers.

Beware that @req_headers may be modified even on failure.

func HeadersParseResponse

func HeadersParseResponse(StrVar string, LenVar int, HeadersVar *MessageHeaders, VerVar *HTTPVersion, StatusCodeVar *uint, ReasonPhraseVar *string) bool

Parses the headers of an HTTP response in @str and stores the results in @ver, @status_code, @reason_phrase, and @headers.

Beware that @headers may be modified even on failure.

func HeadersParseStatusLine

func HeadersParseStatusLine(StatusLineVar string, VerVar *HTTPVersion, StatusCodeVar *uint, ReasonPhraseVar *string) bool

Parses the HTTP Status-Line string in @status_line into @ver, @status_code, and @reason_phrase.

@status_line must be terminated by either "\0" or "\r\n".

func LoggerGLibType

func LoggerGLibType() types.GType

func LoggerLogLevelGLibType

func LoggerLogLevelGLibType() types.GType

func MemoryUseGLibType

func MemoryUseGLibType() types.GType

func MessageBodyGLibType

func MessageBodyGLibType() types.GType

func MessageFlagsGLibType

func MessageFlagsGLibType() types.GType

func MessageGLibType

func MessageGLibType() types.GType

func MessageHeadersGLibType

func MessageHeadersGLibType() types.GType

func MessageHeadersIterInit

func MessageHeadersIterInit(IterVar *MessageHeadersIter, HdrsVar *MessageHeaders)

Initializes @iter for iterating @hdrs.

func MessageHeadersIterNext

func MessageHeadersIterNext(IterVar *MessageHeadersIter, NameVar *string, ValueVar *string) bool

Yields the next name/value pair in the [struct@MessageHeaders] being iterated by @iter.

If @iter has already yielded the last header, then [method@MessageHeadersIter.next] will return %FALSE and @name and @value will be unchanged.

func MessageHeadersTypeGLibType

func MessageHeadersTypeGLibType() types.GType

func MessageMetricsGLibType

func MessageMetricsGLibType() types.GType

func MessagePriorityGLibType

func MessagePriorityGLibType() types.GType

func MultipartGLibType

func MultipartGLibType() types.GType

func MultipartInputStreamGLibType

func MultipartInputStreamGLibType() types.GType

func SameSitePolicyGLibType

func SameSitePolicyGLibType() types.GType

func ServerGLibType

func ServerGLibType() types.GType

func ServerListenOptionsGLibType

func ServerListenOptionsGLibType() types.GType

func ServerMessageGLibType

func ServerMessageGLibType() types.GType

func SessionErrorGLibType

func SessionErrorGLibType() types.GType

func SessionErrorQuark

func SessionErrorQuark() glib.Quark

Registers error quark for SoupSession if needed.

func SessionFeatureGLibType

func SessionFeatureGLibType() types.GType

func SessionGLibType

func SessionGLibType() types.GType

func StatusGLibType

func StatusGLibType() types.GType

func StatusGetPhrase

func StatusGetPhrase(StatusCodeVar uint) string

Looks up the stock HTTP description of @status_code.

*There is no reason for you to ever use this function.* If you wanted the textual description for the [property@Message:status-code] of a given [class@Message], you should just look at the message's [property@Message:reason-phrase]. However, you should only do that for use in debugging messages; HTTP reason phrases are not localized, and are not generally very descriptive anyway, and so they should never be presented to the user directly. Instead, you should create you own error messages based on the status code, and on what you were trying to do.

func TLDErrorGLibType

func TLDErrorGLibType() types.GType

func TldDomainIsPublicSuffix

func TldDomainIsPublicSuffix(DomainVar string) bool

Looks whether the @domain passed as argument is a public domain suffix (.org, .com, .co.uk, etc) or not.

Prior to libsoup 2.46, this function required that @domain be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format.

func TldErrorQuark

func TldErrorQuark() glib.Quark

Registers error quark for soup_tld_get_base_domain() if needed.

func TldGetBaseDomain

func TldGetBaseDomain(HostnameVar string) (string, error)

Finds the base domain for a given @hostname

The base domain is composed by the top level domain (such as .org, .com, .co.uk, etc) plus the second level domain, for example for myhost.mydomain.com it will return mydomain.com.

Note that %NULL will be returned for private URLs (those not ending with any well known TLD) because choosing a base domain for them would be totally arbitrary.

Prior to libsoup 2.46, this function required that @hostname be in UTF-8 if it was an IDN. From 2.46 on, the name can be in either UTF-8 or ASCII format (and the return value will be in the same format).

func URIComponentGLibType

func URIComponentGLibType() types.GType

func UriCopy

func UriCopy(UriVar *glib.Uri, FirstComponentVar URIComponent, varArgs ...interface{}) *glib.Uri

As of 3.4.0 this will detect the default ports of HTTP(s) and WS(S) URIs when copying and set it to the default port of the new scheme. So for example copying `http://localhost:80` while changing the scheme to https will result in `https://localhost:443`.

Return a copy of @uri with the given components updated.

func UriDecodeDataUri

func UriDecodeDataUri(UriVar string, ContentTypeVar *string) *glib.Bytes

Decodes the given data URI and returns its contents and @content_type.

func UriEqual

func UriEqual(Uri1Var *glib.Uri, Uri2Var *glib.Uri) bool

Tests whether or not @uri1 and @uri2 are equal in all parts.

func WebsocketClientPrepareHandshake

func WebsocketClientPrepareHandshake(MsgVar *Message, OriginVar *string, ProtocolsVar []string, SupportedExtensionsVar []gobject.TypeClass)

Adds the necessary headers to @msg to request a WebSocket handshake including supported WebSocket extensions.

The message body and non-WebSocket-related headers are not modified.

This is a low-level function; if you use [method@Session.websocket_connect_async] to create a WebSocket connection, it will call this for you.

func WebsocketClientVerifyHandshake

func WebsocketClientVerifyHandshake(MsgVar *Message, SupportedExtensionsVar []gobject.TypeClass, AcceptedExtensionsVar **glib.List) (bool, error)

Looks at the response status code and headers in @msg and determines if they contain a valid WebSocket handshake response (given the handshake request in @msg's request headers).

If @supported_extensions is non-%NULL, extensions included in the response "Sec-WebSocket-Extensions" are verified too. Accepted extensions are returned in @accepted_extensions parameter if non-%NULL.

This is a low-level function; if you use [method@Session.websocket_connect_async] to create a WebSocket connection, it will call this for you.

func WebsocketCloseCodeGLibType

func WebsocketCloseCodeGLibType() types.GType

func WebsocketConnectionGLibType

func WebsocketConnectionGLibType() types.GType

func WebsocketConnectionTypeGLibType

func WebsocketConnectionTypeGLibType() types.GType

func WebsocketDataTypeGLibType

func WebsocketDataTypeGLibType() types.GType

func WebsocketErrorGLibType

func WebsocketErrorGLibType() types.GType

func WebsocketErrorQuark

func WebsocketErrorQuark() glib.Quark

Registers error quark for SoupWebsocket if needed.

func WebsocketExtensionDeflateGLibType

func WebsocketExtensionDeflateGLibType() types.GType

func WebsocketExtensionGLibType

func WebsocketExtensionGLibType() types.GType

func WebsocketExtensionManagerGLibType

func WebsocketExtensionManagerGLibType() types.GType

func WebsocketServerCheckHandshake

func WebsocketServerCheckHandshake(MsgVar *ServerMessage, OriginVar *string, ProtocolsVar []string, SupportedExtensionsVar []gobject.TypeClass) (bool, error)

Examines the method and request headers in @msg and determines whether @msg contains a valid handshake request.

If @origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. If @supported_extensions is non-%NULL, then only requests containing valid supported extensions in "Sec-WebSocket-Extensions" header will be accepted.

Normally [func@websocket_server_process_handshake] will take care of this for you, and if you use [method@Server.add_websocket_handler] to handle accepting WebSocket connections, it will call that for you. However, this function may be useful if you need to perform more complicated validation; eg, accepting multiple different Origins, or handling different protocols depending on the path.

func WebsocketServerProcessHandshake

func WebsocketServerProcessHandshake(MsgVar *ServerMessage, ExpectedOriginVar *string, ProtocolsVar []string, SupportedExtensionsVar []gobject.TypeClass, AcceptedExtensionsVar **glib.List) bool

Examines the method and request headers in @msg and (assuming @msg contains a valid handshake request), fills in the handshake response.

If @expected_origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. If @supported_extensions is non-%NULL, then only requests containing valid supported extensions in "Sec-WebSocket-Extensions" header will be accepted. The accepted extensions will be returned in @accepted_extensions parameter if non-%NULL.

This is a low-level function; if you use [method@Server.add_websocket_handler] to handle accepting WebSocket connections, it will call this for you.

func WebsocketStateGLibType

func WebsocketStateGLibType() types.GType

Types

type Auth

type Auth struct {
	gobject.Object
}

The abstract base class for handling authentication.

Specific HTTP Authentication mechanisms are implemented by its subclasses, but applications never need to be aware of the specific subclasses being used.

#SoupAuth objects store the authentication data associated with a given bit of web space. They are created automatically by [class@Session].

func AuthNewFromInternalPtr

func AuthNewFromInternalPtr(ptr uintptr) *Auth

func NewAuth

func NewAuth(TypeVar types.GType, MsgVar *Message, AuthHeaderVar string) *Auth

Creates a new #SoupAuth of type @type with the information from @msg and @auth_header.

This is called by [class@Session]; you will normally not create auths yourself.

func (*Auth) Authenticate

func (x *Auth) Authenticate(UsernameVar string, PasswordVar string)

Call this on an auth to authenticate it.

Normally this will cause the auth's message to be requeued with the new authentication info.

func (*Auth) CanAuthenticate

func (x *Auth) CanAuthenticate() bool

Tests if @auth is able to authenticate by providing credentials to the [method@Auth.authenticate].

func (*Auth) Cancel

func (x *Auth) Cancel()

Call this on an auth to cancel it.

You need to cancel an auth to complete an asynchronous authenticate operation when no credentials are provided ([method@Auth.authenticate] is not called). The #SoupAuth will be cancelled on dispose if it hans't been authenticated.

func (*Auth) FreeProtectionSpace

func (x *Auth) FreeProtectionSpace(SpaceVar *glib.SList)

Frees @space.

func (*Auth) GetAuthority

func (x *Auth) GetAuthority() string

Returns the authority (host:port) that @auth is associated with.

func (*Auth) GetAuthorization

func (x *Auth) GetAuthorization(MsgVar *Message) string

Generates an appropriate "Authorization" header for @msg.

(The session will only call this if [method@Auth.is_authenticated] returned %TRUE.)

func (*Auth) GetInfo

func (x *Auth) GetInfo() string

Gets an opaque identifier for @auth.

The identifier can be used as a hash key or the like. #SoupAuth objects from the same server with the same identifier refer to the same authentication domain (eg, the URLs associated with them take the same usernames and passwords).

func (*Auth) GetPropertyAuthority added in v0.0.4

func (x *Auth) GetPropertyAuthority() string

GetPropertyAuthority gets the "authority" property. The authority (host:port) being authenticated to.

func (*Auth) GetPropertyIsAuthenticated added in v0.0.4

func (x *Auth) GetPropertyIsAuthenticated() bool

GetPropertyIsAuthenticated gets the "is-authenticated" property. Whether or not the auth has been authenticated.

func (*Auth) GetPropertyIsCancelled added in v0.0.4

func (x *Auth) GetPropertyIsCancelled() bool

GetPropertyIsCancelled gets the "is-cancelled" property. Whether or not the auth has been cancelled.

func (*Auth) GetPropertyIsForProxy added in v0.0.4

func (x *Auth) GetPropertyIsForProxy() bool

GetPropertyIsForProxy gets the "is-for-proxy" property. Whether or not the auth is for a proxy server.

func (*Auth) GetPropertyRealm added in v0.0.4

func (x *Auth) GetPropertyRealm() string

GetPropertyRealm gets the "realm" property. The authentication realm.

func (*Auth) GetPropertySchemeName added in v0.0.4

func (x *Auth) GetPropertySchemeName() string

GetPropertySchemeName gets the "scheme-name" property. The authentication scheme name.

func (*Auth) GetProtectionSpace

func (x *Auth) GetProtectionSpace(SourceUriVar *glib.Uri) *glib.SList

Returns a list of paths on the server which @auth extends over.

(All subdirectories of these paths are also assumed to be part of @auth's protection space, unless otherwise discovered not to be.)

func (*Auth) GetRealm

func (x *Auth) GetRealm() string

Returns @auth's realm.

This is an identifier that distinguishes separate authentication spaces on a given server, and may be some string that is meaningful to the user. (Although it is probably not localized.)

func (*Auth) GetSchemeName

func (x *Auth) GetSchemeName() string

soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name) Returns @auth's scheme name. (Eg, "Basic", "Digest", or "NTLM")

func (*Auth) GoPointer

func (c *Auth) GoPointer() uintptr

func (*Auth) IsAuthenticated

func (x *Auth) IsAuthenticated() bool

Tests if @auth has been given a username and password.

func (*Auth) IsCancelled

func (x *Auth) IsCancelled() bool

Tests if @auth has been cancelled

func (*Auth) IsForProxy

func (x *Auth) IsForProxy() bool

Tests whether or not @auth is associated with a proxy server rather than an "origin" server.

func (*Auth) IsReady

func (x *Auth) IsReady(MsgVar *Message) bool

Tests if @auth is ready to make a request for @msg with.

For most auths, this is equivalent to [method@Auth.is_authenticated], but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated.

func (*Auth) SetGoPointer

func (c *Auth) SetGoPointer(ptr uintptr)

func (*Auth) SetPropertyAuthority added in v0.0.4

func (x *Auth) SetPropertyAuthority(value string)

SetPropertyAuthority sets the "authority" property. The authority (host:port) being authenticated to.

func (*Auth) SetPropertyIsForProxy added in v0.0.4

func (x *Auth) SetPropertyIsForProxy(value bool)

SetPropertyIsForProxy sets the "is-for-proxy" property. Whether or not the auth is for a proxy server.

func (*Auth) SetPropertyRealm added in v0.0.4

func (x *Auth) SetPropertyRealm(value string)

SetPropertyRealm sets the "realm" property. The authentication realm.

func (*Auth) Update

func (x *Auth) Update(MsgVar *Message, AuthHeaderVar string) bool

Updates @auth with the information from @msg and @auth_header, possibly un-authenticating it.

As with [ctor@Auth.new], this is normally only used by [class@Session].

type AuthBasic

type AuthBasic struct {
	Auth
}

HTTP "Basic" authentication.

[class@Session]s support this by default; if you want to disable support for it, call [method@Session.remove_feature_by_type], passing %SOUP_TYPE_AUTH_BASIC.

func AuthBasicNewFromInternalPtr

func AuthBasicNewFromInternalPtr(ptr uintptr) *AuthBasic

func (*AuthBasic) GoPointer

func (c *AuthBasic) GoPointer() uintptr

func (*AuthBasic) SetGoPointer

func (c *AuthBasic) SetGoPointer(ptr uintptr)

type AuthClass

type AuthClass struct {
	ParentClass gobject.ObjectClass

	SchemeName uintptr

	Strength uint

	Padding [6]uintptr
	// contains filtered or unexported fields
}

func (*AuthClass) GetAuthenticate

func (x *AuthClass) GetAuthenticate() func(*Auth, string, string)

GetAuthenticate gets the "authenticate" callback function.

func (*AuthClass) GetCanAuthenticate

func (x *AuthClass) GetCanAuthenticate() func(*Auth) bool

GetCanAuthenticate gets the "can_authenticate" callback function.

func (*AuthClass) GetGetAuthorization

func (x *AuthClass) GetGetAuthorization() func(*Auth, *Message) string

GetGetAuthorization gets the "get_authorization" callback function.

func (*AuthClass) GetGetProtectionSpace

func (x *AuthClass) GetGetProtectionSpace() func(*Auth, *glib.Uri) *glib.SList

GetGetProtectionSpace gets the "get_protection_space" callback function.

func (*AuthClass) GetIsAuthenticated

func (x *AuthClass) GetIsAuthenticated() func(*Auth) bool

GetIsAuthenticated gets the "is_authenticated" callback function.

func (*AuthClass) GetIsReady

func (x *AuthClass) GetIsReady() func(*Auth, *Message) bool

GetIsReady gets the "is_ready" callback function.

func (*AuthClass) GetUpdate

func (x *AuthClass) GetUpdate() func(*Auth, *Message, *glib.HashTable) bool

GetUpdate gets the "update" callback function.

func (*AuthClass) GoPointer

func (x *AuthClass) GoPointer() uintptr

func (*AuthClass) OverrideAuthenticate

func (x *AuthClass) OverrideAuthenticate(cb func(*Auth, string, string))

OverrideAuthenticate sets the "authenticate" callback function.

func (*AuthClass) OverrideCanAuthenticate

func (x *AuthClass) OverrideCanAuthenticate(cb func(*Auth) bool)

OverrideCanAuthenticate sets the "can_authenticate" callback function.

func (*AuthClass) OverrideGetAuthorization

func (x *AuthClass) OverrideGetAuthorization(cb func(*Auth, *Message) string)

OverrideGetAuthorization sets the "get_authorization" callback function.

func (*AuthClass) OverrideGetProtectionSpace

func (x *AuthClass) OverrideGetProtectionSpace(cb func(*Auth, *glib.Uri) *glib.SList)

OverrideGetProtectionSpace sets the "get_protection_space" callback function.

func (*AuthClass) OverrideIsAuthenticated

func (x *AuthClass) OverrideIsAuthenticated(cb func(*Auth) bool)

OverrideIsAuthenticated sets the "is_authenticated" callback function.

func (*AuthClass) OverrideIsReady

func (x *AuthClass) OverrideIsReady(cb func(*Auth, *Message) bool)

OverrideIsReady sets the "is_ready" callback function.

func (*AuthClass) OverrideUpdate

func (x *AuthClass) OverrideUpdate(cb func(*Auth, *Message, *glib.HashTable) bool)

OverrideUpdate sets the "update" callback function.

type AuthDigest

type AuthDigest struct {
	Auth
}

HTTP "Digest" authentication.

[class@Session]s support this by default; if you want to disable support for it, call [method@Session.remove_feature_by_type] passing %SOUP_TYPE_AUTH_DIGEST.

func AuthDigestNewFromInternalPtr

func AuthDigestNewFromInternalPtr(ptr uintptr) *AuthDigest

func (*AuthDigest) GoPointer

func (c *AuthDigest) GoPointer() uintptr

func (*AuthDigest) SetGoPointer

func (c *AuthDigest) SetGoPointer(ptr uintptr)

type AuthDomain

type AuthDomain struct {
	gobject.Object
}

Server-side authentication.

A #SoupAuthDomain manages authentication for all or part of a [class@Server]. To make a server require authentication, first create an appropriate subclass of #SoupAuthDomain, and then add it to the server with [method@Server.add_auth_domain].

In order for an auth domain to have any effect, you must add one or more paths to it (via [method@AuthDomain.add_path]). To require authentication for all ordinary requests, add the path `"/"`. (Note that this does not include the special `"*"` URI (eg, "OPTIONS *"), which must be added as a separate path if you want to cover it.)

If you need greater control over which requests should and shouldn't be authenticated, add paths covering everything you *might* want authenticated, and then use a filter ([method@AuthDomain.set_filter] to bypass authentication for those requests that don't need it.

func AuthDomainNewFromInternalPtr

func AuthDomainNewFromInternalPtr(ptr uintptr) *AuthDomain

func (*AuthDomain) Accepts

func (x *AuthDomain) Accepts(MsgVar *ServerMessage) string

Checks if @msg contains appropriate authorization for @domain to accept it.

Mirroring [method@AuthDomain.covers], this does not check whether or not @domain *cares* if @msg is authorized.

This is used by [class@Server] internally and is probably of no use to anyone else.

func (*AuthDomain) AddPath

func (x *AuthDomain) AddPath(PathVar string)

Adds @path to @domain.

Requests under @path on @domain's server will require authentication (unless overridden by [method@AuthDomain.remove_path] or [method@AuthDomain.set_filter]).

func (*AuthDomain) Challenge

func (x *AuthDomain) Challenge(MsgVar *ServerMessage)

Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to @msg.

It requests that the client authenticate, and sets @msg's status accordingly.

This is used by [class@Server] internally and is probably of no use to anyone else.

func (*AuthDomain) CheckPassword

func (x *AuthDomain) CheckPassword(MsgVar *ServerMessage, UsernameVar string, PasswordVar string) bool

Checks if @msg authenticates to @domain via @username and @password.

This would normally be called from a [callback@AuthDomainGenericAuthCallback].

func (*AuthDomain) Covers

func (x *AuthDomain) Covers(MsgVar *ServerMessage) bool

Checks if @domain requires @msg to be authenticated (according to its paths and filter function).

This does not actually look at whether @msg *is* authenticated, merely whether or not it needs to be.

This is used by [class@Server] internally and is probably of no use to anyone else.

func (*AuthDomain) GetPropertyFilterData added in v0.0.4

func (x *AuthDomain) GetPropertyFilterData() uintptr

GetPropertyFilterData gets the "filter-data" property. Data to pass to the [callback@AuthDomainFilter].

func (*AuthDomain) GetPropertyGenericAuthData added in v0.0.4

func (x *AuthDomain) GetPropertyGenericAuthData() uintptr

GetPropertyGenericAuthData gets the "generic-auth-data" property. The data to pass to the [callback@AuthDomainGenericAuthCallback].

func (*AuthDomain) GetPropertyProxy added in v0.0.4

func (x *AuthDomain) GetPropertyProxy() bool

GetPropertyProxy gets the "proxy" property. Whether or not this is a proxy auth domain.

func (*AuthDomain) GetPropertyRealm added in v0.0.4

func (x *AuthDomain) GetPropertyRealm() string

GetPropertyRealm gets the "realm" property. The realm of this auth domain.

func (*AuthDomain) GetRealm

func (x *AuthDomain) GetRealm() string

Gets the realm name associated with @domain.

func (*AuthDomain) GoPointer

func (c *AuthDomain) GoPointer() uintptr

func (*AuthDomain) RemovePath

func (x *AuthDomain) RemovePath(PathVar string)

Removes @path from @domain.

Requests under @path on @domain's server will NOT require authentication.

This is not simply an undo-er for [method@AuthDomain.add_path]; it can be used to "carve out" a subtree that does not require authentication inside a hierarchy that does. Note also that unlike with [method@AuthDomain.add_path], this cannot be overridden by adding a filter, as filters can only bypass authentication that would otherwise be required, not require it where it would otherwise be unnecessary.

func (*AuthDomain) SetFilter

func (x *AuthDomain) SetFilter(FilterVar *AuthDomainFilter, FilterDataVar uintptr, DnotifyVar *glib.DestroyNotify)

Adds @filter as an authentication filter to @domain.

The filter gets a chance to bypass authentication for certain requests that would otherwise require it. Eg, it might check the message's path in some way that is too complicated to do via the other methods, or it might check the message's method, and allow GETs but not PUTs.

The filter function returns %TRUE if the request should still require authentication, or %FALSE if authentication is unnecessary for this request.

To help prevent security holes, your filter should return %TRUE by default, and only return %FALSE under specifically-tested circumstances, rather than the other way around. Eg, in the example above, where you want to authenticate PUTs but not GETs, you should check if the method is GET and return %FALSE in that case, and then return %TRUE for all other methods (rather than returning %TRUE for PUT and %FALSE for all other methods). This way if it turned out (now or later) that some paths supported additional methods besides GET and PUT, those methods would default to being NOT allowed for unauthenticated users.

You can also set the filter by setting the SoupAuthDomain:filter and [property@AuthDomain:filter-data properties], which can also be used to set the filter at construct time.

func (*AuthDomain) SetGenericAuthCallback

func (x *AuthDomain) SetGenericAuthCallback(AuthCallbackVar *AuthDomainGenericAuthCallback, AuthDataVar uintptr, DnotifyVar *glib.DestroyNotify)

Sets @auth_callback as an authentication-handling callback for @domain.

Whenever a request comes in to @domain which cannot be authenticated via a domain-specific auth callback (eg, [callback@AuthDomainDigestAuthCallback]), the generic auth callback will be invoked. See [callback@AuthDomainGenericAuthCallback] for information on what the callback should do.

func (*AuthDomain) SetGoPointer

func (c *AuthDomain) SetGoPointer(ptr uintptr)

func (*AuthDomain) SetPropertyFilterData added in v0.0.4

func (x *AuthDomain) SetPropertyFilterData(value uintptr)

SetPropertyFilterData sets the "filter-data" property. Data to pass to the [callback@AuthDomainFilter].

func (*AuthDomain) SetPropertyGenericAuthData added in v0.0.4

func (x *AuthDomain) SetPropertyGenericAuthData(value uintptr)

SetPropertyGenericAuthData sets the "generic-auth-data" property. The data to pass to the [callback@AuthDomainGenericAuthCallback].

func (*AuthDomain) SetPropertyProxy added in v0.0.4

func (x *AuthDomain) SetPropertyProxy(value bool)

SetPropertyProxy sets the "proxy" property. Whether or not this is a proxy auth domain.

func (*AuthDomain) SetPropertyRealm added in v0.0.4

func (x *AuthDomain) SetPropertyRealm(value string)

SetPropertyRealm sets the "realm" property. The realm of this auth domain.

type AuthDomainBasic

type AuthDomainBasic struct {
	AuthDomain
}

Server-side "Basic" authentication.

#SoupAuthDomainBasic handles the server side of HTTP "Basic" (ie, cleartext password) authentication.

func AuthDomainBasicNewFromInternalPtr

func AuthDomainBasicNewFromInternalPtr(ptr uintptr) *AuthDomainBasic

func NewAuthDomainBasic

func NewAuthDomainBasic(Optname1Var string, varArgs ...interface{}) *AuthDomainBasic

Creates a #SoupAuthDomainBasic.

You must set the [property@AuthDomain:realm] property, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional.

func (*AuthDomainBasic) GetPropertyAuthData added in v0.0.4

func (x *AuthDomainBasic) GetPropertyAuthData() uintptr

GetPropertyAuthData gets the "auth-data" property. The data to pass to the [callback@AuthDomainBasicAuthCallback].

func (*AuthDomainBasic) GoPointer

func (c *AuthDomainBasic) GoPointer() uintptr

func (*AuthDomainBasic) SetAuthCallback

func (x *AuthDomainBasic) SetAuthCallback(CallbackVar *AuthDomainBasicAuthCallback, UserDataVar uintptr, DnotifyVar *glib.DestroyNotify)

Sets the callback that @domain will use to authenticate incoming requests.

For each request containing authorization, @domain will invoke the callback, and then either accept or reject the request based on @callback's return value.

You can also set the auth callback by setting the [property@AuthDomainBasic:auth-callback] and [property@AuthDomainBasic:auth-data] properties, which can also be used to set the callback at construct time.

func (*AuthDomainBasic) SetGoPointer

func (c *AuthDomainBasic) SetGoPointer(ptr uintptr)

func (*AuthDomainBasic) SetPropertyAuthData added in v0.0.4

func (x *AuthDomainBasic) SetPropertyAuthData(value uintptr)

SetPropertyAuthData sets the "auth-data" property. The data to pass to the [callback@AuthDomainBasicAuthCallback].

type AuthDomainBasicAuthCallback

type AuthDomainBasicAuthCallback func(uintptr, uintptr, string, string, uintptr) bool

Callback used by #SoupAuthDomainBasic for authentication purposes.

The application should verify that @username and @password and valid and return %TRUE or %FALSE.

If you are maintaining your own password database (rather than using the password to authenticate against some other system like PAM or a remote server), you should make sure you know what you are doing. In particular, don't store cleartext passwords, or easily-computed hashes of cleartext passwords, even if you don't care that much about the security of your server, because users will frequently use the same password for multiple sites, and so compromising any site with a cleartext (or easily-cracked) password database may give attackers access to other more-interesting sites as well.

type AuthDomainBasicClass

type AuthDomainBasicClass struct {
	ParentClass AuthDomainClass
	// contains filtered or unexported fields
}

func (*AuthDomainBasicClass) GoPointer

func (x *AuthDomainBasicClass) GoPointer() uintptr

type AuthDomainClass

type AuthDomainClass struct {
	ParentClass gobject.ObjectClass

	Padding [6]uintptr
	// contains filtered or unexported fields
}

func (*AuthDomainClass) GetAccepts

func (x *AuthDomainClass) GetAccepts() func(*AuthDomain, *ServerMessage, string) string

GetAccepts gets the "accepts" callback function.

func (*AuthDomainClass) GetChallenge

func (x *AuthDomainClass) GetChallenge() func(*AuthDomain, *ServerMessage) string

GetChallenge gets the "challenge" callback function.

func (*AuthDomainClass) GetCheckPassword

func (x *AuthDomainClass) GetCheckPassword() func(*AuthDomain, *ServerMessage, string, string) bool

GetCheckPassword gets the "check_password" callback function.

func (*AuthDomainClass) GoPointer

func (x *AuthDomainClass) GoPointer() uintptr

func (*AuthDomainClass) OverrideAccepts

func (x *AuthDomainClass) OverrideAccepts(cb func(*AuthDomain, *ServerMessage, string) string)

OverrideAccepts sets the "accepts" callback function.

func (*AuthDomainClass) OverrideChallenge

func (x *AuthDomainClass) OverrideChallenge(cb func(*AuthDomain, *ServerMessage) string)

OverrideChallenge sets the "challenge" callback function.

func (*AuthDomainClass) OverrideCheckPassword

func (x *AuthDomainClass) OverrideCheckPassword(cb func(*AuthDomain, *ServerMessage, string, string) bool)

OverrideCheckPassword sets the "check_password" callback function.

type AuthDomainDigest

type AuthDomainDigest struct {
	AuthDomain
}

Server-side "Digest" authentication.

#SoupAuthDomainDigest handles the server side of HTTP "Digest" authentication.

func AuthDomainDigestNewFromInternalPtr

func AuthDomainDigestNewFromInternalPtr(ptr uintptr) *AuthDomainDigest

func NewAuthDomainDigest

func NewAuthDomainDigest(Optname1Var string, varArgs ...interface{}) *AuthDomainDigest

Creates a #SoupAuthDomainDigest.

You must set the [property@AuthDomain:realm] property, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional.

func (*AuthDomainDigest) GetPropertyAuthData added in v0.0.4

func (x *AuthDomainDigest) GetPropertyAuthData() uintptr

GetPropertyAuthData gets the "auth-data" property. The data to pass to the [callback@AuthDomainDigestAuthCallback].

func (*AuthDomainDigest) GoPointer

func (c *AuthDomainDigest) GoPointer() uintptr

func (*AuthDomainDigest) SetAuthCallback

func (x *AuthDomainDigest) SetAuthCallback(CallbackVar *AuthDomainDigestAuthCallback, UserDataVar uintptr, DnotifyVar *glib.DestroyNotify)

Sets the callback that @domain will use to authenticate incoming requests.

For each request containing authorization, @domain will invoke the callback, and then either accept or reject the request based on @callback's return value.

You can also set the auth callback by setting the [property@AuthDomainDigest:auth-callback] and [property@AuthDomainDigest:auth-data] properties, which can also be used to set the callback at construct time.

func (*AuthDomainDigest) SetGoPointer

func (c *AuthDomainDigest) SetGoPointer(ptr uintptr)

func (*AuthDomainDigest) SetPropertyAuthData added in v0.0.4

func (x *AuthDomainDigest) SetPropertyAuthData(value uintptr)

SetPropertyAuthData sets the "auth-data" property. The data to pass to the [callback@AuthDomainDigestAuthCallback].

type AuthDomainDigestAuthCallback

type AuthDomainDigestAuthCallback func(uintptr, uintptr, string, uintptr) string

Callback used by #SoupAuthDomainDigest for authentication purposes.

The application should look up @username in its password database, and return the corresponding encoded password (see [func@AuthDomainDigest.encode_password].

type AuthDomainDigestClass

type AuthDomainDigestClass struct {
	ParentClass AuthDomainClass
	// contains filtered or unexported fields
}

func (*AuthDomainDigestClass) GoPointer

func (x *AuthDomainDigestClass) GoPointer() uintptr

type AuthDomainFilter

type AuthDomainFilter func(uintptr, uintptr, uintptr) bool

The prototype for a #SoupAuthDomain filter.

See [method@AuthDomain.set_filter] for details.

type AuthDomainGenericAuthCallback

type AuthDomainGenericAuthCallback func(uintptr, uintptr, string, uintptr) bool

The prototype for a #SoupAuthDomain generic authentication callback.

The callback should look up the user's password, call [method@AuthDomain.check_password], and use the return value from that method as its own return value.

In general, for security reasons, it is preferable to use the auth-domain-specific auth callbacks (eg, [callback@AuthDomainBasicAuthCallback] and [callback@AuthDomainDigestAuthCallback]), because they don't require keeping a cleartext password database. Most users will use the same password for many different sites, meaning if any site with a cleartext password database is compromised, accounts on other servers might be compromised as well. For many of the cases where [class@Server] is used, this is not really relevant, but it may still be worth considering.

type AuthManager

type AuthManager struct {
	gobject.Object
}

HTTP client-side authentication handler.

#SoupAuthManager is the [iface@SessionFeature] that handles HTTP authentication for a [class@Session].

A #SoupAuthManager is added to the session by default, and normally you don't need to worry about it at all. However, if you want to disable HTTP authentication, you can remove the feature from the session with [method@Session.remove_feature_by_type] or disable it on individual requests with [method@Message.disable_feature].

You can use this with [method@Session.remove_feature_by_type] or [method@Message.disable_feature].

(Although this type has only been publicly visible since libsoup 2.42, it has always existed in the background, and you can use `g_type_from_name ("SoupAuthManager")` to get its [alias@GObject.Type] in earlier releases.)

func AuthManagerNewFromInternalPtr

func AuthManagerNewFromInternalPtr(ptr uintptr) *AuthManager

func (*AuthManager) ClearCachedCredentials

func (x *AuthManager) ClearCachedCredentials()

Clear all credentials cached by @manager.

func (*AuthManager) GoPointer

func (c *AuthManager) GoPointer() uintptr

func (*AuthManager) SetGoPointer

func (c *AuthManager) SetGoPointer(ptr uintptr)

func (*AuthManager) UseAuth

func (x *AuthManager) UseAuth(UriVar *glib.Uri, AuthVar *Auth)

Records that @auth is to be used under @uri, as though a WWW-Authenticate header had been received at that URI.

This can be used to "preload" @manager's auth cache, to avoid an extra HTTP round trip in the case where you know ahead of time that a 401 response will be returned.

This is only useful for authentication types where the initial Authorization header does not depend on any additional information from the server. (Eg, Basic or NTLM, but not Digest.)

type AuthManagerClass

type AuthManagerClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*AuthManagerClass) GoPointer

func (x *AuthManagerClass) GoPointer() uintptr

type AuthNTLM

type AuthNTLM struct {
	Auth
}

HTTP-based NTLM authentication.

[class@Session]s do not support this type by default; if you want to enable support for it, call [method@Session.add_feature_by_type], passing %SOUP_TYPE_AUTH_NTLM.

func AuthNTLMNewFromInternalPtr

func AuthNTLMNewFromInternalPtr(ptr uintptr) *AuthNTLM

func (*AuthNTLM) GoPointer

func (c *AuthNTLM) GoPointer() uintptr

func (*AuthNTLM) SetGoPointer

func (c *AuthNTLM) SetGoPointer(ptr uintptr)

type AuthNegotiate

type AuthNegotiate struct {
	Auth
}

HTTP-based GSS-Negotiate authentication, as defined by [RFC 4559](https://datatracker.ietf.org/doc/html/rfc4559).

[class@Session]s do not support this type by default; if you want to enable support for it, call [method@Session.add_feature_by_type], passing %SOUP_TYPE_AUTH_NEGOTIATE.

This auth type will only work if libsoup was compiled with GSSAPI support; you can check [func@AuthNegotiate.supported] to see if it was.

func AuthNegotiateNewFromInternalPtr

func AuthNegotiateNewFromInternalPtr(ptr uintptr) *AuthNegotiate

func (*AuthNegotiate) GoPointer

func (c *AuthNegotiate) GoPointer() uintptr

func (*AuthNegotiate) SetGoPointer

func (c *AuthNegotiate) SetGoPointer(ptr uintptr)

type Cache

type Cache struct {
	gobject.Object
}

File-based cache for HTTP resources.

func CacheNewFromInternalPtr

func CacheNewFromInternalPtr(ptr uintptr) *Cache

func NewCache

func NewCache(CacheDirVar *string, CacheTypeVar CacheType) *Cache

Creates a new #SoupCache.

func (*Cache) Clear

func (x *Cache) Clear()

Will remove all entries in the @cache plus all the cache files.

This is not thread safe and must be called only from the thread that created the #SoupCache

func (*Cache) Dump

func (x *Cache) Dump()

Synchronously writes the cache index out to disk.

Contrast with [method@Cache.flush], which writes pending cache *entries* to disk.

You must call this before exiting if you want your cache data to persist between sessions.

This is not thread safe and must be called only from the thread that created the #SoupCache

func (*Cache) Flush

func (x *Cache) Flush()

Forces all pending writes in the @cache to be committed to disk.

For doing so it will iterate the [struct@GLib.MainContext] associated with @cache's session as long as needed.

Contrast with [method@Cache.dump], which writes out the cache index file.

func (*Cache) GetMaxSize

func (x *Cache) GetMaxSize() uint

Gets the maximum size of the cache.

func (*Cache) GetPropertyCacheDir added in v0.0.4

func (x *Cache) GetPropertyCacheDir() string

GetPropertyCacheDir gets the "cache-dir" property. The directory to store the cache files.

func (*Cache) GoPointer

func (c *Cache) GoPointer() uintptr

func (*Cache) Load

func (x *Cache) Load()

Loads the contents of @cache's index into memory.

This is not thread safe and must be called only from the thread that created the #SoupCache

func (*Cache) SetGoPointer

func (c *Cache) SetGoPointer(ptr uintptr)

func (*Cache) SetMaxSize

func (x *Cache) SetMaxSize(MaxSizeVar uint)

Sets the maximum size of the cache.

func (*Cache) SetPropertyCacheDir added in v0.0.4

func (x *Cache) SetPropertyCacheDir(value string)

SetPropertyCacheDir sets the "cache-dir" property. The directory to store the cache files.

type CacheClass

type CacheClass struct {
	ParentClass gobject.ObjectClass

	Padding [4]uintptr
	// contains filtered or unexported fields
}

func (*CacheClass) GetGetCacheability

func (x *CacheClass) GetGetCacheability() func(*Cache, *Message) Cacheability

GetGetCacheability gets the "get_cacheability" callback function.

func (*CacheClass) GoPointer

func (x *CacheClass) GoPointer() uintptr

func (*CacheClass) OverrideGetCacheability

func (x *CacheClass) OverrideGetCacheability(cb func(*Cache, *Message) Cacheability)

OverrideGetCacheability sets the "get_cacheability" callback function.

type CacheType

type CacheType int

The type of cache; this affects what kinds of responses will be saved.

const (

	// a single-user cache
	CacheSingleUserValue CacheType = 0
	// a shared cache
	CacheSharedValue CacheType = 1
)

type Cacheability

type Cacheability int

Indicates if a message should or shouldn't be cached.

const (

	// The message should be cached
	CacheCacheableValue Cacheability = 1
	// The message shouldn't be cached
	CacheUncacheableValue Cacheability = 2
	// The messages cache should be invalidated
	CacheInvalidatesValue Cacheability = 4
	// The messages cache should be updated
	CacheValidatesValue Cacheability = 8
)

type ContentDecoder

type ContentDecoder struct {
	gobject.Object
}

Handles decoding of HTTP messages.

#SoupContentDecoder handles adding the "Accept-Encoding" header on outgoing messages, and processing the "Content-Encoding" header on incoming ones. Currently it supports the "gzip", "deflate", and "br" content codings.

A #SoupContentDecoder will automatically be added to the session by default. (You can use [method@Session.remove_feature_by_type] if you don't want this.)

If #SoupContentDecoder successfully decodes the Content-Encoding, the message body will contain the decoded data; however, the message headers will be unchanged (and so "Content-Encoding" will still be present, "Content-Length" will describe the original encoded length, etc).

If "Content-Encoding" contains any encoding types that #SoupContentDecoder doesn't recognize, then none of the encodings will be decoded.

(Note that currently there is no way to (automatically) use Content-Encoding when sending a request body, or to pick specific encoding types to support.)

func ContentDecoderNewFromInternalPtr

func ContentDecoderNewFromInternalPtr(ptr uintptr) *ContentDecoder

func (*ContentDecoder) GoPointer

func (c *ContentDecoder) GoPointer() uintptr

func (*ContentDecoder) SetGoPointer

func (c *ContentDecoder) SetGoPointer(ptr uintptr)

type ContentDecoderClass

type ContentDecoderClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ContentDecoderClass) GoPointer

func (x *ContentDecoderClass) GoPointer() uintptr

type ContentSniffer

type ContentSniffer struct {
	gobject.Object
}

Sniffs the mime type of messages.

A #SoupContentSniffer tries to detect the actual content type of the files that are being downloaded by looking at some of the data before the [class@Message] emits its [signal@Message::got-headers] signal. #SoupContentSniffer implements [iface@SessionFeature], so you can add content sniffing to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type].

func ContentSnifferNewFromInternalPtr

func ContentSnifferNewFromInternalPtr(ptr uintptr) *ContentSniffer

func NewContentSniffer

func NewContentSniffer() *ContentSniffer

Creates a new #SoupContentSniffer.

func (*ContentSniffer) GoPointer

func (c *ContentSniffer) GoPointer() uintptr

func (*ContentSniffer) SetGoPointer

func (c *ContentSniffer) SetGoPointer(ptr uintptr)

func (*ContentSniffer) Sniff

func (x *ContentSniffer) Sniff(MsgVar *Message, BufferVar *glib.Bytes, ParamsVar **glib.HashTable) string

Sniffs @buffer to determine its Content-Type.

The result may also be influenced by the Content-Type declared in @msg's response headers.

type ContentSnifferClass

type ContentSnifferClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ContentSnifferClass) GoPointer

func (x *ContentSnifferClass) GoPointer() uintptr
type Cookie struct {
	// contains filtered or unexported fields
}

Implements HTTP cookies, as described by [RFC 6265](http://tools.ietf.org/html/rfc6265.txt).

To have a [class@Session] handle cookies for your appliction automatically, use a [class@CookieJar].

@name and @value will be set for all cookies. If the cookie is generated from a string that appears to have no name, then @name will be the empty string.

@domain and @path give the host or domain, and path within that host/domain, to restrict this cookie to. If @domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has @domain as a suffix). Otherwise, it is a hostname and must match exactly.

@expires will be non-%NULL if the cookie uses either the original "expires" attribute, or the newer "max-age" attribute. If @expires is %NULL, it indicates that neither "expires" nor "max-age" was specified, and the cookie expires at the end of the session.

If @http_only is set, the cookie should not be exposed to untrusted code (eg, javascript), so as to minimize the danger posed by cross-site scripting attacks.

func CookieParse

func CookieParse(HeaderVar string, OriginVar *glib.Uri) *Cookie

Parses @header and returns a #SoupCookie.

If @header contains multiple cookies, only the first one will be parsed.

If @header does not have "path" or "domain" attributes, they will be defaulted from @origin. If @origin is %NULL, path will default to "/", but domain will be left as %NULL. Note that this is not a valid state for a #SoupCookie, and you will need to fill in some appropriate string for the domain if you want to actually make use of the cookie.

As of version 3.4.0 the default value of a cookie's same-site-policy is %SOUP_SAME_SITE_POLICY_LAX.

func NewCookie

func NewCookie(NameVar string, ValueVar string, DomainVar string, PathVar string, MaxAgeVar int) *Cookie

Creates a new #SoupCookie with the given attributes.

Use [method@Cookie.set_secure] and [method@Cookie.set_http_only] if you need to set those attributes on the returned cookie.

If @domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has @domain as a suffix). Otherwise, it is a hostname and must match exactly.

@max_age is used to set the "expires" attribute on the cookie; pass -1 to not include the attribute (indicating that the cookie expires with the current session), 0 for an already-expired cookie, or a lifetime in seconds. You can use the constants %SOUP_COOKIE_MAX_AGE_ONE_HOUR, %SOUP_COOKIE_MAX_AGE_ONE_DAY, %SOUP_COOKIE_MAX_AGE_ONE_WEEK and %SOUP_COOKIE_MAX_AGE_ONE_YEAR (or multiples thereof) to calculate this value. (If you really care about setting the exact time that the cookie will expire, use [method@Cookie.set_expires].)

As of version 3.4.0 the default value of a cookie's same-site-policy is %SOUP_SAME_SITE_POLICY_LAX.

func (*Cookie) AppliesToUri

func (x *Cookie) AppliesToUri(UriVar *glib.Uri) bool

Tests if @cookie should be sent to @uri.

(At the moment, this does not check that @cookie's domain matches @uri, because it assumes that the caller has already done that. But don't rely on that; it may change in the future.)

func (*Cookie) Copy

func (x *Cookie) Copy() *Cookie

Copies @cookie.

func (*Cookie) DomainMatches

func (x *Cookie) DomainMatches(HostVar string) bool

Checks if the @cookie's domain and @host match.

The domains match if @cookie should be sent when making a request to @host, or that @cookie should be accepted when receiving a response from @host.

func (*Cookie) Equal

func (x *Cookie) Equal(Cookie2Var *Cookie) bool

Tests if @cookie1 and @cookie2 are equal.

Note that currently, this does not check that the cookie domains match. This may change in the future.

func (*Cookie) Free

func (x *Cookie) Free()

Frees @cookie.

func (*Cookie) GetDomain

func (x *Cookie) GetDomain() string

Gets @cookie's domain.

func (*Cookie) GetExpires

func (x *Cookie) GetExpires() *glib.DateTime

Gets @cookie's expiration time.

func (*Cookie) GetHttpOnly

func (x *Cookie) GetHttpOnly() bool

Gets @cookie's HttpOnly attribute.

func (*Cookie) GetName

func (x *Cookie) GetName() string

Gets @cookie's name.

func (*Cookie) GetPath

func (x *Cookie) GetPath() string

Gets @cookie's path.

func (*Cookie) GetSameSitePolicy

func (x *Cookie) GetSameSitePolicy() SameSitePolicy

Returns the same-site policy for this cookie.

func (*Cookie) GetSecure

func (x *Cookie) GetSecure() bool

Gets @cookie's secure attribute.

func (*Cookie) GetValue

func (x *Cookie) GetValue() string

Gets @cookie's value.

func (*Cookie) GoPointer

func (x *Cookie) GoPointer() uintptr

func (*Cookie) SetDomain

func (x *Cookie) SetDomain(DomainVar string)

Sets @cookie's domain to @domain.

func (*Cookie) SetExpires

func (x *Cookie) SetExpires(ExpiresVar *glib.DateTime)

Sets @cookie's expiration time to @expires.

If @expires is %NULL, @cookie will be a session cookie and will expire at the end of the client's session.

(This sets the same property as [method@Cookie.set_max_age].)

func (*Cookie) SetHttpOnly

func (x *Cookie) SetHttpOnly(HttpOnlyVar bool)

Sets @cookie's HttpOnly attribute to @http_only.

If %TRUE, @cookie will be marked as "http only", meaning it should not be exposed to web page scripts or other untrusted code.

func (*Cookie) SetMaxAge

func (x *Cookie) SetMaxAge(MaxAgeVar int)

Sets @cookie's max age to @max_age.

If @max_age is -1, the cookie is a session cookie, and will expire at the end of the client's session. Otherwise, it is the number of seconds until the cookie expires. You can use the constants %SOUP_COOKIE_MAX_AGE_ONE_HOUR, %SOUP_COOKIE_MAX_AGE_ONE_DAY, %SOUP_COOKIE_MAX_AGE_ONE_WEEK and %SOUP_COOKIE_MAX_AGE_ONE_YEAR (or multiples thereof) to calculate this value. (A value of 0 indicates that the cookie should be considered already-expired.)

This sets the same property as [method@Cookie.set_expires].

func (*Cookie) SetName

func (x *Cookie) SetName(NameVar string)

Sets @cookie's name to @name.

func (*Cookie) SetPath

func (x *Cookie) SetPath(PathVar string)

Sets @cookie's path to @path.

func (*Cookie) SetSameSitePolicy

func (x *Cookie) SetSameSitePolicy(PolicyVar SameSitePolicy)

When used in conjunction with [method@CookieJar.get_cookie_list_with_same_site_info] this sets the policy of when this cookie should be exposed.

func (*Cookie) SetSecure

func (x *Cookie) SetSecure(SecureVar bool)

Sets @cookie's secure attribute to @secure.

If %TRUE, @cookie will only be transmitted from the client to the server over secure (https) connections.

func (*Cookie) SetValue

func (x *Cookie) SetValue(ValueVar string)

Sets @cookie's value to @value.

func (*Cookie) ToCookieHeader

func (x *Cookie) ToCookieHeader() string

Serializes @cookie in the format used by the Cookie header (ie, for returning a cookie from a [class@Session] to a server).

func (*Cookie) ToSetCookieHeader

func (x *Cookie) ToSetCookieHeader() string

Serializes @cookie in the format used by the Set-Cookie header.

i.e. for sending a cookie from a [class@Server] to a client.

type CookieJar

type CookieJar struct {
	gobject.Object
}

Automatic cookie handling for SoupSession.

A #SoupCookieJar stores [struct@Cookie]s and arrange for them to be sent with the appropriate [class@Message]s. #SoupCookieJar implements [iface@SessionFeature], so you can add a cookie jar to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type].

Note that the base #SoupCookieJar class does not support any form of long-term cookie persistence.

func CookieJarNewFromInternalPtr

func CookieJarNewFromInternalPtr(ptr uintptr) *CookieJar

func NewCookieJar

func NewCookieJar() *CookieJar

Creates a new #SoupCookieJar.

The base #SoupCookieJar class does not support persistent storage of cookies; use a subclass for that.

func (*CookieJar) AddCookie

func (x *CookieJar) AddCookie(CookieVar *Cookie)

Adds @cookie to @jar.

Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

@cookie will be 'stolen' by the jar, so don't free it afterwards.

func (*CookieJar) AddCookieFull

func (x *CookieJar) AddCookieFull(CookieVar *Cookie, UriVar *glib.Uri, FirstPartyVar *glib.Uri)

Adds @cookie to @jar.

Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

@first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar.

@uri will be used to reject setting or overwriting secure cookies from insecure origins. %NULL is treated as secure.

@cookie will be 'stolen' by the jar, so don't free it afterwards.

func (*CookieJar) AddCookieWithFirstParty

func (x *CookieJar) AddCookieWithFirstParty(FirstPartyVar *glib.Uri, CookieVar *Cookie)

Adds @cookie to @jar.

Emits the [signal@CookieJar::changed] signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

@first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar.

@cookie will be 'stolen' by the jar, so don't free it afterwards.

For secure cookies to work properly you may want to use [method@CookieJar.add_cookie_full].

func (*CookieJar) AllCookies

func (x *CookieJar) AllCookies() *glib.SList

Constructs a [struct@GLib.List] with every cookie inside the @jar.

The cookies in the list are a copy of the original, so you have to free them when you are done with them.

For historical reasons this list is in reverse order.

func (*CookieJar) ConnectChanged

func (x *CookieJar) ConnectChanged(cb *func(CookieJar, uintptr, uintptr)) uint

Emitted when @jar changes.

If a cookie has been added, @new_cookie will contain the newly-added cookie and @old_cookie will be %NULL. If a cookie has been deleted, @old_cookie will contain the to-be-deleted cookie and @new_cookie will be %NULL. If a cookie has been changed, @old_cookie will contain its old value, and @new_cookie its new value.

func (*CookieJar) DeleteCookie

func (x *CookieJar) DeleteCookie(CookieVar *Cookie)

Deletes @cookie from @jar.

Emits the [signal@CookieJar::changed] signal.

func (*CookieJar) GetAcceptPolicy

func (x *CookieJar) GetAcceptPolicy() CookieJarAcceptPolicy

Gets @jar's [enum@CookieJarAcceptPolicy].

func (*CookieJar) GetCookieList

func (x *CookieJar) GetCookieList(UriVar *glib.Uri, ForHttpVar bool) *glib.SList

Retrieves the list of cookies that would be sent with a request to @uri as a [struct@GLib.List] of #SoupCookie objects.

If @for_http is %TRUE, the return value will include cookies marked "HttpOnly" (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to %FALSE if you are calling this.

func (*CookieJar) GetCookieListWithSameSiteInfo

func (x *CookieJar) GetCookieListWithSameSiteInfo(UriVar *glib.Uri, TopLevelVar *glib.Uri, SiteForCookiesVar *glib.Uri, ForHttpVar bool, IsSafeMethodVar bool, IsTopLevelNavigationVar bool) *glib.SList

This is an extended version of [method@CookieJar.get_cookie_list] that provides more information required to use SameSite cookies.

See the [SameSite cookies spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more detailed information.

func (*CookieJar) GetCookies

func (x *CookieJar) GetCookies(UriVar *glib.Uri, ForHttpVar bool) string

Retrieves (in Cookie-header form) the list of cookies that would be sent with a request to @uri.

If @for_http is %TRUE, the return value will include cookies marked "HttpOnly" (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to %FALSE if you are calling this.

func (*CookieJar) GetPropertyReadOnly added in v0.0.4

func (x *CookieJar) GetPropertyReadOnly() bool

GetPropertyReadOnly gets the "read-only" property. Whether or not the cookie jar is read-only.

func (*CookieJar) GoPointer

func (c *CookieJar) GoPointer() uintptr

func (*CookieJar) IsPersistent

func (x *CookieJar) IsPersistent() bool

Gets whether @jar stores cookies persistenly.

func (*CookieJar) SetAcceptPolicy

func (x *CookieJar) SetAcceptPolicy(PolicyVar CookieJarAcceptPolicy)

Sets @policy as the cookie acceptance policy for @jar.

func (*CookieJar) SetCookie

func (x *CookieJar) SetCookie(UriVar *glib.Uri, CookieVar string)

Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri.

Keep in mind that if the [enum@CookieJarAcceptPolicy] set is either %SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY or %SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY you'll need to use [method@CookieJar.set_cookie_with_first_party], otherwise the jar will have no way of knowing if the cookie is being set by a third party or not.

func (*CookieJar) SetCookieWithFirstParty

func (x *CookieJar) SetCookieWithFirstParty(UriVar *glib.Uri, FirstPartyVar *glib.Uri, CookieVar string)

Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri.

@first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar.

func (*CookieJar) SetGoPointer

func (c *CookieJar) SetGoPointer(ptr uintptr)

func (*CookieJar) SetPropertyReadOnly added in v0.0.4

func (x *CookieJar) SetPropertyReadOnly(value bool)

SetPropertyReadOnly sets the "read-only" property. Whether or not the cookie jar is read-only.

type CookieJarAcceptPolicy

type CookieJarAcceptPolicy int

The policy for accepting or rejecting cookies returned in responses.

const (

	// accept all cookies unconditionally.
	CookieJarAcceptAlwaysValue CookieJarAcceptPolicy = 0
	// reject all cookies unconditionally.
	CookieJarAcceptNeverValue CookieJarAcceptPolicy = 1
	// accept all cookies set by the main
	//   document loaded in the application using libsoup. An example of the most
	//   common case, web browsers, would be: If http://www.example.com is the page
	//   loaded, accept all cookies set by example.com, but if a resource from
	//   http://www.third-party.com is loaded from that page reject any cookie that
	//   it could try to set. For libsoup to be able to tell apart first party
	//   cookies from the rest, the application must call
	//   [method@Message.set_first_party] on each outgoing [class@Message], setting
	//   the [struct@GLib.Uri] of the main document. If no first party is set in a
	//   message when this policy is in effect, cookies will be assumed to be third
	//   party by default.
	CookieJarAcceptNoThirdPartyValue CookieJarAcceptPolicy = 2
	// accept all cookies set by
	//   the main document loaded in the application using libsoup, and from domains
	//   that have previously set at least one cookie when loaded as the main
	//   document. An example of the most common case, web browsers, would be: if
	//   http://www.example.com is the page loaded, accept all cookies set by
	//   example.com, but if a resource from http://www.third-party.com is loaded
	//   from that page, reject any cookie that it could try to set unless it
	//   already has a cookie in the cookie jar. For libsoup to be able to tell
	//   apart first party cookies from the rest, the application must call
	//   [method@Message.set_first_party] on each outgoing #SoupMessage, setting the
	//   [struct@GLib.Uri] of the main document. If no first party is set in a
	//   message when this policy is in effect, cookies will be assumed to be third
	//   party by default.
	CookieJarAcceptGrandfatheredThirdPartyValue CookieJarAcceptPolicy = 3
)

type CookieJarClass

type CookieJarClass struct {
	ParentClass gobject.ObjectClass

	Padding [6]uintptr
	// contains filtered or unexported fields
}

func (*CookieJarClass) GetChanged

func (x *CookieJarClass) GetChanged() func(*CookieJar, *Cookie, *Cookie)

GetChanged gets the "changed" callback function.

func (*CookieJarClass) GetIsPersistent

func (x *CookieJarClass) GetIsPersistent() func(*CookieJar) bool

GetIsPersistent gets the "is_persistent" callback function.

func (*CookieJarClass) GetSave

func (x *CookieJarClass) GetSave() func(*CookieJar)

GetSave gets the "save" callback function.

func (*CookieJarClass) GoPointer

func (x *CookieJarClass) GoPointer() uintptr

func (*CookieJarClass) OverrideChanged

func (x *CookieJarClass) OverrideChanged(cb func(*CookieJar, *Cookie, *Cookie))

OverrideChanged sets the "changed" callback function.

func (*CookieJarClass) OverrideIsPersistent

func (x *CookieJarClass) OverrideIsPersistent(cb func(*CookieJar) bool)

OverrideIsPersistent sets the "is_persistent" callback function.

func (*CookieJarClass) OverrideSave

func (x *CookieJarClass) OverrideSave(cb func(*CookieJar))

OverrideSave sets the "save" callback function.

type CookieJarDB

type CookieJarDB struct {
	CookieJar
}

Database-based Cookie Jar.

#SoupCookieJarDB is a [class@CookieJar] that reads cookies from and writes them to a sqlite database in the new Mozilla format.

(This is identical to `SoupCookieJarSqlite` in libsoup-gnome; it has just been moved into libsoup proper, and renamed to avoid conflicting.)

func CookieJarDBNewFromInternalPtr

func CookieJarDBNewFromInternalPtr(ptr uintptr) *CookieJarDB

func NewCookieJarDB

func NewCookieJarDB(FilenameVar string, ReadOnlyVar bool) *CookieJarDB

Creates a #SoupCookieJarDB.

@filename will be read in at startup to create an initial set of cookies. If @read_only is %FALSE, then the non-session cookies will be written to @filename when the [signal@CookieJar::changed] signal is emitted from the jar. (If @read_only is %TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.)

func (*CookieJarDB) GetPropertyFilename added in v0.0.4

func (x *CookieJarDB) GetPropertyFilename() string

GetPropertyFilename gets the "filename" property. Cookie-storage filename.

func (*CookieJarDB) GoPointer

func (c *CookieJarDB) GoPointer() uintptr

func (*CookieJarDB) SetGoPointer

func (c *CookieJarDB) SetGoPointer(ptr uintptr)

func (*CookieJarDB) SetPropertyFilename added in v0.0.4

func (x *CookieJarDB) SetPropertyFilename(value string)

SetPropertyFilename sets the "filename" property. Cookie-storage filename.

type CookieJarDBClass

type CookieJarDBClass struct {
	ParentClass CookieJarClass
	// contains filtered or unexported fields
}

func (*CookieJarDBClass) GoPointer

func (x *CookieJarDBClass) GoPointer() uintptr

type CookieJarText

type CookieJarText struct {
	CookieJar
}

Text-file-based ("cookies.txt") Cookie Jar

#SoupCookieJarText is a [class@CookieJar] that reads cookies from and writes them to a text file in format similar to Mozilla's "cookies.txt".

func CookieJarTextNewFromInternalPtr

func CookieJarTextNewFromInternalPtr(ptr uintptr) *CookieJarText

func NewCookieJarText

func NewCookieJarText(FilenameVar string, ReadOnlyVar bool) *CookieJarText

Creates a #SoupCookieJarText.

@filename will be read in at startup to create an initial set of cookies. If @read_only is %FALSE, then the non-session cookies will be written to @filename when the [signal@CookieJar::changed] signal is emitted from the jar. (If @read_only is %TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.)

func (*CookieJarText) GetPropertyFilename added in v0.0.4

func (x *CookieJarText) GetPropertyFilename() string

GetPropertyFilename gets the "filename" property. Cookie-storage filename.

func (*CookieJarText) GoPointer

func (c *CookieJarText) GoPointer() uintptr

func (*CookieJarText) SetGoPointer

func (c *CookieJarText) SetGoPointer(ptr uintptr)

func (*CookieJarText) SetPropertyFilename added in v0.0.4

func (x *CookieJarText) SetPropertyFilename(value string)

SetPropertyFilename sets the "filename" property. Cookie-storage filename.

type CookieJarTextClass

type CookieJarTextClass struct {
	ParentClass CookieJarClass
	// contains filtered or unexported fields
}

func (*CookieJarTextClass) GoPointer

func (x *CookieJarTextClass) GoPointer() uintptr

type DateFormat

type DateFormat int

Date formats that [func@date_time_to_string] can use.

@SOUP_DATE_HTTP and @SOUP_DATE_COOKIE always coerce the time to UTC.

This enum may be extended with more values in future releases.

const (

	// RFC 1123 format, used by the HTTP "Date" header. Eg
	//   "Sun, 06 Nov 1994 08:49:37 GMT".
	DateHttpValue DateFormat = 1
	// The format for the "Expires" timestamp in the
	//   Netscape cookie specification. Eg, "Sun, 06-Nov-1994 08:49:37 GMT".
	DateCookieValue DateFormat = 2
)

type Encoding

type Encoding int

How a message body is encoded for transport

const (

	// unknown / error
	EncodingUnrecognizedValue Encoding = 0
	// no body is present (which is not the same as a
	//   0-length body, and only occurs in certain places)
	EncodingNoneValue Encoding = 1
	// Content-Length encoding
	EncodingContentLengthValue Encoding = 2
	// Response body ends when the connection is closed
	EncodingEofValue Encoding = 3
	// chunked encoding (currently only supported
	//   for response)
	EncodingChunkedValue Encoding = 4
	// multipart/byteranges (Reserved for future
	//   use: NOT CURRENTLY IMPLEMENTED)
	EncodingByterangesValue Encoding = 5
)

type Expectation

type Expectation int

Represents the parsed value of the "Expect" header.

const (

	// any unrecognized expectation
	ExpectationUnrecognizedValue Expectation = 1
	// "100-continue"
	ExpectationContinueValue Expectation = 2
)

type HSTSEnforcer

type HSTSEnforcer struct {
	gobject.Object
}

Automatic HTTP Strict Transport Security enforcing for [class@Session].

A #SoupHSTSEnforcer stores HSTS policies and enforces them when required. #SoupHSTSEnforcer implements [iface@SessionFeature], so you can add an HSTS enforcer to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type].

#SoupHSTSEnforcer keeps track of all the HTTPS destinations that, when connected to, return the Strict-Transport-Security header with valid values. #SoupHSTSEnforcer will forget those destinations upon expiry or when the server requests it.

When the [class@Session] the #SoupHSTSEnforcer is attached to queues or restarts a message, the #SoupHSTSEnforcer will rewrite the URI to HTTPS if the destination is a known HSTS host and is contacted over an insecure transport protocol (HTTP). Users of #SoupHSTSEnforcer are advised to listen to changes in the [property@Message:uri] property in order to be aware of changes in the message URI.

Note that #SoupHSTSEnforcer does not support any form of long-term HSTS policy persistence. See [class@HSTSEnforcerDB] for a persistent enforcer.

func HSTSEnforcerNewFromInternalPtr

func HSTSEnforcerNewFromInternalPtr(ptr uintptr) *HSTSEnforcer

func NewHSTSEnforcer

func NewHSTSEnforcer() *HSTSEnforcer

Creates a new #SoupHSTSEnforcer.

The base #SoupHSTSEnforcer class does not support persistent storage of HSTS policies, see [class@HSTSEnforcerDB] for that.

func (*HSTSEnforcer) ConnectChanged

func (x *HSTSEnforcer) ConnectChanged(cb *func(HSTSEnforcer, uintptr, uintptr)) uint

Emitted when @hsts_enforcer changes.

If a policy has been added, @new_policy will contain the newly-added policy and @old_policy will be %NULL. If a policy has been deleted, @old_policy will contain the to-be-deleted policy and @new_policy will be %NULL. If a policy has been changed, @old_policy will contain its old value, and @new_policy its new value.

Note that you shouldn't modify the policies from a callback to this signal.

func (*HSTSEnforcer) GetDomains

func (x *HSTSEnforcer) GetDomains(SessionPoliciesVar bool) *glib.List

Gets a list of domains for which there are policies in @enforcer.

func (*HSTSEnforcer) GetPolicies

func (x *HSTSEnforcer) GetPolicies(SessionPoliciesVar bool) *glib.List

Gets a list with the policies in @enforcer.

func (*HSTSEnforcer) GoPointer

func (c *HSTSEnforcer) GoPointer() uintptr

func (*HSTSEnforcer) HasValidPolicy

func (x *HSTSEnforcer) HasValidPolicy(DomainVar string) bool

Gets whether @hsts_enforcer has a currently valid policy for @domain.

func (*HSTSEnforcer) IsPersistent

func (x *HSTSEnforcer) IsPersistent() bool

Gets whether @hsts_enforcer stores policies persistenly.

func (*HSTSEnforcer) SetGoPointer

func (c *HSTSEnforcer) SetGoPointer(ptr uintptr)

func (*HSTSEnforcer) SetPolicy

func (x *HSTSEnforcer) SetPolicy(PolicyVar *HSTSPolicy)

Sets @policy to @hsts_enforcer.

If @policy is expired, any existing HSTS policy for its host will be removed instead. If a policy existed for this host, it will be replaced. Otherwise, the new policy will be inserted. If the policy is a session policy, that is, one created with [ctor@HSTSPolicy.new_session_policy], the policy will not expire and will be enforced during the lifetime of @hsts_enforcer's [class@Session].

func (*HSTSEnforcer) SetSessionPolicy

func (x *HSTSEnforcer) SetSessionPolicy(DomainVar string, IncludeSubdomainsVar bool)

Sets a session policy for @domain.

A session policy is a policy that is permanent to the lifetime of @hsts_enforcer's [class@Session] and doesn't expire.

type HSTSEnforcerClass

type HSTSEnforcerClass struct {
	ParentClass gobject.ObjectClass

	Padding [4]uintptr
	// contains filtered or unexported fields
}

Class structure for #SoupHSTSEnforcer.

func (*HSTSEnforcerClass) GetChanged

func (x *HSTSEnforcerClass) GetChanged() func(*HSTSEnforcer, *HSTSPolicy, *HSTSPolicy)

GetChanged gets the "changed" callback function. The class closure for the #SoupHSTSEnforcer::changed signal.

func (*HSTSEnforcerClass) GetHasValidPolicy

func (x *HSTSEnforcerClass) GetHasValidPolicy() func(*HSTSEnforcer, string) bool

GetHasValidPolicy gets the "has_valid_policy" callback function. The @has_valid_policy function is called to check whether there is a valid policy for the given domain. This method should return %TRUE for #SoupHSTSEnforcer to change the scheme of the #GUri in the #SoupMessage to HTTPS. Implementations might want to chain up to the @has_valid_policy in the parent class to check, for instance, for runtime policies.

func (*HSTSEnforcerClass) GetIsPersistent

func (x *HSTSEnforcerClass) GetIsPersistent() func(*HSTSEnforcer) bool

GetIsPersistent gets the "is_persistent" callback function. The @is_persistent function advertises whether the enforcer is persistent or whether changes made to it will be lost when the underlying [class@Session] is finished.

func (*HSTSEnforcerClass) GoPointer

func (x *HSTSEnforcerClass) GoPointer() uintptr

func (*HSTSEnforcerClass) OverrideChanged

func (x *HSTSEnforcerClass) OverrideChanged(cb func(*HSTSEnforcer, *HSTSPolicy, *HSTSPolicy))

OverrideChanged sets the "changed" callback function. The class closure for the #SoupHSTSEnforcer::changed signal.

func (*HSTSEnforcerClass) OverrideHasValidPolicy

func (x *HSTSEnforcerClass) OverrideHasValidPolicy(cb func(*HSTSEnforcer, string) bool)

OverrideHasValidPolicy sets the "has_valid_policy" callback function. The @has_valid_policy function is called to check whether there is a valid policy for the given domain. This method should return %TRUE for #SoupHSTSEnforcer to change the scheme of the #GUri in the #SoupMessage to HTTPS. Implementations might want to chain up to the @has_valid_policy in the parent class to check, for instance, for runtime policies.

func (*HSTSEnforcerClass) OverrideIsPersistent

func (x *HSTSEnforcerClass) OverrideIsPersistent(cb func(*HSTSEnforcer) bool)

OverrideIsPersistent sets the "is_persistent" callback function. The @is_persistent function advertises whether the enforcer is persistent or whether changes made to it will be lost when the underlying [class@Session] is finished.

type HSTSEnforcerDB

type HSTSEnforcerDB struct {
	HSTSEnforcer
}

Persistent HTTP Strict Transport Security enforcer.

#SoupHSTSEnforcerDB is a [class@HSTSEnforcer] that uses a SQLite database as a backend for persistency.

func HSTSEnforcerDBNewFromInternalPtr

func HSTSEnforcerDBNewFromInternalPtr(ptr uintptr) *HSTSEnforcerDB

func NewHSTSEnforcerDB

func NewHSTSEnforcerDB(FilenameVar string) *HSTSEnforcerDB

Creates a #SoupHSTSEnforcerDB.

@filename will be read in during the initialization of a #SoupHSTSEnforcerDB, in order to create an initial set of HSTS policies. If the file doesn't exist, a new database will be created and initialized. Changes to the policies during the lifetime of a #SoupHSTSEnforcerDB will be written to @filename when [signal@HSTSEnforcer::changed] is emitted.

func (*HSTSEnforcerDB) GetPropertyFilename added in v0.0.4

func (x *HSTSEnforcerDB) GetPropertyFilename() string

GetPropertyFilename gets the "filename" property. The filename of the SQLite database where HSTS policies are stored.

func (*HSTSEnforcerDB) GoPointer

func (c *HSTSEnforcerDB) GoPointer() uintptr

func (*HSTSEnforcerDB) SetGoPointer

func (c *HSTSEnforcerDB) SetGoPointer(ptr uintptr)

func (*HSTSEnforcerDB) SetPropertyFilename added in v0.0.4

func (x *HSTSEnforcerDB) SetPropertyFilename(value string)

SetPropertyFilename sets the "filename" property. The filename of the SQLite database where HSTS policies are stored.

type HSTSEnforcerDBClass

type HSTSEnforcerDBClass struct {
	ParentClass HSTSEnforcerClass
	// contains filtered or unexported fields
}

func (*HSTSEnforcerDBClass) GoPointer

func (x *HSTSEnforcerDBClass) GoPointer() uintptr

type HSTSPolicy

type HSTSPolicy struct {
	// contains filtered or unexported fields
}

#SoupHSTSPolicy implements HTTP policies, as described by [RFC 6797](http://tools.ietf.org/html/rfc6797).

@domain represents the host that this policy applies to. The domain must be IDNA-canonicalized. [ctor@HSTSPolicy.new] and related methods will do this for you.

@max_age contains the 'max-age' value from the Strict Transport Security header and indicates the time to live of this policy, in seconds.

@expires will be non-%NULL if the policy has been set by the host and hence has an expiry time. If @expires is %NULL, it indicates that the policy is a permanent session policy set by the user agent.

If @include_subdomains is %TRUE, the Strict Transport Security policy must also be enforced on subdomains of @domain.

func NewHSTSPolicy

func NewHSTSPolicy(DomainVar string, MaxAgeVar uint, IncludeSubdomainsVar bool) *HSTSPolicy

Creates a new #SoupHSTSPolicy with the given attributes.

@domain is a domain on which the strict transport security policy represented by this object must be enforced.

@max_age is used to set the "expires" attribute on the policy; pass %SOUP_HSTS_POLICY_MAX_AGE_PAST for an already-expired policy, or a lifetime in seconds.

If @include_subdomains is %TRUE, the strict transport security policy must also be enforced on all subdomains of @domain.

func NewHSTSPolicyFromResponse

func NewHSTSPolicyFromResponse(MsgVar *Message) *HSTSPolicy

Parses @msg's first "Strict-Transport-Security" response header and returns a #SoupHSTSPolicy.

func NewHSTSPolicyFull

func NewHSTSPolicyFull(DomainVar string, MaxAgeVar uint, ExpiresVar *glib.DateTime, IncludeSubdomainsVar bool) *HSTSPolicy

Full version of [ctor@HSTSPolicy.new], to use with an existing expiration date.

See [ctor@HSTSPolicy.new] for details.

func NewHSTSPolicySessionPolicy

func NewHSTSPolicySessionPolicy(DomainVar string, IncludeSubdomainsVar bool) *HSTSPolicy

Creates a new session #SoupHSTSPolicy with the given attributes.

A session policy is a policy that is valid during the lifetime of the [class@HSTSEnforcer] it is added to. Contrary to regular policies, it has no expiration date and is not stored in persistent enforcers. These policies are useful for user-agent to load their own or user-defined rules.

@domain is a domain on which the strict transport security policy represented by this object must be enforced.

If @include_subdomains is %TRUE, the strict transport security policy must also be enforced on all subdomains of @domain.

func (*HSTSPolicy) Copy

func (x *HSTSPolicy) Copy() *HSTSPolicy

Copies @policy.

func (*HSTSPolicy) Equal

func (x *HSTSPolicy) Equal(Policy2Var *HSTSPolicy) bool

Tests if @policy1 and @policy2 are equal.

func (*HSTSPolicy) Free

func (x *HSTSPolicy) Free()

Frees @policy.

func (*HSTSPolicy) GetDomain

func (x *HSTSPolicy) GetDomain() string

Gets @policy's domain.

func (*HSTSPolicy) GetExpires

func (x *HSTSPolicy) GetExpires() *glib.DateTime

Returns the expiration date for @policy.

func (*HSTSPolicy) GetMaxAge

func (x *HSTSPolicy) GetMaxAge() uint

Returns the max age for @policy.

func (*HSTSPolicy) GoPointer

func (x *HSTSPolicy) GoPointer() uintptr

func (*HSTSPolicy) IncludesSubdomains

func (x *HSTSPolicy) IncludesSubdomains() bool

Gets whether @policy include its subdomains.

func (*HSTSPolicy) IsExpired

func (x *HSTSPolicy) IsExpired() bool

Gets whether @policy is expired.

Permanent policies never expire.

func (*HSTSPolicy) IsSessionPolicy

func (x *HSTSPolicy) IsSessionPolicy() bool

Gets whether @policy is a non-permanent, non-expirable session policy.

See [ctor@HSTSPolicy.new_session_policy] for details.

type HTTPVersion

type HTTPVersion int

Indicates the HTTP protocol version being used.

const (

	// HTTP 1.0 (RFC 1945)
	Http10Value HTTPVersion = 0
	// HTTP 1.1 (RFC 2616)
	Http11Value HTTPVersion = 1
	// HTTP 2.0 (RFC 7540)
	Http20Value HTTPVersion = 2
)

type Logger

type Logger struct {
	gobject.Object
}

Debug logging support

#SoupLogger watches a [class@Session] and logs the HTTP traffic that it generates, for debugging purposes. Many applications use an environment variable to determine whether or not to use #SoupLogger, and to determine the amount of debugging output.

To use #SoupLogger, first create a logger with [ctor@Logger.new], optionally configure it with [method@Logger.set_request_filter], [method@Logger.set_response_filter], and [method@Logger.set_printer], and then attach it to a session (or multiple sessions) with [method@Session.add_feature].

By default, the debugging output is sent to `stdout`, and looks something like:

``` > POST /unauth HTTP/1.1 > Soup-Debug-Timestamp: 1200171744 > Soup-Debug: SoupSession 1 (0x612190), SoupMessage 1 (0x617000), GSocket 1 (0x612220) > Host: localhost > Content-Type: text/plain > Connection: close

< HTTP/1.1 201 Created < Soup-Debug-Timestamp: 1200171744 < Soup-Debug: SoupMessage 1 (0x617000) < Date: Sun, 12 Jan 2008 21:02:24 GMT < Content-Length: 0 ```

The `Soup-Debug-Timestamp` line gives the time (as a `time_t`) when the request was sent, or the response fully received.

The `Soup-Debug` line gives further debugging information about the [class@Session], [class@Message], and [class@Gio.Socket] involved; the hex numbers are the addresses of the objects in question (which may be useful if you are running in a debugger). The decimal IDs are simply counters that uniquely identify objects across the lifetime of the #SoupLogger. In particular, this can be used to identify when multiple messages are sent across the same connection.

Currently, the request half of the message is logged just before the first byte of the request gets written to the network (from the [signal@Message::starting] signal).

The response is logged just after the last byte of the response body is read from the network (from the [signal@Message::got-body] or [signal@Message::got-informational] signal), which means that the [signal@Message::got-headers] signal, and anything triggered off it (such as #SoupMessage::authenticate) will be emitted *before* the response headers are actually logged.

If the response doesn't happen to trigger the [signal@Message::got-body] nor [signal@Message::got-informational] signals due to, for example, a cancellation before receiving the last byte of the response body, the response will still be logged on the event of the [signal@Message::finished] signal.

func LoggerNewFromInternalPtr

func LoggerNewFromInternalPtr(ptr uintptr) *Logger

func NewLogger

func NewLogger(LevelVar LoggerLogLevel) *Logger

Creates a new #SoupLogger with the given debug level.

If you need finer control over what message parts are and aren't logged, use [method@Logger.set_request_filter] and [method@Logger.set_response_filter].

func (*Logger) GetMaxBodySize

func (x *Logger) GetMaxBodySize() int

Get the maximum body size for @logger.

func (*Logger) GetPropertyMaxBodySize added in v0.0.4

func (x *Logger) GetPropertyMaxBodySize() int

GetPropertyMaxBodySize gets the "max-body-size" property. If [property@Logger:level] is %SOUP_LOGGER_LOG_BODY, this gives the maximum number of bytes of the body that will be logged. (-1 means "no limit".)

func (*Logger) GoPointer

func (c *Logger) GoPointer() uintptr

func (*Logger) SetGoPointer

func (c *Logger) SetGoPointer(ptr uintptr)

func (*Logger) SetMaxBodySize

func (x *Logger) SetMaxBodySize(MaxBodySizeVar int)

Sets the maximum body size for @logger (-1 means no limit).

func (*Logger) SetPrinter

func (x *Logger) SetPrinter(PrinterVar *LoggerPrinter, PrinterDataVar uintptr, DestroyVar *glib.DestroyNotify)

Sets up an alternate log printing routine, if you don't want the log to go to `stdout`.

func (*Logger) SetPropertyMaxBodySize added in v0.0.4

func (x *Logger) SetPropertyMaxBodySize(value int)

SetPropertyMaxBodySize sets the "max-body-size" property. If [property@Logger:level] is %SOUP_LOGGER_LOG_BODY, this gives the maximum number of bytes of the body that will be logged. (-1 means "no limit".)

func (*Logger) SetRequestFilter

func (x *Logger) SetRequestFilter(RequestFilterVar *LoggerFilter, FilterDataVar uintptr, DestroyVar *glib.DestroyNotify)

Sets up a filter to determine the log level for a given request.

For each HTTP request @logger will invoke @request_filter to determine how much (if any) of that request to log. (If you do not set a request filter, @logger will just always log requests at the level passed to [ctor@Logger.new].)

func (*Logger) SetResponseFilter

func (x *Logger) SetResponseFilter(ResponseFilterVar *LoggerFilter, FilterDataVar uintptr, DestroyVar *glib.DestroyNotify)

Sets up a filter to determine the log level for a given response.

For each HTTP response @logger will invoke @response_filter to determine how much (if any) of that response to log. (If you do not set a response filter, @logger will just always log responses at the level passed to [ctor@Logger.new].)

type LoggerClass

type LoggerClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*LoggerClass) GoPointer

func (x *LoggerClass) GoPointer() uintptr

type LoggerFilter

type LoggerFilter func(uintptr, uintptr, uintptr) LoggerLogLevel

The prototype for a logging filter.

The filter callback will be invoked for each request or response, and should analyze it and return a [enum@LoggerLogLevel] value indicating how much of the message to log.

type LoggerLogLevel

type LoggerLogLevel int

Describes the level of logging output to provide.

const (

	// No logging
	LoggerLogNoneValue LoggerLogLevel = 0
	// Log the Request-Line or Status-Line and
	//   the Soup-Debug pseudo-headers
	LoggerLogMinimalValue LoggerLogLevel = 1
	// Log the full request/response headers
	LoggerLogHeadersValue LoggerLogLevel = 2
	// Log the full headers and request/response bodies
	LoggerLogBodyValue LoggerLogLevel = 3
)

type LoggerPrinter

type LoggerPrinter func(uintptr, LoggerLogLevel, byte, string, uintptr)

The prototype for a custom printing callback.

@level indicates what kind of information is being printed. Eg, it will be %SOUP_LOGGER_LOG_HEADERS if @data is header data.

@direction is either '<', '>', or ' ', and @data is the single line to print; the printer is expected to add a terminating newline.

To get the effect of the default printer, you would do:

```c printf ("%c %s\n", direction, data); ```

type MemoryUse

type MemoryUse int

The lifetime of the memory being passed.

const (

	// The memory is statically allocated and
	//   constant; libsoup can use the passed-in buffer directly and not
	//   need to worry about it being modified or freed.
	MemoryStaticValue MemoryUse = 0
	// The caller has allocated the memory and libsoup
	//   will assume ownership of it and free it with [func@GLib.free].
	MemoryTakeValue MemoryUse = 1
	// The passed-in data belongs to the caller and
	//   libsoup will copy it into new memory leaving the caller free
	//   to reuse the original memory.
	MemoryCopyValue MemoryUse = 2
)

type Message

type Message struct {
	gobject.Object
}

Represents an HTTP message being sent or received.

A #SoupMessage represents an HTTP message that is being sent or received.

You would create a #SoupMessage with [ctor@Message.new] or [ctor@Message.new_from_uri], set up its fields appropriately, and send it.

[property@Message:status-code] will normally be a [enum@Status] value, eg, %SOUP_STATUS_OK, though of course it might actually be an unknown status code. [property@Message:reason-phrase] is the actual text returned from the server, which may or may not correspond to the "standard" description of @status_code. At any rate, it is almost certainly not localized, and not very descriptive even if it is in the user's language; you should not use [property@Message:reason-phrase] in user-visible messages. Rather, you should look at [property@Message:status-code], and determine an end-user-appropriate message based on that and on what you were trying to do.

Note that libsoup's terminology here does not quite match the HTTP specification: in RFC 2616, an "HTTP-message" is *either* a Request, *or* a Response. In libsoup, a #SoupMessage combines both the request and the response.

func MessageNewFromInternalPtr

func MessageNewFromInternalPtr(ptr uintptr) *Message

func NewMessage

func NewMessage(MethodVar string, UriStringVar string) *Message

Creates a new empty #SoupMessage, which will connect to @uri.

func NewMessageFromEncodedForm

func NewMessageFromEncodedForm(MethodVar string, UriStringVar string, EncodedFormVar string) *Message

Creates a new #SoupMessage and sets it up to send the given @encoded_form to @uri via @method. If @method is "GET", it will include the form data into @uri's query field, and if @method is "POST" or "PUT", it will be set as request body.

This function takes the ownership of @encoded_form, that will be released with [func@GLib.free] when no longer in use. See also [func@form_encode], [func@form_encode_hash] and [func@form_encode_datalist].

func NewMessageFromMultipart

func NewMessageFromMultipart(UriStringVar string, MultipartVar *Multipart) *Message

Creates a new #SoupMessage and sets it up to send @multipart to @uri_string via POST.

func NewMessageFromUri

func NewMessageFromUri(MethodVar string, UriVar *glib.Uri) *Message

Creates a new empty #SoupMessage, which will connect to @uri.

func NewMessageOptionsPing

func NewMessageOptionsPing(BaseUriVar *glib.Uri) *Message

Creates a new #SoupMessage to send `OPTIONS *` to a server. The path of @base_uri will be ignored.

func (*Message) AddFlags

func (x *Message) AddFlags(FlagsVar MessageFlags)

Adds @flags to the set of @msg's flags.

func (*Message) AddHeaderHandler

func (x *Message) AddHeaderHandler(SignalVar string, HeaderVar string, CallbackVar *gobject.Callback, UserDataVar uintptr) uint

Adds a signal handler to @msg for @signal.

Similar to [func@GObject.signal_connect], but the @callback will only be run if @msg's incoming messages headers (that is, the `request_headers`) contain a header named @header.

func (*Message) AddStatusCodeHandler

func (x *Message) AddStatusCodeHandler(SignalVar string, StatusCodeVar uint, CallbackVar *gobject.Callback, UserDataVar uintptr) uint

Adds a signal handler to @msg for @signal.

Similar to [func@GObject.signal_connect], but the @callback will only be run if @msg has the status @status_code.

@signal must be a signal that will be emitted after @msg's status is set (this means it can't be a "wrote" signal).

func (*Message) ConnectAcceptCertificate

func (x *Message) ConnectAcceptCertificate(cb *func(Message, uintptr, gio.TlsCertificateFlags) bool) uint

Emitted during the @msg's connection TLS handshake after an unacceptable TLS certificate has been received.

You can return %TRUE to accept @tls_certificate despite @tls_errors.

func (*Message) ConnectAuthenticate

func (x *Message) ConnectAuthenticate(cb *func(Message, uintptr, bool) bool) uint

Emitted when the message requires authentication.

If credentials are available call [method@Auth.authenticate] on @auth. If these credentials fail, the signal will be emitted again, with @retrying set to %TRUE, which will continue until you return without calling [method@Auth.authenticate] on @auth.

Note that this may be emitted before @msg's body has been fully read.

You can authenticate @auth asynchronously by calling [method@GObject.Object.ref] on @auth and returning %TRUE. The operation will complete once either [method@Auth.authenticate] or [method@Auth.cancel] are called.

func (*Message) ConnectContentSniffed

func (x *Message) ConnectContentSniffed(cb *func(Message, string, uintptr)) uint

This signal is emitted after [signal@Message::got-headers].

If content sniffing is disabled, or no content sniffing will be performed, due to the sniffer deciding to trust the Content-Type sent by the server, this signal is emitted immediately after [signal@Message::got-headers], and @type is %NULL.

func (*Message) ConnectFinished

func (x *Message) ConnectFinished(cb *func(Message)) uint

Emitted when all HTTP processing is finished for a message.

(After [signal@Message::got_body]).

func (*Message) ConnectGotBody

func (x *Message) ConnectGotBody(cb *func(Message)) uint

Emitted after receiving the complete message response body.

func (*Message) ConnectGotBodyData

func (x *Message) ConnectGotBodyData(cb *func(Message, uint)) uint

Emitted after reading a portion of the message body from the network.

func (*Message) ConnectGotHeaders

func (x *Message) ConnectGotHeaders(cb *func(Message)) uint

Emitted after receiving the Status-Line and response headers.

See also [method@Message.add_header_handler] and [method@Message.add_status_code_handler], which can be used to connect to a subset of emissions of this signal.

If you cancel or requeue @msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and @msg's connection will be closed. (If you need to requeue a message--eg, after handling authentication or redirection--it is usually better to requeue it from a [signal@Message::got-body] handler rather than a [signal@Message::got_headers] handler, so that the existing HTTP connection can be reused.)

func (*Message) ConnectGotInformational

func (x *Message) ConnectGotInformational(cb *func(Message)) uint

Emitted after receiving a 1xx (Informational) response for a (client-side) message.

The response_headers will be filled in with the headers associated with the informational response; however, those header values will be erased after this signal is done.

If you cancel or requeue @msg while processing this signal, then the current HTTP I/O will be stopped after this signal emission finished, and @msg's connection will be closed.

func (*Message) ConnectHstsEnforced

func (x *Message) ConnectHstsEnforced(cb *func(Message)) uint

Emitted when [class@HSTSEnforcer] has upgraded the protocol for @msg to HTTPS as a result of matching its domain with a HSTS policy.

func (*Message) ConnectNetworkEvent

func (x *Message) ConnectNetworkEvent(cb *func(Message, gio.SocketClientEvent, uintptr)) uint

Emitted to indicate that some network-related event related to @msg has occurred.

This essentially proxies the [signal@Gio.SocketClient::event] signal, but only for events that occur while @msg "owns" the connection; if @msg is sent on an existing persistent connection, then this signal will not be emitted. (If you want to force the message to be sent on a new connection, set the %SOUP_MESSAGE_NEW_CONNECTION flag on it.)

See [signal@Gio.SocketClient::event] for more information on what the different values of @event correspond to, and what @connection will be in each case.

func (*Message) ConnectRequestCertificate

func (x *Message) ConnectRequestCertificate(cb *func(Message, uintptr) bool) uint

Emitted during the @msg's connection TLS handshake when @tls_connection requests a certificate from the client.

You can set the client certificate by calling [method@Message.set_tls_client_certificate] and returning %TRUE. It's possible to handle the request asynchornously by returning %TRUE and call [method@Message.set_tls_client_certificate] later once the certificate is available. Note that this signal is not emitted if [property@Session:tls-interaction] was set, or if [method@Message.set_tls_client_certificate] was called before the connection TLS handshake started.

func (*Message) ConnectRequestCertificatePassword

func (x *Message) ConnectRequestCertificatePassword(cb *func(Message, uintptr) bool) uint

Emitted during the @msg's connection TLS handshake when @tls_connection requests a certificate password from the client.

You can set the certificate password on @password, then call [method@Message.tls_client_certificate_password_request_complete] and return %TRUE to handle the signal synchronously. It's possible to handle the request asynchornously by calling [method@GObject.Object.ref] on @password, then returning %TRUE and call [method@Message.tls_client_certificate_password_request_complete] later after setting the password on @password. Note that this signal is not emitted if [property@Session:tls-interaction] was set.

func (*Message) ConnectRestarted

func (x *Message) ConnectRestarted(cb *func(Message)) uint

Emitted when a request that was already sent once is now being sent again.

e.g. because the first attempt received a redirection response, or because we needed to use authentication.

func (*Message) ConnectStarting

func (x *Message) ConnectStarting(cb *func(Message)) uint

Emitted just before a message is sent.

func (*Message) ConnectWroteBody

func (x *Message) ConnectWroteBody(cb *func(Message)) uint

Emitted immediately after writing the complete body for a message.

func (*Message) ConnectWroteBodyData

func (x *Message) ConnectWroteBodyData(cb *func(Message, uint)) uint

Emitted immediately after writing a portion of the message body to the network.

func (*Message) ConnectWroteHeaders

func (x *Message) ConnectWroteHeaders(cb *func(Message)) uint

Emitted immediately after writing the request headers for a message.

func (*Message) DisableFeature

func (x *Message) DisableFeature(FeatureTypeVar types.GType)

Disables the actions of [iface@SessionFeature]s with the given @feature_type (or a subclass of that type) on @msg.

@msg is processed as though the feature(s) hadn't been added to the session. Eg, passing #SOUP_TYPE_CONTENT_SNIFFER for @feature_type will disable Content-Type sniffing on the message.

You must call this before queueing @msg on a session; calling it on a message that has already been queued is undefined. In particular, you cannot call this on a message that is being requeued after a redirect or authentication.

func (*Message) GetConnectionId

func (x *Message) GetConnectionId() uint64

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.

func (*Message) GetFirstParty

func (x *Message) GetFirstParty() *glib.Uri

Gets @msg's first-party [struct@GLib.Uri].

func (*Message) GetFlags

func (x *Message) GetFlags() MessageFlags

Gets the flags on @msg.

func (*Message) GetForceHttp1

func (x *Message) GetForceHttp1() bool

Returns whether HTTP/1 version is currently demanded for the @msg send.

func (*Message) GetHttpVersion

func (x *Message) GetHttpVersion() HTTPVersion

Gets the HTTP version of @msg.

This is the minimum of the version from the request and the version from the response.

func (*Message) GetIsOptionsPing

func (x *Message) GetIsOptionsPing() bool

Gets whether @msg is intended to be used to send `OPTIONS *` to a server.

func (*Message) GetIsTopLevelNavigation

func (x *Message) GetIsTopLevelNavigation() bool

Returns if this message is set as a top level navigation.

Used for same-site policy checks.

func (*Message) GetMethod

func (x *Message) GetMethod() string

Returns the method of this message.

func (*Message) GetMetrics

func (x *Message) GetMetrics() *MessageMetrics

Get the [struct@MessageMetrics] of @msg.

If the flag %SOUP_MESSAGE_COLLECT_METRICS is not enabled for @msg this will return %NULL.

func (*Message) GetPriority

func (x *Message) GetPriority() MessagePriority

Retrieves the [enum@MessagePriority].

If not set this value defaults to #SOUP_MESSAGE_PRIORITY_NORMAL.

func (*Message) GetPropertyFirstParty added in v0.0.4

func (x *Message) GetPropertyFirstParty() uintptr

GetPropertyFirstParty gets the "first-party" property. The [struct@GLib.Uri] loaded in the application when the message was queued.

func (*Message) GetPropertyIsOptionsPing added in v0.0.4

func (x *Message) GetPropertyIsOptionsPing() bool

GetPropertyIsOptionsPing gets the "is-options-ping" property. Whether the message is an OPTIONS ping.

The #SoupMessage is intended to be used to send `OPTIONS *` to a server. When set to %TRUE, the path of [property@Message:uri] will be ignored and [property@Message:method] set to %SOUP_METHOD_OPTIONS.

func (*Message) GetPropertyIsTopLevelNavigation added in v0.0.4

func (x *Message) GetPropertyIsTopLevelNavigation() bool

GetPropertyIsTopLevelNavigation gets the "is-top-level-navigation" property. Set when the message is navigating between top level domains.

func (*Message) GetPropertyMethod added in v0.0.4

func (x *Message) GetPropertyMethod() string

GetPropertyMethod gets the "method" property. The message's HTTP method.

func (*Message) GetPropertyReasonPhrase added in v0.0.4

func (x *Message) GetPropertyReasonPhrase() string

GetPropertyReasonPhrase gets the "reason-phrase" property. The HTTP response reason phrase.

func (*Message) GetPropertyRequestHeaders added in v0.0.4

func (x *Message) GetPropertyRequestHeaders() uintptr

GetPropertyRequestHeaders gets the "request-headers" property. The HTTP request headers.

func (*Message) GetPropertyResponseHeaders added in v0.0.4

func (x *Message) GetPropertyResponseHeaders() uintptr

GetPropertyResponseHeaders gets the "response-headers" property. The HTTP response headers.

func (*Message) GetPropertySiteForCookies added in v0.0.4

func (x *Message) GetPropertySiteForCookies() uintptr

GetPropertySiteForCookies gets the "site-for-cookies" property. Site used to compare cookies against. Used for SameSite cookie support.

func (*Message) GetPropertyStatusCode added in v0.0.4

func (x *Message) GetPropertyStatusCode() uint

GetPropertyStatusCode gets the "status-code" property. The HTTP response status code.

func (*Message) GetPropertyTlsCiphersuiteName added in v0.0.4

func (x *Message) GetPropertyTlsCiphersuiteName() string

GetPropertyTlsCiphersuiteName gets the "tls-ciphersuite-name" property. The Name of TLS ciphersuite negotiated for this message connection.

func (*Message) GetPropertyUri added in v0.0.4

func (x *Message) GetPropertyUri() uintptr

GetPropertyUri gets the "uri" property. The message's Request-URI.

func (*Message) GetReasonPhrase

func (x *Message) GetReasonPhrase() string

Returns the reason phrase for the status of this message.

func (*Message) GetRemoteAddress

func (x *Message) GetRemoteAddress() *gio.SocketAddress

Get the remote [class@Gio.SocketAddress] of the connection associated with the message.

The returned address can be %NULL if the connection hasn't been established yet, or the resource was loaded from the disk cache. In case of proxy connections, the remote address returned is a [class@Gio.ProxyAddress]. If [property@Session:remote-connectable] is set the returned address id for the connection to the session's remote connectable.

func (*Message) GetRequestHeaders

func (x *Message) GetRequestHeaders() *MessageHeaders

Returns the headers sent with the request.

func (*Message) GetResponseHeaders

func (x *Message) GetResponseHeaders() *MessageHeaders

Returns the headers recieved with the response.

func (*Message) GetSiteForCookies

func (x *Message) GetSiteForCookies() *glib.Uri

Gets @msg's site for cookies #GUri.

func (*Message) GetStatus

func (x *Message) GetStatus() Status

Returns the set status of this message.

func (*Message) GetTlsCiphersuiteName

func (x *Message) GetTlsCiphersuiteName() string

Gets the name of the TLS ciphersuite negotiated for @msg's connection.

func (*Message) GetTlsPeerCertificate

func (x *Message) GetTlsPeerCertificate() *gio.TlsCertificate

Gets the peer's [class@Gio.TlsCertificate] associated with @msg's connection.

Note that this is not set yet during the emission of [signal@Message::accept-certificate] signal.

func (*Message) GetTlsPeerCertificateErrors

func (x *Message) GetTlsPeerCertificateErrors() gio.TlsCertificateFlags

Gets the errors associated with validating @msg's TLS peer certificate. Note that this is not set yet during the emission of [signal@Message::accept-certificate] signal.

func (*Message) GetTlsProtocolVersion

func (x *Message) GetTlsProtocolVersion() gio.TlsProtocolVersion

Gets the TLS protocol version negotiated for @msg's connection.

If the message connection is not SSL, %G_TLS_PROTOCOL_VERSION_UNKNOWN is returned.

func (*Message) GetUri

func (x *Message) GetUri() *glib.Uri

Gets @msg's URI.

func (*Message) GoPointer

func (c *Message) GoPointer() uintptr

func (*Message) IsFeatureDisabled

func (x *Message) IsFeatureDisabled(FeatureTypeVar types.GType) bool

Get whether [iface@SessionFeature]s of the given @feature_type (or a subclass of that type) are disabled on @msg.

See [method@Message.disable_feature].

func (*Message) IsKeepalive

func (x *Message) IsKeepalive() bool

Determines whether or not @msg's connection can be kept alive for further requests after processing @msg.

The result is based on the HTTP version, Connection header, etc.

func (*Message) QueryFlags

func (x *Message) QueryFlags(FlagsVar MessageFlags) bool

Queries if @flags are present in the set of @msg's flags.

func (*Message) RemoveFlags

func (x *Message) RemoveFlags(FlagsVar MessageFlags)

Removes @flags from the set of @msg's flags.

func (*Message) SetFirstParty

func (x *Message) SetFirstParty(FirstPartyVar *glib.Uri)

Sets @first_party as the main document #GUri for @msg.

For details of when and how this is used refer to the documentation for [enum@CookieJarAcceptPolicy].

func (*Message) SetFlags

func (x *Message) SetFlags(FlagsVar MessageFlags)

Sets the specified flags on @msg.

func (*Message) SetForceHttp1

func (x *Message) SetForceHttp1(ValueVar bool)

Sets whether HTTP/1 version should be used when sending this message. Some connections can still override it, if needed.

Note the value is unset after the message send is finished.

func (*Message) SetGoPointer

func (c *Message) SetGoPointer(ptr uintptr)

func (*Message) SetIsOptionsPing

func (x *Message) SetIsOptionsPing(IsOptionsPingVar bool)

Set whether @msg is intended to be used to send `OPTIONS *` to a server.

When set to %TRUE, the path of [property@Message:uri] will be ignored and [property@Message:method] set to %SOUP_METHOD_OPTIONS.

func (*Message) SetIsTopLevelNavigation

func (x *Message) SetIsTopLevelNavigation(IsTopLevelNavigationVar bool)

Sets whether the current request is a top-level navitation.

See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more information.

func (*Message) SetMethod

func (x *Message) SetMethod(MethodVar string)

Set @msg's HTTP method to @method.

func (*Message) SetPriority

func (x *Message) SetPriority(PriorityVar MessagePriority)

Sets the priority of a message.

Note that this won't have any effect unless used before the message is added to the session's message processing queue.

The message will be placed just before any other previously added message with lower priority (messages with the same priority are processed on a FIFO basis).

Setting priorities does not currently work with synchronous messages because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling.

func (*Message) SetPropertyFirstParty added in v0.0.4

func (x *Message) SetPropertyFirstParty(value uintptr)

SetPropertyFirstParty sets the "first-party" property. The [struct@GLib.Uri] loaded in the application when the message was queued.

func (*Message) SetPropertyIsOptionsPing added in v0.0.4

func (x *Message) SetPropertyIsOptionsPing(value bool)

SetPropertyIsOptionsPing sets the "is-options-ping" property. Whether the message is an OPTIONS ping.

The #SoupMessage is intended to be used to send `OPTIONS *` to a server. When set to %TRUE, the path of [property@Message:uri] will be ignored and [property@Message:method] set to %SOUP_METHOD_OPTIONS.

func (*Message) SetPropertyIsTopLevelNavigation added in v0.0.4

func (x *Message) SetPropertyIsTopLevelNavigation(value bool)

SetPropertyIsTopLevelNavigation sets the "is-top-level-navigation" property. Set when the message is navigating between top level domains.

func (*Message) SetPropertyMethod added in v0.0.4

func (x *Message) SetPropertyMethod(value string)

SetPropertyMethod sets the "method" property. The message's HTTP method.

func (*Message) SetPropertySiteForCookies added in v0.0.4

func (x *Message) SetPropertySiteForCookies(value uintptr)

SetPropertySiteForCookies sets the "site-for-cookies" property. Site used to compare cookies against. Used for SameSite cookie support.

func (*Message) SetPropertyUri added in v0.0.4

func (x *Message) SetPropertyUri(value uintptr)

SetPropertyUri sets the "uri" property. The message's Request-URI.

func (*Message) SetRequestBody

func (x *Message) SetRequestBody(ContentTypeVar *string, StreamVar *gio.InputStream, ContentLengthVar int)

Set the request body of a #SoupMessage.

If @content_type is %NULL and @stream is not %NULL the Content-Type header will not be changed if present. The request body needs to be set again in case @msg is restarted (in case of redirection or authentication).

func (*Message) SetRequestBodyFromBytes

func (x *Message) SetRequestBodyFromBytes(ContentTypeVar *string, BytesVar *glib.Bytes)

Set the request body of a #SoupMessage from [struct@GLib.Bytes].

If @content_type is %NULL and @bytes is not %NULL the Content-Type header will not be changed if present. The request body needs to be set again in case @msg is restarted (in case of redirection or authentication).

func (*Message) SetSiteForCookies

func (x *Message) SetSiteForCookies(SiteForCookiesVar *glib.Uri)

Sets @site_for_cookies as the policy URL for same-site cookies for @msg.

It is either the URL of the top-level document or %NULL depending on whether the registrable domain of this document's URL matches the registrable domain of its parent's/opener's URL. For the top-level document it is set to the document's URL.

See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) for more information.

func (*Message) SetTlsClientCertificate

func (x *Message) SetTlsClientCertificate(CertificateVar *gio.TlsCertificate)

Sets the @certificate to be used by @msg's connection when a client certificate is requested during the TLS handshake.

You can call this as a response to [signal@Message::request-certificate] signal, or before the connection is started. If @certificate is %NULL the handshake will continue without providing a GTlsCertificate. Note that the [class@Gio.TlsCertificate] set by this function will be ignored if [property@Session:tls-interaction] is not %NULL.

func (*Message) SetUri

func (x *Message) SetUri(UriVar *glib.Uri)

Sets @msg's URI to @uri.

If @msg has already been sent and you want to re-send it with the new URI, you need to send it again.

func (*Message) TlsClientCertificatePasswordRequestComplete

func (x *Message) TlsClientCertificatePasswordRequestComplete()

Completes a certificate password request.

You must call this as a response to [signal@Message::request-certificate-password] signal, to notify @msg that the [class@Gio.TlsPassword] has already been updated.

type MessageBody

type MessageBody struct {
	Data uintptr

	Length int64
	// contains filtered or unexported fields
}

#SoupMessageBody represents the request or response body of a [class@Message].

Note that while @length always reflects the full length of the message body, @data is normally %NULL, and will only be filled in after [method@MessageBody.flatten] is called. For client-side messages, this automatically happens for the response body after it has been fully read. Likewise, for server-side messages, the request body is automatically filled in after being read.

As an added bonus, when @data is filled in, it is always terminated with a `\0` byte (which is not reflected in @length).

func NewMessageBody

func NewMessageBody() *MessageBody

Creates a new #SoupMessageBody.

[class@Message] uses this internally; you will not normally need to call it yourself.

func (*MessageBody) Append

func (x *MessageBody) Append(UseVar MemoryUse, DataVar []byte, LengthVar uint)

Appends @length bytes from @data to @body according to @use.

func (*MessageBody) AppendBytes

func (x *MessageBody) AppendBytes(BufferVar *glib.Bytes)

Appends the data from @buffer to @body.

func (*MessageBody) AppendTake

func (x *MessageBody) AppendTake(DataVar []byte, LengthVar uint)

Appends @length bytes from @data to @body.

This function is exactly equivalent to [method@MessageBody.append] with %SOUP_MEMORY_TAKE as second argument; it exists mainly for convenience and simplifying language bindings.

func (*MessageBody) Complete

func (x *MessageBody) Complete()

Tags @body as being complete.

Call this when using chunked encoding after you have appended the last chunk.

func (*MessageBody) Flatten

func (x *MessageBody) Flatten() *glib.Bytes

Fills in @body's data field with a buffer containing all of the data in @body.

Adds an additional `\0` byte not counted by @body's length field.

func (*MessageBody) GetAccumulate

func (x *MessageBody) GetAccumulate() bool

Gets the accumulate flag on @body.

See [method@MessageBody.set_accumulate. for details.

func (*MessageBody) GetChunk

func (x *MessageBody) GetChunk(OffsetVar int64) *glib.Bytes

Gets a [struct@GLib.Bytes] containing data from @body starting at @offset.

The size of the returned chunk is unspecified. You can iterate through the entire body by first calling [method@MessageBody.get_chunk] with an offset of 0, and then on each successive call, increment the offset by the length of the previously-returned chunk.

If @offset is greater than or equal to the total length of @body, then the return value depends on whether or not [method@MessageBody.complete] has been called or not; if it has, then [method@MessageBody.get_chunk] will return a 0-length chunk (indicating the end of @body). If it has not, then [method@MessageBody.get_chunk] will return %NULL (indicating that @body may still potentially have more data, but that data is not currently available).

func (*MessageBody) GoPointer

func (x *MessageBody) GoPointer() uintptr

func (*MessageBody) GotChunk

func (x *MessageBody) GotChunk(ChunkVar *glib.Bytes)

Handles the #SoupMessageBody part of receiving a chunk of data from the network.

Normally this means appending @chunk to @body, exactly as with [method@MessageBody.append_bytes], but if you have set @body's accumulate flag to %FALSE, then that will not happen.

This is a low-level method which you should not normally need to use.

func (*MessageBody) Ref

func (x *MessageBody) Ref() *MessageBody

Atomically increments the reference count of @body by one.

func (*MessageBody) SetAccumulate

func (x *MessageBody) SetAccumulate(AccumulateVar bool)

Sets or clears the accumulate flag on @body.

(The default value is %TRUE.) If set to %FALSE, @body's data field will not be filled in after the body is fully sent/received, and the chunks that make up @body may be discarded when they are no longer needed.

If you set the flag to %FALSE on the [class@Message] request_body of a client-side message, it will block the accumulation of chunks into @body's data field, but it will not normally cause the chunks to be discarded after being written like in the server-side [class@Message] response_body case, because the request body needs to be kept around in case the request needs to be sent a second time due to redirection or authentication.

func (*MessageBody) Truncate

func (x *MessageBody) Truncate()

Deletes all of the data in @body.

func (*MessageBody) Unref

func (x *MessageBody) Unref()

Atomically decrements the reference count of @body by one.

When the reference count reaches zero, the resources allocated by @body are freed

func (*MessageBody) WroteChunk

func (x *MessageBody) WroteChunk(ChunkVar *glib.Bytes)

Handles the #SoupMessageBody part of writing a chunk of data to the network.

Normally this is a no-op, but if you have set @body's accumulate flag to %FALSE, then this will cause @chunk to be discarded to free up memory.

This is a low-level method which you should not need to use, and there are further restrictions on its proper use which are not documented here.

type MessageClass

type MessageClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*MessageClass) GoPointer

func (x *MessageClass) GoPointer() uintptr

type MessageFlags

type MessageFlags int

Various flags that can be set on a #SoupMessage to alter its behavior.

const (

	// The session should not follow redirect
	//   (3xx) responses received by this message.
	MessageNoRedirectValue MessageFlags = 2
	// Requests that the message should be
	//   sent on a newly-created connection, not reusing an existing
	//   persistent connection. Note that messages with non-idempotent
	//   [property@Message:method]s behave this way by default, unless
	//   #SOUP_MESSAGE_IDEMPOTENT is set.
	MessageNewConnectionValue MessageFlags = 4
	// The message is considered idempotent,
	//   regardless its [property@Message:method], and allows reuse of existing
	//   idle connections, instead of always requiring a new one, unless
	//   #SOUP_MESSAGE_NEW_CONNECTION is set.
	MessageIdempotentValue MessageFlags = 8
	// The [class@AuthManager] should not use
	//   the credentials cache for this message, neither to use cached credentials
	//   to automatically authenticate this message nor to cache the credentials
	//   after the message is successfully authenticated. This applies to both server
	//   and proxy authentication. Note that [signal@Message::authenticate] signal will
	//   be emitted, if you want to disable authentication for a message use
	//   [method@Message.disable_feature] passing #SOUP_TYPE_AUTH_MANAGER instead.
	MessageDoNotUseAuthCacheValue MessageFlags = 16
	// Metrics will be collected for this message.
	MessageCollectMetricsValue MessageFlags = 32
)

type MessageHeaders

type MessageHeaders struct {
	// contains filtered or unexported fields
}

The HTTP message headers associated with a request or response.

func NewMessageHeaders

func NewMessageHeaders(TypeVar MessageHeadersType) *MessageHeaders

Creates a #SoupMessageHeaders.

([class@Message] does this automatically for its own headers. You would only need to use this method if you are manually parsing or generating message headers.)

func (*MessageHeaders) Append

func (x *MessageHeaders) Append(NameVar string, ValueVar string)

Appends a new header with name @name and value @value to @hdrs.

(If there is an existing header with name @name, then this creates a second one, which is only allowed for list-valued headers; see also [method@MessageHeaders.replace].)

The caller is expected to make sure that @name and @value are syntactically correct.

func (*MessageHeaders) CleanConnectionHeaders

func (x *MessageHeaders) CleanConnectionHeaders()

Removes all the headers listed in the Connection header.

func (*MessageHeaders) Clear

func (x *MessageHeaders) Clear()

Clears @hdrs.

func (*MessageHeaders) Foreach

func (x *MessageHeaders) Foreach(FuncVar *MessageHeadersForeachFunc, UserDataVar uintptr)

Calls @func once for each header value in @hdrs.

Beware that unlike [method@MessageHeaders.get_list], this processes the headers in exactly the way they were added, rather than concatenating multiple same-named headers into a single value. (This is intentional; it ensures that if you call [method@MessageHeaders.append] multiple times with the same name, then the I/O code will output multiple copies of the header when sending the message to the remote implementation, which may be required for interoperability in some cases.)

You may not modify the headers from @func.

func (*MessageHeaders) FreeRanges

func (x *MessageHeaders) FreeRanges(RangesVar *Range)

Frees the array of ranges returned from [method@MessageHeaders.get_ranges].

func (*MessageHeaders) GetContentDisposition

func (x *MessageHeaders) GetContentDisposition(DispositionVar *string, ParamsVar **glib.HashTable) bool

Looks up the "Content-Disposition" header in @hdrs, parses it, and returns its value in *@disposition and *@params.

@params can be %NULL if you are only interested in the disposition-type.

In HTTP, the most common use of this header is to set a disposition-type of "attachment", to suggest to the browser that a response should be saved to disk rather than displayed in the browser. If @params contains a "filename" parameter, this is a suggestion of a filename to use. (If the parameter value in the header contains an absolute or relative path, libsoup will truncate it down to just the final path component, so you do not need to test this yourself.)

Content-Disposition is also used in "multipart/form-data", however this is handled automatically by [struct@Multipart] and the associated form methods.

func (*MessageHeaders) GetContentLength

func (x *MessageHeaders) GetContentLength() int64

Gets the message body length that @hdrs declare.

This will only be non-0 if [method@MessageHeaders.get_encoding] returns %SOUP_ENCODING_CONTENT_LENGTH.

func (*MessageHeaders) GetContentRange

func (x *MessageHeaders) GetContentRange(StartVar *int64, EndVar *int64, TotalLengthVar *int64) bool

Parses @hdrs's Content-Range header and returns it in @start, @end, and @total_length. If the total length field in the header was specified as "*", then @total_length will be set to -1.

func (*MessageHeaders) GetContentType

func (x *MessageHeaders) GetContentType(ParamsVar **glib.HashTable) string

Looks up the "Content-Type" header in @hdrs, parses it, and returns its value in *@content_type and *@params.

@params can be %NULL if you are only interested in the content type itself.

func (*MessageHeaders) GetEncoding

func (x *MessageHeaders) GetEncoding() Encoding

Gets the message body encoding that @hdrs declare.

This may not always correspond to the encoding used on the wire; eg, a HEAD response may declare a Content-Length or Transfer-Encoding, but it will never actually include a body.

func (*MessageHeaders) GetExpectations

func (x *MessageHeaders) GetExpectations() Expectation

Gets the expectations declared by @hdrs's "Expect" header.

Currently this will either be %SOUP_EXPECTATION_CONTINUE or %SOUP_EXPECTATION_UNRECOGNIZED.

func (*MessageHeaders) GetHeadersType

func (x *MessageHeaders) GetHeadersType() MessageHeadersType

Gets the type of headers.

func (*MessageHeaders) GetList

func (x *MessageHeaders) GetList(NameVar string) string

Gets the value of header @name in @hdrs.

Use this for headers whose values are comma-delimited lists, and which are therefore allowed to appear multiple times in the headers. For non-list-valued headers, use [method@MessageHeaders.get_one].

If @name appears multiple times in @hdrs, [method@MessageHeaders.get_list] will concatenate all of the values together, separated by commas. This is sometimes awkward to parse (eg, WWW-Authenticate, Set-Cookie), but you have to be able to deal with it anyway, because the HTTP spec explicitly states that this transformation is allowed, and so an upstream proxy could do the same thing.

func (*MessageHeaders) GetOne

func (x *MessageHeaders) GetOne(NameVar string) string

Gets the value of header @name in @hdrs.

Use this for headers whose values are *not* comma-delimited lists, and which therefore can only appear at most once in the headers. For list-valued headers, use [method@MessageHeaders.get_list].

If @hdrs does erroneously contain multiple copies of the header, it is not defined which one will be returned. (Ideally, it will return whichever one makes libsoup most compatible with other HTTP implementations.)

func (*MessageHeaders) GetRanges

func (x *MessageHeaders) GetRanges(TotalLengthVar int64, RangesVar *uintptr, LengthVar *int) bool

Parses @hdrs's Range header and returns an array of the requested byte ranges.

The returned array must be freed with [method@MessageHeaders.free_ranges].

If @total_length is non-0, its value will be used to adjust the returned ranges to have explicit start and end values, and the returned ranges will be sorted and non-overlapping. If @total_length is 0, then some ranges may have an end value of -1, as described under [struct@Range], and some of the ranges may be redundant.

Beware that even if given a @total_length, this function does not check that the ranges are satisfiable.

#SoupServer has built-in handling for range requests. If your server handler returns a %SOUP_STATUS_OK response containing the complete response body (rather than pausing the message and returning some of the response body later), and there is a Range header in the request, then libsoup will automatically convert the response to a %SOUP_STATUS_PARTIAL_CONTENT response containing only the range(s) requested by the client.

The only time you need to process the Range header yourself is if either you need to stream the response body rather than returning it all at once, or you do not already have the complete response body available, and only want to generate the parts that were actually requested by the client.

func (*MessageHeaders) GoPointer

func (x *MessageHeaders) GoPointer() uintptr

func (*MessageHeaders) HeaderContains

func (x *MessageHeaders) HeaderContains(NameVar string, TokenVar string) bool

Checks whether the list-valued header @name is present in @hdrs, and contains a case-insensitive match for @token.

(If @name is present in @hdrs, then this is equivalent to calling [func@header_contains] on its value.)

func (*MessageHeaders) HeaderEquals

func (x *MessageHeaders) HeaderEquals(NameVar string, ValueVar string) bool

Checks whether the header @name is present in @hdrs and is (case-insensitively) equal to @value.

func (*MessageHeaders) Ref

func (x *MessageHeaders) Ref() *MessageHeaders

Atomically increments the reference count of @hdrs by one.

func (*MessageHeaders) Remove

func (x *MessageHeaders) Remove(NameVar string)

Removes @name from @hdrs.

If there are multiple values for @name, they are all removed.

func (*MessageHeaders) Replace

func (x *MessageHeaders) Replace(NameVar string, ValueVar string)

Replaces the value of the header @name in @hdrs with @value.

See also [method@MessageHeaders.append].

The caller is expected to make sure that @name and @value are syntactically correct.

func (*MessageHeaders) SetContentDisposition

func (x *MessageHeaders) SetContentDisposition(DispositionVar string, ParamsVar *glib.HashTable)

Sets the "Content-Disposition" header in @hdrs to @disposition, optionally with additional parameters specified in @params.

See [method@MessageHeaders.get_content_disposition] for a discussion of how Content-Disposition is used in HTTP.

func (*MessageHeaders) SetContentLength

func (x *MessageHeaders) SetContentLength(ContentLengthVar int64)

Sets the message body length that @hdrs will declare, and sets @hdrs's encoding to %SOUP_ENCODING_CONTENT_LENGTH.

You do not normally need to call this; if @hdrs is set to use Content-Length encoding, libsoup will automatically set its Content-Length header for you immediately before sending the headers. One situation in which this method is useful is when generating the response to a HEAD request; Calling [method@MessageHeaders.set_content_length] allows you to put the correct content length into the response without needing to waste memory by filling in a response body which won't actually be sent.

func (*MessageHeaders) SetContentRange

func (x *MessageHeaders) SetContentRange(StartVar int64, EndVar int64, TotalLengthVar int64)

Sets @hdrs's Content-Range header according to the given values.

(Note that @total_length is the total length of the entire resource that this is a range of, not simply @end - @start + 1.)

[class@Server] has built-in handling for range requests, and you do not normally need to call this function youself. See [method@MessageHeaders.get_ranges] for more details.

func (*MessageHeaders) SetContentType

func (x *MessageHeaders) SetContentType(ContentTypeVar string, ParamsVar *glib.HashTable)

Sets the "Content-Type" header in @hdrs to @content_type.

Accepts additional parameters specified in @params.

func (*MessageHeaders) SetEncoding

func (x *MessageHeaders) SetEncoding(EncodingVar Encoding)

Sets the message body encoding that @hdrs will declare.

In particular, you should use this if you are going to send a request or response in chunked encoding.

func (*MessageHeaders) SetExpectations

func (x *MessageHeaders) SetExpectations(ExpectationsVar Expectation)

Sets @hdrs's "Expect" header according to @expectations.

Currently %SOUP_EXPECTATION_CONTINUE is the only known expectation value. You should set this value on a request if you are sending a large message body (eg, via POST or PUT), and want to give the server a chance to reject the request after seeing just the headers (eg, because it will require authentication before allowing you to post, or because you're POSTing to a URL that doesn't exist). This saves you from having to transmit the large request body when the server is just going to ignore it anyway.

func (*MessageHeaders) SetRange

func (x *MessageHeaders) SetRange(StartVar int64, EndVar int64)

Sets @hdrs's Range header to request the indicated range.

@start and @end are interpreted as in a [struct@Range].

If you need to request multiple ranges, use [method@MessageHeaders.set_ranges].

func (*MessageHeaders) SetRanges

func (x *MessageHeaders) SetRanges(RangesVar *Range, LengthVar int)

Sets @hdrs's Range header to request the indicated ranges.

If you only want to request a single range, you can use [method@MessageHeaders.set_range].

func (*MessageHeaders) Unref

func (x *MessageHeaders) Unref()

Atomically decrements the reference count of @hdrs by one.

When the reference count reaches zero, the resources allocated by @hdrs are freed

type MessageHeadersForeachFunc

type MessageHeadersForeachFunc func(string, string, uintptr)

The callback passed to [method@MessageHeaders.foreach].

type MessageHeadersIter

type MessageHeadersIter struct {
	Dummy [3]uintptr
	// contains filtered or unexported fields
}

An opaque type used to iterate over a %SoupMessageHeaders structure.

After intializing the iterator with [func@MessageHeadersIter.init], call [method@MessageHeadersIter.next] to fetch data from it.

You may not modify the headers while iterating over them.

func (*MessageHeadersIter) GoPointer

func (x *MessageHeadersIter) GoPointer() uintptr

type MessageHeadersType

type MessageHeadersType int

Value passed to [ctor@MessageHeaders.new] to set certain default behaviors.

const (

	// request headers
	MessageHeadersRequestValue MessageHeadersType = 0
	// response headers
	MessageHeadersResponseValue MessageHeadersType = 1
	// multipart body part headers
	MessageHeadersMultipartValue MessageHeadersType = 2
)

type MessageMetrics

type MessageMetrics struct {
	// contains filtered or unexported fields
}

Contains metrics collected while loading a [class@Message] either from the network or the disk cache.

Metrics are not collected by default for a [class@Message], you need to add the flag %SOUP_MESSAGE_COLLECT_METRICS to enable the feature.

Temporal metrics are expressed as a monotonic time and always start with a fetch start event and finish with response end. All other events are optional. An event can be 0 because it hasn't happened yet, because it's optional or because the load failed before the event reached.

Size metrics are expressed in bytes and are updated while the [class@Message] is being loaded. You can connect to different [class@Message] signals to get the final result of every value.

func (*MessageMetrics) Copy

func (x *MessageMetrics) Copy() *MessageMetrics

Copies @metrics.

func (*MessageMetrics) Free

func (x *MessageMetrics) Free()

Frees @metrics.

func (*MessageMetrics) GetConnectEnd

func (x *MessageMetrics) GetConnectEnd() uint64

Get the time immediately after the [class@Message] completed the connection to the server. This includes the time for the proxy negotiation and TLS handshake.

It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).

func (*MessageMetrics) GetConnectStart

func (x *MessageMetrics) GetConnectStart() uint64

Get the time immediately before the [class@Message] started to establish the connection to the server.

It will be 0 if no network connection was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).

func (*MessageMetrics) GetDnsEnd

func (x *MessageMetrics) GetDnsEnd() uint64

Get the time immediately after the [class@Message] completed the domain lookup name for the resource.

It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).

func (*MessageMetrics) GetDnsStart

func (x *MessageMetrics) GetDnsStart() uint64

Get the time immediately before the [class@Message] started the domain lookup name for the resource.

It will be 0 if no domain lookup was required to fetch the resource (a persistent connection was used or resource was loaded from the local disk cache).

func (*MessageMetrics) GetFetchStart

func (x *MessageMetrics) GetFetchStart() uint64

Get the time immediately before the [class@Message] started to fetch a resource either from a remote server or local disk cache.

func (*MessageMetrics) GetRequestBodyBytesSent

func (x *MessageMetrics) GetRequestBodyBytesSent() uint64

Get the number of bytes sent to the network for the request body.

This is the size of the body sent, after encodings are applied, so it might be greater than the value returned by [method@MessageMetrics.get_request_body_size]. This value is available right before [signal@Message::wrote-body] signal is emitted, but you might get an intermediate value if called before.

func (*MessageMetrics) GetRequestBodySize

func (x *MessageMetrics) GetRequestBodySize() uint64

Get the request body size in bytes. This is the size of the original body given to the request before any encoding is applied.

This value is available right before [signal@Message::wrote-body] signal is emitted, but you might get an intermediate value if called before.

func (*MessageMetrics) GetRequestHeaderBytesSent

func (x *MessageMetrics) GetRequestHeaderBytesSent() uint64

Get the number of bytes sent to the network for the request headers.

This value is available right before [signal@Message::wrote-headers] signal is emitted, but you might get an intermediate value if called before.

func (*MessageMetrics) GetRequestStart

func (x *MessageMetrics) GetRequestStart() uint64

Get the time immediately before the [class@Message] started the request of the resource from the server or the local disk cache.

func (*MessageMetrics) GetResponseBodyBytesReceived

func (x *MessageMetrics) GetResponseBodyBytesReceived() uint64

Get the number of bytes received from the network for the response body.

This value is available right before [signal@Message::got-body] signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0.

func (*MessageMetrics) GetResponseBodySize

func (x *MessageMetrics) GetResponseBodySize() uint64

Get the response body size in bytes.

This is the size of the body as given to the user after all encodings are applied, so it might be greater than the value returned by [method@MessageMetrics.get_response_body_bytes_received]. This value is available right before [signal@Message::got-body] signal is emitted, but you might get an intermediate value if called before.

func (*MessageMetrics) GetResponseEnd

func (x *MessageMetrics) GetResponseEnd() uint64

Get the time immediately after the [class@Message] received the last bytes of the response from the server or the local disk cache.

In case of load failure, this returns the time immediately before the fetch is aborted.

func (*MessageMetrics) GetResponseHeaderBytesReceived

func (x *MessageMetrics) GetResponseHeaderBytesReceived() uint64

Get the number of bytes received from the network for the response headers.

This value is available right before [signal@Message::got-headers] signal is emitted, but you might get an intermediate value if called before. For resources loaded from the disk cache this value is always 0.

func (*MessageMetrics) GetResponseStart

func (x *MessageMetrics) GetResponseStart() uint64

Get the time immediately after the [class@Message] received the first bytes of the response from the server or the local disk cache.

func (*MessageMetrics) GetTlsStart

func (x *MessageMetrics) GetTlsStart() uint64

Get the time immediately before the [class@Message] started the TLS handshake.

It will be 0 if no TLS handshake was required to fetch the resource (connection was not secure, a persistent connection was used or resource was loaded from the local disk cache).

func (*MessageMetrics) GoPointer

func (x *MessageMetrics) GoPointer() uintptr

type MessagePriority

type MessagePriority int

Priorities that can be set on a [class@Message] to instruct the message queue to process it before any other message with lower priority.

const (

	// The lowest priority, the messages
	//   with this priority will be the last ones to be attended.
	MessagePriorityVeryLowValue MessagePriority = 0
	// Use this for low priority messages, a
	//   #SoupMessage with the default priority will be processed first.
	MessagePriorityLowValue MessagePriority = 1
	// The default priotity, this is the
	//   priority assigned to the #SoupMessage by default.
	MessagePriorityNormalValue MessagePriority = 2
	// High priority, a #SoupMessage with
	//   this priority will be processed before the ones with the default
	//   priority.
	MessagePriorityHighValue MessagePriority = 3
	// The highest priority, use this
	//   for very urgent #SoupMessage as they will be the first ones to be
	//   attended.
	MessagePriorityVeryHighValue MessagePriority = 4
)

type Multipart

type Multipart struct {
	// contains filtered or unexported fields
}

Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046.

Of particular interest to HTTP are `multipart/byte-ranges` and `multipart/form-data`,

Although the headers of a #SoupMultipart body part will contain the full headers from that body part, libsoup does not interpret them according to MIME rules. For example, each body part is assumed to have "binary" Content-Transfer-Encoding, even if its headers explicitly state otherwise. In other words, don't try to use #SoupMultipart for handling real MIME multiparts.

func NewMultipart

func NewMultipart(MimeTypeVar string) *Multipart

Creates a new empty #SoupMultipart with a randomly-generated boundary string.

Note that @mime_type must be the full MIME type, including "multipart/".

See also: [ctor@Message.new_from_multipart].

func NewMultipartFromMessage

func NewMultipartFromMessage(HeadersVar *MessageHeaders, BodyVar *glib.Bytes) *Multipart

Parses @headers and @body to form a new #SoupMultipart

func (*Multipart) AppendFormFile

func (x *Multipart) AppendFormFile(ControlNameVar string, FilenameVar *string, ContentTypeVar *string, BodyVar *glib.Bytes)

Adds a new MIME part containing @body to @multipart

Uses "Content-Disposition: form-data", as per the HTML forms specification.

func (*Multipart) AppendFormString

func (x *Multipart) AppendFormString(ControlNameVar string, DataVar string)

Adds a new MIME part containing @data to @multipart.

Uses "Content-Disposition: form-data", as per the HTML forms specification.

func (*Multipart) AppendPart

func (x *Multipart) AppendPart(HeadersVar *MessageHeaders, BodyVar *glib.Bytes)

Adds a new MIME part to @multipart with the given headers and body.

(The multipart will make its own copies of @headers and @body, so you should free your copies if you are not using them for anything else.)

func (*Multipart) Free

func (x *Multipart) Free()

Frees @multipart.

func (*Multipart) GetLength

func (x *Multipart) GetLength() int

Gets the number of body parts in @multipart.

func (*Multipart) GetPart

func (x *Multipart) GetPart(PartVar int, HeadersVar **MessageHeaders, BodyVar **glib.Bytes) bool

Gets the indicated body part from @multipart.

func (*Multipart) GoPointer

func (x *Multipart) GoPointer() uintptr

func (*Multipart) ToMessage

func (x *Multipart) ToMessage(DestHeadersVar *MessageHeaders, DestBodyVar **glib.Bytes)

Serializes @multipart to @dest_headers and @dest_body.

type MultipartInputStream

type MultipartInputStream struct {
	gio.FilterInputStream
}

Handles streams of multipart messages.

This adds support for the multipart responses. For handling the multiple parts the user needs to wrap the [class@Gio.InputStream] obtained by sending the request with a [class@MultipartInputStream] and use [method@MultipartInputStream.next_part] before reading. Responses which are not wrapped will be treated like non-multipart responses.

Note that although #SoupMultipartInputStream is a [class@Gio.InputStream], you should not read directly from it, and the results are undefined if you do.

func MultipartInputStreamNewFromInternalPtr

func MultipartInputStreamNewFromInternalPtr(ptr uintptr) *MultipartInputStream

func NewMultipartInputStream

func NewMultipartInputStream(MsgVar *Message, BaseStreamVar *gio.InputStream) *MultipartInputStream

Creates a new #SoupMultipartInputStream that wraps the [class@Gio.InputStream] obtained by sending the [class@Message].

Reads should not be done directly through this object, use the input streams returned by [method@MultipartInputStream.next_part] or its async counterpart instead.

func (*MultipartInputStream) CanPoll

func (x *MultipartInputStream) CanPoll() bool

Checks if @stream is actually pollable. Some classes may implement #GPollableInputStream but have only certain instances of that class be pollable. If this method returns %FALSE, then the behavior of other #GPollableInputStream methods is undefined.

For any given stream, the value returned by this method is constant; a stream cannot switch from pollable to non-pollable or vice versa.

func (*MultipartInputStream) CreateSource

func (x *MultipartInputStream) CreateSource(CancellableVar *gio.Cancellable) *glib.Source

Creates a #GSource that triggers when @stream can be read, or @cancellable is triggered or an error occurs. The callback on the source is of the #GPollableSourceFunc type.

As with g_pollable_input_stream_is_readable(), it is possible that the stream may not actually be readable even after the source triggers, so you should use g_pollable_input_stream_read_nonblocking() rather than g_input_stream_read() from the callback.

The behaviour of this method is undefined if g_pollable_input_stream_can_poll() returns %FALSE for @stream.

func (*MultipartInputStream) GetHeaders

func (x *MultipartInputStream) GetHeaders() *MessageHeaders

Obtains the headers for the part currently being processed.

Note that the [struct@MessageHeaders] that are returned are owned by the #SoupMultipartInputStream and will be replaced when a call is made to [method@MultipartInputStream.next_part] or its async counterpart, so if keeping the headers is required, a copy must be made.

Note that if a part had no headers at all an empty [struct@MessageHeaders] will be returned.

func (*MultipartInputStream) GoPointer

func (c *MultipartInputStream) GoPointer() uintptr

func (*MultipartInputStream) IsReadable

func (x *MultipartInputStream) IsReadable() bool

Checks if @stream can be read.

Note that some stream types may not be able to implement this 100% reliably, and it is possible that a call to g_input_stream_read() after this returns %TRUE would still block. To guarantee non-blocking behavior, you should always use g_pollable_input_stream_read_nonblocking(), which will return a %G_IO_ERROR_WOULD_BLOCK error rather than blocking.

The behaviour of this method is undefined if g_pollable_input_stream_can_poll() returns %FALSE for @stream.

func (*MultipartInputStream) NextPart

func (x *MultipartInputStream) NextPart(CancellableVar *gio.Cancellable) (*gio.InputStream, error)

Obtains an input stream for the next part.

When dealing with a multipart response the input stream needs to be wrapped in a #SoupMultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.

After calling this function, [method@MultipartInputStream.get_headers] can be used to obtain the headers for the first part. A read of 0 bytes indicates the end of the part; a new call to this function should be done at that point, to obtain the next part.

@error will only be set if an error happens during a read, %NULL is a valid return value otherwise.

func (*MultipartInputStream) NextPartAsync

func (x *MultipartInputStream) NextPartAsync(IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, DataVar uintptr)

Obtains a [class@Gio.InputStream] for the next request.

See [method@MultipartInputStream.next_part] for details on the workflow.

func (*MultipartInputStream) NextPartFinish

func (x *MultipartInputStream) NextPartFinish(ResultVar gio.AsyncResult) (*gio.InputStream, error)

Finishes an asynchronous request for the next part.

func (*MultipartInputStream) ReadNonblocking

func (x *MultipartInputStream) ReadNonblocking(BufferVar *[]byte, CountVar uint, CancellableVar *gio.Cancellable) (int, error)

Attempts to read up to @count bytes from @stream into @buffer, as with g_input_stream_read(). If @stream is not currently readable, this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can use g_pollable_input_stream_create_source() to create a #GSource that will be triggered when @stream is readable.

Note that since this method never blocks, you cannot actually use @cancellable to cancel it. However, it will return an error if @cancellable has already been cancelled when you call, which may happen if you call this method after a source triggers due to having been cancelled.

The behaviour of this method is undefined if g_pollable_input_stream_can_poll() returns %FALSE for @stream.

func (*MultipartInputStream) SetGoPointer

func (c *MultipartInputStream) SetGoPointer(ptr uintptr)

type MultipartInputStreamClass

type MultipartInputStreamClass struct {
	ParentClass gio.FilterInputStreamClass
	// contains filtered or unexported fields
}

func (*MultipartInputStreamClass) GoPointer

func (x *MultipartInputStreamClass) GoPointer() uintptr

type Range

type Range struct {
	Start int64

	End int64
	// contains filtered or unexported fields
}

Represents a byte range as used in the Range header.

If @end is non-negative, then @start and @end represent the bounds of of the range, counting from 0. (Eg, the first 500 bytes would be represented as @start = 0 and @end = 499.)

If @end is -1 and @start is non-negative, then this represents a range starting at @start and ending with the last byte of the requested resource body. (Eg, all but the first 500 bytes would be @start = 500, and @end = -1.)

If @end is -1 and @start is negative, then it represents a "suffix range", referring to the last -@start bytes of the resource body. (Eg, the last 500 bytes would be @start = -500 and @end = -1.)

func (*Range) GoPointer

func (x *Range) GoPointer() uintptr

type SameSitePolicy

type SameSitePolicy int

Represents the same-site policies of a cookie.

const (

	// The cookie is exposed with both cross-site and same-site requests
	SameSitePolicyNoneValue SameSitePolicy = 0
	// The cookie is withheld on cross-site requests but exposed on cross-site navigations
	SameSitePolicyLaxValue SameSitePolicy = 1
	// The cookie is only exposed for same-site requests
	SameSitePolicyStrictValue SameSitePolicy = 2
)

type Server

type Server struct {
	gobject.Object
}

#SoupServer provides a basic implementation of an HTTP server. The recommended usage of this server is for internal use, tasks like a mock server for tests, a private service for IPC, etc. It is not recommended to be exposed to untrusted clients as it may be vulnerable to denial of service attacks or other exploits.

To begin, create a server using [ctor@Server.new]. Add at least one handler by calling [method@Server.add_handler] or [method@Server.add_early_handler]; the handler will be called to process any requests underneath the path you pass. (If you want all requests to go to the same handler, just pass "/" (or %NULL) for the path.)

When a new connection is accepted (or a new request is started on an existing persistent connection), the #SoupServer will emit [signal@Server::request-started] and then begin processing the request as described below, but note that once the message is assigned a status-code, then callbacks after that point will be skipped. Note also that it is not defined when the callbacks happen relative to various [class@ServerMessage] signals.

Once the headers have been read, #SoupServer will check if there is a [class@AuthDomain] `(qv)` covering the Request-URI; if so, and if the message does not contain suitable authorization, then the [class@AuthDomain] will set a status of %SOUP_STATUS_UNAUTHORIZED on the message.

After checking for authorization, #SoupServer will look for "early" handlers (added with [method@Server.add_early_handler]) matching the Request-URI. If one is found, it will be run; in particular, this can be used to connect to signals to do a streaming read of the request body.

(At this point, if the request headers contain `Expect: 100-continue`, and a status code has been set, then #SoupServer will skip the remaining steps and return the response. If the request headers contain `Expect: 100-continue` and no status code has been set, #SoupServer will return a %SOUP_STATUS_CONTINUE status before continuing.)

The server will then read in the response body (if present). At this point, if there are no handlers at all defined for the Request-URI, then the server will return %SOUP_STATUS_NOT_FOUND to the client.

Otherwise (assuming no previous step assigned a status to the message) any "normal" handlers (added with [method@Server.add_handler]) for the message's Request-URI will be run.

Then, if the path has a WebSocket handler registered (and has not yet been assigned a status), #SoupServer will attempt to validate the WebSocket handshake, filling in the response and setting a status of %SOUP_STATUS_SWITCHING_PROTOCOLS or %SOUP_STATUS_BAD_REQUEST accordingly.

If the message still has no status code at this point (and has not been paused with [method@ServerMessage.pause]), then it will be given a status of %SOUP_STATUS_INTERNAL_SERVER_ERROR (because at least one handler ran, but returned without assigning a status).

Finally, the server will emit [signal@Server::request-finished] (or [signal@Server::request-aborted] if an I/O error occurred before handling was completed).

If you want to handle the special "*" URI (eg, "OPTIONS *"), you must explicitly register a handler for "*"; the default handler will not be used for that case.

If you want to process https connections in addition to (or instead of) http connections, you can set the [property@Server:tls-certificate] property.

Once the server is set up, make one or more calls to [method@Server.listen], [method@Server.listen_local], or [method@Server.listen_all] to tell it where to listen for connections. (All ports on a #SoupServer use the same handlers; if you need to handle some ports differently, such as returning different data for http and https, you'll need to create multiple `SoupServer`s, or else check the passed-in URI in the handler function.).

#SoupServer will begin processing connections as soon as you return to (or start) the main loop for the current thread-default [struct@GLib.MainContext].

func NewServer

func NewServer(Optname1Var string, varArgs ...interface{}) *Server

Creates a new #SoupServer.

This is exactly equivalent to calling [ctor@GObject.Object.new] and specifying %SOUP_TYPE_SERVER as the type.

func ServerNewFromInternalPtr

func ServerNewFromInternalPtr(ptr uintptr) *Server

func (*Server) AcceptIostream

func (x *Server) AcceptIostream(StreamVar *gio.IOStream, LocalAddrVar *gio.SocketAddress, RemoteAddrVar *gio.SocketAddress) (bool, error)

Adds a new client stream to the @server.

func (*Server) AddAuthDomain

func (x *Server) AddAuthDomain(AuthDomainVar *AuthDomain)

Adds an authentication domain to @server.

Each auth domain will have the chance to require authentication for each request that comes in; normally auth domains will require authentication for requests on certain paths that they have been set up to watch, or that meet other criteria set by the caller. If an auth domain determines that a request requires authentication (and the request doesn't contain authentication), @server will automatically reject the request with an appropriate status (401 Unauthorized or 407 Proxy Authentication Required). If the request used the SoupServer:100-continue Expectation, @server will reject it before the request body is sent.

func (*Server) AddEarlyHandler

func (x *Server) AddEarlyHandler(PathVar *string, CallbackVar *ServerCallback, UserDataVar uintptr, DestroyVar *glib.DestroyNotify)

Adds an "early" handler to @server for requests prefixed by @path.

Note that "normal" and "early" handlers are matched up together, so if you add a normal handler for "/foo" and an early handler for "/foo/bar", then a request to "/foo/bar" (or any path below it) will run only the early handler. (But if you add both handlers at the same path, then both will get run.)

For requests under @path (that have not already been assigned a status code by a [class@AuthDomain] or a signal handler), @callback will be invoked after receiving the request headers, but before receiving the request body; the message's method and request-headers properties will be set.

Early handlers are generally used for processing requests with request bodies in a streaming fashion. If you determine that the request will contain a message body, normally you would call [method@MessageBody.set_accumulate] on the message's request-body to turn off request-body accumulation, and connect to the message's [signal@ServerMessage::got-chunk] signal to process each chunk as it comes in.

To complete the message processing after the full message body has been read, you can either also connect to [signal@ServerMessage::got-body], or else you can register a non-early handler for @path as well. As long as you have not set the status-code by the time [signal@ServerMessage::got-body] is emitted, the non-early handler will be run as well.

func (*Server) AddHandler

func (x *Server) AddHandler(PathVar *string, CallbackVar *ServerCallback, UserDataVar uintptr, DestroyVar *glib.DestroyNotify)

Adds a handler to @server for requests prefixed by @path.

If @path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler. (Note though that if you want to handle requests to the special "*" URI, you must explicitly register a handler for "*"; the default handler will not be used for that case.)

For requests under @path (that have not already been assigned a status code by a [class@AuthDomain], an early server handler, or a signal handler), @callback will be invoked after receiving the request body; the [class@ServerMessage]'s method, request-headers, and request-body properties will be set.

After determining what to do with the request, the callback must at a minimum call [method@ServerMessage.set_status] on the message to set the response status code. Additionally, it may set response headers and/or fill in the response body.

If the callback cannot fully fill in the response before returning (eg, if it needs to wait for information from a database, or another network server), it should call [method@ServerMessage.pause] to tell @server to not send the response right away. When the response is ready, call [method@ServerMessage.unpause] to cause it to be sent.

To send the response body a bit at a time using "chunked" encoding, first call [method@MessageHeaders.set_encoding] to set %SOUP_ENCODING_CHUNKED on the response-headers. Then call [method@MessageBody.append] (or [method@MessageBody.append_bytes])) to append each chunk as it becomes ready, and [method@ServerMessage.unpause] to make sure it's running. (The server will automatically pause the message if it is using chunked encoding but no more chunks are available.) When you are done, call [method@MessageBody.complete] to indicate that no more chunks are coming.

func (*Server) AddWebsocketExtension

func (x *Server) AddWebsocketExtension(ExtensionTypeVar types.GType)

Add support for a WebSocket extension of the given @extension_type.

When a WebSocket client requests an extension of @extension_type, a new [class@WebsocketExtension] of type @extension_type will be created to handle the request.

Note that [class@WebsocketExtensionDeflate] is supported by default, use [method@Server.remove_websocket_extension] if you want to disable it.

func (*Server) AddWebsocketHandler

func (x *Server) AddWebsocketHandler(PathVar *string, OriginVar *string, ProtocolsVar []string, CallbackVar *ServerWebsocketCallback, UserDataVar uintptr, DestroyVar *glib.DestroyNotify)

Adds a WebSocket handler to @server for requests prefixed by @path.

If @path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler.

When a path has a WebSocket handler registered, @server will check incoming requests for WebSocket handshakes after all other handlers have run (unless some earlier handler has already set a status code on the message), and update the request's status, response headers, and response body accordingly.

If @origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If @protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. More complicated requirements can be handled by adding a normal handler to @path, and having it perform whatever checks are needed and setting a failure status code if the handshake should be rejected.

func (*Server) ConnectRequestAborted

func (x *Server) ConnectRequestAborted(cb *func(Server, uintptr)) uint

Emitted when processing has failed for a message.

This could mean either that it could not be read (if [signal@Server::request-read] has not been emitted for it yet), or that the response could not be written back (if [signal@Server::request-read] has been emitted but [signal@Server::request-finished] has not been).

@message is in an undefined state when this signal is emitted; the signal exists primarily to allow the server to free any state that it may have allocated in [signal@Server::request-started].

func (*Server) ConnectRequestFinished

func (x *Server) ConnectRequestFinished(cb *func(Server, uintptr)) uint

Emitted when the server has finished writing a response to a request.

func (*Server) ConnectRequestRead

func (x *Server) ConnectRequestRead(cb *func(Server, uintptr)) uint

Emitted when the server has successfully read a request.

@message will have all of its request-side information filled in, and if the message was authenticated, @client will have information about that. This signal is emitted before any (non-early) handlers are called for the message, and if it sets the message's #status_code, then normal handler processing will be skipped.

func (*Server) ConnectRequestStarted

func (x *Server) ConnectRequestStarted(cb *func(Server, uintptr)) uint

Emitted when the server has started reading a new request.

@message will be completely blank; not even the Request-Line will have been read yet. About the only thing you can usefully do with it is connect to its signals.

If the request is read successfully, this will eventually be followed by a [signal@Server::request_read signal]. If a response is then sent, the request processing will end with a [signal@Server::request-finished] signal. If a network error occurs, the processing will instead end with [signal@Server::request-aborted].

func (*Server) Disconnect

func (x *Server) Disconnect()

Closes and frees @server's listening sockets.

Note that if there are currently requests in progress on @server, that they will continue to be processed if @server's [struct@GLib.MainContext] is still running.

You can call [method@Server.listen], etc, after calling this function if you want to start listening again.

func (*Server) GetListeners

func (x *Server) GetListeners() *glib.SList

Gets @server's list of listening sockets.

You should treat these sockets as read-only; writing to or modifiying any of these sockets may cause @server to malfunction.

func (*Server) GetPropertyRawPaths added in v0.0.4

func (x *Server) GetPropertyRawPaths() bool

GetPropertyRawPaths gets the "raw-paths" property. If %TRUE, percent-encoding in the Request-URI path will not be automatically decoded.

func (*Server) GetPropertyServerHeader added in v0.0.4

func (x *Server) GetPropertyServerHeader() string

GetPropertyServerHeader gets the "server-header" property. Server header.

If non-%NULL, the value to use for the "Server" header on [class@ServerMessage]s processed by this server.

The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes.

As with [property@Session:user_agent], if you set a [property@Server:server-header] property that has trailing whitespace, #SoupServer will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you.

func (*Server) GetTlsAuthMode

func (x *Server) GetTlsAuthMode() gio.TlsAuthenticationMode

Gets the @server SSL/TLS client authentication mode.

func (*Server) GetTlsCertificate

func (x *Server) GetTlsCertificate() *gio.TlsCertificate

Gets the @server SSL/TLS certificate.

func (*Server) GetTlsDatabase

func (x *Server) GetTlsDatabase() *gio.TlsDatabase

Gets the @server SSL/TLS database.

func (*Server) GetUris

func (x *Server) GetUris() *glib.SList

Gets a list of URIs corresponding to the interfaces @server is listening on.

These will contain IP addresses, not hostnames, and will also indicate whether the given listener is http or https.

Note that if you used [method@Server.listen_all] the returned URIs will use the addresses `0.0.0.0` and `::`, rather than actually returning separate URIs for each interface on the system.

func (*Server) GoPointer

func (c *Server) GoPointer() uintptr

func (*Server) IsHttps

func (x *Server) IsHttps() bool

Checks whether @server is capable of https.

In order for a server to run https, you must call [method@Server.set_tls_certificate], or set the [property@Server:tls-certificate] property, to provide it with a certificate to use.

If you are using the deprecated single-listener APIs, then a return value of %TRUE indicates that the #SoupServer serves https exclusively. If you are using [method@Server.listen], etc, then a %TRUE return value merely indicates that the server is *able* to do https, regardless of whether it actually currently is or not. Use [method@Server.get_uris] to see if it currently has any https listeners.

func (*Server) Listen

func (x *Server) Listen(AddressVar *gio.SocketAddress, OptionsVar ServerListenOptions) (bool, error)

Attempts to set up @server to listen for connections on @address.

If @options includes %SOUP_SERVER_LISTEN_HTTPS, and @server has been configured for TLS, then @server will listen for https connections on this port. Otherwise it will listen for plain http.

You may call this method (along with the other "listen" methods) any number of times on a server, if you want to listen on multiple ports, or set up both http and https service.

After calling this method, @server will begin accepting and processing connections as soon as the appropriate [struct@GLib.MainContext] is run.

Note that this API does not make use of dual IPv4/IPv6 sockets; if @address is an IPv6 address, it will only accept IPv6 connections. You must configure IPv4 listening separately.

func (*Server) ListenAll

func (x *Server) ListenAll(PortVar uint, OptionsVar ServerListenOptions) (bool, error)

Attempts to set up @server to listen for connections on all interfaces on the system.

That is, it listens on the addresses `0.0.0.0` and/or `::`, depending on whether @options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither.) If @port is specified, @server will listen on that port. If it is 0, @server will find an unused port to listen on. (In that case, you can use [method@Server.get_uris] to find out what port it ended up choosing.

See [method@Server.listen] for more details.

func (*Server) ListenLocal

func (x *Server) ListenLocal(PortVar uint, OptionsVar ServerListenOptions) (bool, error)

Attempts to set up @server to listen for connections on "localhost".

That is, `127.0.0.1` and/or `::1`, depending on whether @options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither). If @port is specified, @server will listen on that port. If it is 0, @server will find an unused port to listen on. (In that case, you can use [method@Server.get_uris] to find out what port it ended up choosing.

See [method@Server.listen] for more details.

func (*Server) ListenSocket

func (x *Server) ListenSocket(SocketVar *gio.Socket, OptionsVar ServerListenOptions) (bool, error)

Attempts to set up @server to listen for connections on @socket.

See [method@Server.listen] for more details.

func (*Server) PauseMessage

func (x *Server) PauseMessage(MsgVar *ServerMessage)

Pauses I/O on @msg.

This can be used when you need to return from the server handler without having the full response ready yet. Use [method@Server.unpause_message] to resume I/O.

This must only be called on a [class@ServerMessage] which was created by the #SoupServer and are currently doing I/O, such as those passed into a [callback@ServerCallback] or emitted in a [signal@Server::request-read] signal.

func (*Server) RemoveAuthDomain

func (x *Server) RemoveAuthDomain(AuthDomainVar *AuthDomain)

Removes @auth_domain from @server.

func (*Server) RemoveHandler

func (x *Server) RemoveHandler(PathVar string)

Removes all handlers (early and normal) registered at @path.

func (*Server) RemoveWebsocketExtension

func (x *Server) RemoveWebsocketExtension(ExtensionTypeVar types.GType)

Removes support for WebSocket extension of type @extension_type (or any subclass of @extension_type) from @server.

func (*Server) SetGoPointer

func (c *Server) SetGoPointer(ptr uintptr)

func (*Server) SetPropertyRawPaths added in v0.0.4

func (x *Server) SetPropertyRawPaths(value bool)

SetPropertyRawPaths sets the "raw-paths" property. If %TRUE, percent-encoding in the Request-URI path will not be automatically decoded.

func (*Server) SetPropertyServerHeader added in v0.0.4

func (x *Server) SetPropertyServerHeader(value string)

SetPropertyServerHeader sets the "server-header" property. Server header.

If non-%NULL, the value to use for the "Server" header on [class@ServerMessage]s processed by this server.

The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes.

As with [property@Session:user_agent], if you set a [property@Server:server-header] property that has trailing whitespace, #SoupServer will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you.

func (*Server) SetTlsAuthMode

func (x *Server) SetTlsAuthMode(ModeVar gio.TlsAuthenticationMode)

Sets @server's #GTlsAuthenticationMode to use for SSL/TLS client authentication.

func (*Server) SetTlsCertificate

func (x *Server) SetTlsCertificate(CertificateVar *gio.TlsCertificate)

Sets @server up to do https, using the given SSL/TLS @certificate.

func (*Server) SetTlsDatabase

func (x *Server) SetTlsDatabase(TlsDatabaseVar *gio.TlsDatabase)

Sets @server's #GTlsDatabase to use for validating SSL/TLS client certificates.

func (*Server) UnpauseMessage

func (x *Server) UnpauseMessage(MsgVar *ServerMessage)

Resumes I/O on @msg.

Use this to resume after calling [method@Server.pause_message], or after adding a new chunk to a chunked response.

I/O won't actually resume until you return to the main loop.

This must only be called on a [class@ServerMessage] which was created by the #SoupServer and are currently doing I/O, such as those passed into a [callback@ServerCallback] or emitted in a [signal@Server::request-read] signal.

type ServerCallback

type ServerCallback func(uintptr, uintptr, string, *glib.HashTable, uintptr)

A callback used to handle requests to a [class@Server].

@path and @query contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, [class@Server] decodes all percent-encoding in the URI path, such that `"/foo%2Fbar"` is treated the same as `"/foo/bar"`. If your server is serving resources in some non-POSIX-filesystem namespace, you may want to distinguish those as two distinct paths. In that case, you can set the [property@Server:raw-paths] property when creating the [class@Server], and it will leave those characters undecoded.

@query contains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignore @query, and call [method@Message.get_uri] and parse the URI's query field yourself.

See [method@Server.add_handler] and [method@Server.add_early_handler] for details of what handlers can/should do.

type ServerClass

type ServerClass struct {
	ParentClass gobject.ObjectClass

	Padding [6]uintptr
	// contains filtered or unexported fields
}

func (*ServerClass) GetRequestAborted

func (x *ServerClass) GetRequestAborted() func(*Server, *ServerMessage)

GetRequestAborted gets the "request_aborted" callback function.

func (*ServerClass) GetRequestFinished

func (x *ServerClass) GetRequestFinished() func(*Server, *ServerMessage)

GetRequestFinished gets the "request_finished" callback function.

func (*ServerClass) GetRequestRead

func (x *ServerClass) GetRequestRead() func(*Server, *ServerMessage)

GetRequestRead gets the "request_read" callback function.

func (*ServerClass) GetRequestStarted

func (x *ServerClass) GetRequestStarted() func(*Server, *ServerMessage)

GetRequestStarted gets the "request_started" callback function.

func (*ServerClass) GoPointer

func (x *ServerClass) GoPointer() uintptr

func (*ServerClass) OverrideRequestAborted

func (x *ServerClass) OverrideRequestAborted(cb func(*Server, *ServerMessage))

OverrideRequestAborted sets the "request_aborted" callback function.

func (*ServerClass) OverrideRequestFinished

func (x *ServerClass) OverrideRequestFinished(cb func(*Server, *ServerMessage))

OverrideRequestFinished sets the "request_finished" callback function.

func (*ServerClass) OverrideRequestRead

func (x *ServerClass) OverrideRequestRead(cb func(*Server, *ServerMessage))

OverrideRequestRead sets the "request_read" callback function.

func (*ServerClass) OverrideRequestStarted

func (x *ServerClass) OverrideRequestStarted(cb func(*Server, *ServerMessage))

OverrideRequestStarted sets the "request_started" callback function.

type ServerListenOptions

type ServerListenOptions int

Options to pass to [method@Server.listen], etc.

%SOUP_SERVER_LISTEN_IPV4_ONLY and %SOUP_SERVER_LISTEN_IPV6_ONLY only make sense with [method@Server.listen_all] and [method@Server.listen_local], not plain [method@Server.listen] (which simply listens on whatever kind of socket you give it). And you cannot specify both of them in a single call.

const (

	// Listen for https connections rather
	//   than plain http.
	ServerListenHttpsValue ServerListenOptions = 1
	// Only listen on IPv4 interfaces.
	ServerListenIpv4OnlyValue ServerListenOptions = 2
	// Only listen on IPv6 interfaces.
	ServerListenIpv6OnlyValue ServerListenOptions = 4
)

type ServerMessage

type ServerMessage struct {
	gobject.Object
}

An HTTP server request and response pair.

A SoupServerMessage represents an HTTP message that is being sent or received on a [class@Server].

[class@Server] will create `SoupServerMessage`s automatically for incoming requests, which your application will receive via handlers.

Note that libsoup's terminology here does not quite match the HTTP specification: in RFC 2616, an "HTTP-message" is *either* a Request, *or* a Response. In libsoup, a #SoupServerMessage combines both the request and the response.

func ServerMessageNewFromInternalPtr

func ServerMessageNewFromInternalPtr(ptr uintptr) *ServerMessage

func (*ServerMessage) ConnectAcceptCertificate

func (x *ServerMessage) ConnectAcceptCertificate(cb *func(ServerMessage, uintptr, gio.TlsCertificateFlags) bool) uint

Emitted during the @msg's connection TLS handshake after client TLS certificate has been received. You can return %TRUE to accept @tls_certificate despite @tls_errors.

func (*ServerMessage) ConnectConnected

func (x *ServerMessage) ConnectConnected(cb *func(ServerMessage)) uint

Emitted when the @msg's socket is connected and the TLS handshake completed.

func (*ServerMessage) ConnectDisconnected

func (x *ServerMessage) ConnectDisconnected(cb *func(ServerMessage)) uint

Emitted when the @msg's socket is disconnected.

func (*ServerMessage) ConnectFinished

func (x *ServerMessage) ConnectFinished(cb *func(ServerMessage)) uint

Emitted when all HTTP processing is finished for a message. (After [signal@ServerMessage::wrote-body]).

func (*ServerMessage) ConnectGotBody

func (x *ServerMessage) ConnectGotBody(cb *func(ServerMessage)) uint

Emitted after receiving the complete request body.

func (*ServerMessage) ConnectGotChunk

func (x *ServerMessage) ConnectGotChunk(cb *func(ServerMessage, uintptr)) uint

Emitted after receiving a chunk of a message body.

Note that "chunk" in this context means any subpiece of the body, not necessarily the specific HTTP 1.1 chunks sent by the other side.

func (*ServerMessage) ConnectGotHeaders

func (x *ServerMessage) ConnectGotHeaders(cb *func(ServerMessage)) uint

Emitted after receiving the Request-Line and request headers.

func (*ServerMessage) ConnectWroteBody

func (x *ServerMessage) ConnectWroteBody(cb *func(ServerMessage)) uint

Emitted immediately after writing the complete response body for a message.

func (*ServerMessage) ConnectWroteBodyData

func (x *ServerMessage) ConnectWroteBodyData(cb *func(ServerMessage, uint)) uint

Emitted immediately after writing a portion of the message body to the network.

func (*ServerMessage) ConnectWroteChunk

func (x *ServerMessage) ConnectWroteChunk(cb *func(ServerMessage)) uint

Emitted immediately after writing a body chunk for a message.

Note that this signal is not parallel to [signal@ServerMessage::got-chunk]; it is emitted only when a complete chunk (added with [method@MessageBody.append] or [method@MessageBody.append_bytes] has been written. To get more useful continuous progress information, use [signal@ServerMessage::wrote-body-data].

func (*ServerMessage) ConnectWroteHeaders

func (x *ServerMessage) ConnectWroteHeaders(cb *func(ServerMessage)) uint

Emitted immediately after writing the response headers for a message.

func (*ServerMessage) ConnectWroteInformational

func (x *ServerMessage) ConnectWroteInformational(cb *func(ServerMessage)) uint

Emitted immediately after writing a 1xx (Informational) response.

func (*ServerMessage) GetHttpVersion

func (x *ServerMessage) GetHttpVersion() HTTPVersion

Get the HTTP version of @msg.

func (*ServerMessage) GetLocalAddress

func (x *ServerMessage) GetLocalAddress() *gio.SocketAddress

Retrieves the [class@Gio.SocketAddress] associated with the local end of a connection.

func (*ServerMessage) GetMethod

func (x *ServerMessage) GetMethod() string

Get the HTTP method of @msg.

func (*ServerMessage) GetReasonPhrase

func (x *ServerMessage) GetReasonPhrase() string

Get the HTTP reason phrase of @msg.

func (*ServerMessage) GetRemoteAddress

func (x *ServerMessage) GetRemoteAddress() *gio.SocketAddress

Retrieves the [class@Gio.SocketAddress] associated with the remote end of a connection.

func (*ServerMessage) GetRemoteHost

func (x *ServerMessage) GetRemoteHost() string

Retrieves the IP address associated with the remote end of a connection.

func (*ServerMessage) GetRequestBody

func (x *ServerMessage) GetRequestBody() *MessageBody

Get the request body of @msg.

func (*ServerMessage) GetRequestHeaders

func (x *ServerMessage) GetRequestHeaders() *MessageHeaders

Get the request headers of @msg.

func (*ServerMessage) GetResponseBody

func (x *ServerMessage) GetResponseBody() *MessageBody

Get the response body of @msg.

func (*ServerMessage) GetResponseHeaders

func (x *ServerMessage) GetResponseHeaders() *MessageHeaders

Get the response headers of @msg.

func (*ServerMessage) GetSocket

func (x *ServerMessage) GetSocket() *gio.Socket

Retrieves the [class@Gio.Socket] that @msg is associated with.

If you are using this method to observe when multiple requests are made on the same persistent HTTP connection (eg, as the ntlm-test test program does), you will need to pay attention to socket destruction as well (eg, by using weak references), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket.

func (*ServerMessage) GetStatus

func (x *ServerMessage) GetStatus() uint

Get the HTTP status code of @msg.

func (*ServerMessage) GetTlsPeerCertificate

func (x *ServerMessage) GetTlsPeerCertificate() *gio.TlsCertificate

Gets the peer's #GTlsCertificate associated with @msg's connection. Note that this is not set yet during the emission of SoupServerMessage::accept-certificate signal.

func (*ServerMessage) GetTlsPeerCertificateErrors

func (x *ServerMessage) GetTlsPeerCertificateErrors() gio.TlsCertificateFlags

Gets the errors associated with validating @msg's TLS peer certificate. Note that this is not set yet during the emission of SoupServerMessage::accept-certificate signal.

func (*ServerMessage) GetUri

func (x *ServerMessage) GetUri() *glib.Uri

Get @msg's URI.

func (*ServerMessage) GoPointer

func (c *ServerMessage) GoPointer() uintptr

func (*ServerMessage) IsOptionsPing

func (x *ServerMessage) IsOptionsPing() bool

Gets if @msg represents an OPTIONS message with the path `*`.

func (*ServerMessage) Pause

func (x *ServerMessage) Pause()

Pauses I/O on @msg.

This can be used when you need to return from the server handler without having the full response ready yet. Use [method@ServerMessage.unpause] to resume I/O.

func (*ServerMessage) SetGoPointer

func (c *ServerMessage) SetGoPointer(ptr uintptr)

func (*ServerMessage) SetHttpVersion

func (x *ServerMessage) SetHttpVersion(VersionVar HTTPVersion)

Set the HTTP version of @msg.

func (*ServerMessage) SetRedirect

func (x *ServerMessage) SetRedirect(StatusCodeVar uint, RedirectUriVar string)

Sets @msg's status_code to @status_code and adds a Location header pointing to @redirect_uri. Use this from a [class@Server] when you want to redirect the client to another URI.

@redirect_uri can be a relative URI, in which case it is interpreted relative to @msg's current URI. In particular, if @redirect_uri is just a path, it will replace the path *and query* of @msg's URI.

func (*ServerMessage) SetResponse

func (x *ServerMessage) SetResponse(ContentTypeVar *string, RespUseVar MemoryUse, RespBodyVar *string, RespLengthVar uint)

Convenience function to set the response body of a #SoupServerMessage. If @content_type is %NULL, the response body must be empty as well.

func (*ServerMessage) SetStatus

func (x *ServerMessage) SetStatus(StatusCodeVar uint, ReasonPhraseVar *string)

Sets @msg's status code to @status_code.

If @status_code is a known value and @reason_phrase is %NULL, the reason_phrase will be set automatically.

func (*ServerMessage) StealConnection

func (x *ServerMessage) StealConnection() *gio.IOStream

"Steals" the HTTP connection associated with @msg from its #SoupServer. This happens immediately, regardless of the current state of the connection; if the response to @msg has not yet finished being sent, then it will be discarded; you can steal the connection from a [signal@ServerMessage::wrote-informational] or [signal@ServerMessage::wrote-body] signal handler if you need to wait for part or all of the response to be sent.

Note that when calling this function from C, @msg will most likely be freed as a side effect.

func (*ServerMessage) Unpause

func (x *ServerMessage) Unpause()

Resumes I/O on @msg.

Use this to resume after calling [method@ServerMessage.pause], or after adding a new chunk to a chunked response. I/O won't actually resume until you return to the main loop.

type ServerMessageClass

type ServerMessageClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ServerMessageClass) GoPointer

func (x *ServerMessageClass) GoPointer() uintptr

type ServerWebsocketCallback

type ServerWebsocketCallback func(uintptr, uintptr, string, uintptr, uintptr)

A callback used to handle WebSocket requests to a #SoupServer.

The callback will be invoked after sending the handshake response back to the client (and is only invoked if the handshake was successful).

@path contains the path of the Request-URI, subject to the same rules as [callback@ServerCallback] `(qv)`.

type Session

type Session struct {
	gobject.Object
}

Soup session state object.

#SoupSession is the object that controls client-side HTTP. A #SoupSession encapsulates all of the state that libsoup is keeping on behalf of your program; cached HTTP connections, authentication information, etc. It also keeps track of various global options and features that you are using.

Most applications will only need a single #SoupSession; the primary reason you might need multiple sessions is if you need to have multiple independent authentication contexts. (Eg, you are connecting to a server and authenticating as two different users at different times; the easiest way to ensure that each [class@Message] is sent with the authentication information you intended is to use one session for the first user, and a second session for the other user.)

Additional #SoupSession functionality is provided by [iface@SessionFeature] objects, which can be added to a session with [method@Session.add_feature] or [method@Session.add_feature_by_type] For example, [class@Logger] provides support for logging HTTP traffic, [class@ContentDecoder] provides support for compressed response handling, and [class@ContentSniffer] provides support for HTML5-style response body content sniffing. Additionally, subtypes of [class@Auth] can be added as features, to add support for additional authentication types.

All `SoupSession`s are created with a [class@AuthManager], and support for %SOUP_TYPE_AUTH_BASIC and %SOUP_TYPE_AUTH_DIGEST. Additionally, sessions using the plain #SoupSession class (rather than one of its deprecated subtypes) have a [class@ContentDecoder] by default.

Note that all async methods will invoke their callbacks on the thread-default context at the time of the function call.

func NewSession

func NewSession() *Session

Creates a #SoupSession with the default options.

func NewSessionWithOptions

func NewSessionWithOptions(Optname1Var string, varArgs ...interface{}) *Session

Creates a #SoupSession with the specified options.

func SessionNewFromInternalPtr

func SessionNewFromInternalPtr(ptr uintptr) *Session

func (*Session) Abort

func (x *Session) Abort()

Cancels all pending requests in @session and closes all idle persistent connections.

func (*Session) AddFeature

func (x *Session) AddFeature(FeatureVar SessionFeature)

Adds @feature's functionality to @session. You cannot add multiple features of the same [alias@GObject.Type] to a session.

See the main #SoupSession documentation for information on what features are present in sessions by default.

func (*Session) AddFeatureByType

func (x *Session) AddFeatureByType(FeatureTypeVar types.GType)

If @feature_type is the type of a class that implements [iface@SessionFeature], this creates a new feature of that type and adds it to @session as with [method@Session.add_feature]. You can use this when you don't need to customize the new feature in any way. Adding multiple features of the same @feature_type is not allowed.

If @feature_type is not a [iface@SessionFeature] type, this gives each existing feature on @session the chance to accept @feature_type as a "subfeature". This can be used to add new [class@Auth] types, for instance.

See the main #SoupSession documentation for information on what features are present in sessions by default.

func (*Session) ConnectRequestQueued

func (x *Session) ConnectRequestQueued(cb *func(Session, uintptr)) uint

Emitted when a request is queued on @session.

When sending a request, first [signal@Session::request-queued] is emitted, indicating that the session has become aware of the request.

After a connection is available to send the request various [class@Message] signals are emitted as the message is processed. If the message is requeued, it will emit [signal@Message::restarted], which will then be followed by other [class@Message] signals when the message is re-sent.

Eventually, the message will emit [signal@Message::finished]. Normally, this signals the completion of message processing. However, it is possible that the application will requeue the message from the "finished" handler. In that case the process will loop back.

Eventually, a message will reach "finished" and not be requeued. At that point, the session will emit [signal@Session::request-unqueued] to indicate that it is done with the message.

To sum up: [signal@Session::request-queued] and [signal@Session::request-unqueued] are guaranteed to be emitted exactly once, but [signal@Message::finished] (and all of the other [class@Message] signals) may be invoked multiple times for a given message.

func (*Session) ConnectRequestUnqueued

func (x *Session) ConnectRequestUnqueued(cb *func(Session, uintptr)) uint

Emitted when a request is removed from @session's queue, indicating that @session is done with it.

See [signal@Session::request-queued] for a detailed description of the message lifecycle within a session.

func (*Session) GetAcceptLanguage

func (x *Session) GetAcceptLanguage() string

Get the value used by @session for the "Accept-Language" header on new requests.

func (*Session) GetAcceptLanguageAuto

func (x *Session) GetAcceptLanguageAuto() bool

Gets whether @session automatically sets the "Accept-Language" header on new requests.

func (*Session) GetAsyncResultMessage

func (x *Session) GetAsyncResultMessage(ResultVar gio.AsyncResult) *Message

Gets the [class@Message] of the @result asynchronous operation This is useful to get the [class@Message] of an asynchronous operation started by @session from its [callback@Gio.AsyncReadyCallback].

func (*Session) GetFeature

func (x *Session) GetFeature(FeatureTypeVar types.GType) *SessionFeatureBase

Gets the feature in @session of type @feature_type.

func (*Session) GetFeatureForMessage

func (x *Session) GetFeatureForMessage(FeatureTypeVar types.GType, MsgVar *Message) *SessionFeatureBase

Gets the feature in @session of type @feature_type, provided that it is not disabled for @msg.

func (*Session) GetIdleTimeout

func (x *Session) GetIdleTimeout() uint

Get the timeout in seconds for idle connection lifetime currently used by @session.

func (*Session) GetLocalAddress

func (x *Session) GetLocalAddress() *gio.InetSocketAddress

Get the [class@Gio.InetSocketAddress] to use for the client side of connections in @session.

func (*Session) GetMaxConns

func (x *Session) GetMaxConns() uint

Get the maximum number of connections that @session can open at once.

func (*Session) GetMaxConnsPerHost

func (x *Session) GetMaxConnsPerHost() uint

Get the maximum number of connections that @session can open at once to a given host.

func (*Session) GetPropertyAcceptLanguage added in v0.0.4

func (x *Session) GetPropertyAcceptLanguage() string

GetPropertyAcceptLanguage gets the "accept-language" property. If non-%NULL, the value to use for the "Accept-Language" header on [class@Message]s sent from this session.

Setting this will disable [property@Session:accept-language-auto].

func (*Session) GetPropertyAcceptLanguageAuto added in v0.0.4

func (x *Session) GetPropertyAcceptLanguageAuto() bool

GetPropertyAcceptLanguageAuto gets the "accept-language-auto" property. If %TRUE, #SoupSession will automatically set the string for the "Accept-Language" header on every [class@Message] sent, based on the return value of [func@GLib.get_language_names].

Setting this will override any previous value of [property@Session:accept-language].

func (*Session) GetPropertyIdleTimeout added in v0.0.4

func (x *Session) GetPropertyIdleTimeout() uint

GetPropertyIdleTimeout gets the "idle-timeout" property. Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed.

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value.

func (*Session) GetPropertyMaxConns added in v0.0.4

func (x *Session) GetPropertyMaxConns() int

GetPropertyMaxConns gets the "max-conns" property. The maximum number of connections that the session can open at once.

func (*Session) GetPropertyMaxConnsPerHost added in v0.0.4

func (x *Session) GetPropertyMaxConnsPerHost() int

GetPropertyMaxConnsPerHost gets the "max-conns-per-host" property. The maximum number of connections that the session can open at once to a given host.

func (*Session) GetPropertyTimeout added in v0.0.4

func (x *Session) GetPropertyTimeout() uint

GetPropertyTimeout gets the "timeout" property. The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request).

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value.

Not to be confused with [property@Session:idle-timeout] (which is the length of time that idle persistent connections will be kept open).

func (*Session) GetPropertyUserAgent added in v0.0.4

func (x *Session) GetPropertyUserAgent() string

GetPropertyUserAgent gets the "user-agent" property. User-Agent string.

If non-%NULL, the value to use for the "User-Agent" header on [class@Message]s sent from this session.

RFC 2616 says: "The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests."

The User-Agent header contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

If you set a [property@Session:user-agent] property that has trailing whitespace, #SoupSession will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you.

func (*Session) GetProxyResolver

func (x *Session) GetProxyResolver() *gio.ProxyResolverBase

Get the [iface@Gio.ProxyResolver] currently used by @session.

func (*Session) GetRemoteConnectable

func (x *Session) GetRemoteConnectable() *gio.SocketConnectableBase

Gets the remote connectable if one set.

func (*Session) GetTimeout

func (x *Session) GetTimeout() uint

Get the timeout in seconds for socket I/O operations currently used by @session.

func (*Session) GetTlsDatabase

func (x *Session) GetTlsDatabase() *gio.TlsDatabase

Get the [class@Gio.TlsDatabase] currently used by @session.

func (*Session) GetTlsInteraction

func (x *Session) GetTlsInteraction() *gio.TlsInteraction

Get the [class@Gio.TlsInteraction] currently used by @session.

func (*Session) GetUserAgent

func (x *Session) GetUserAgent() string

Get the value used by @session for the "User-Agent" header on new requests.

func (*Session) GoPointer

func (c *Session) GoPointer() uintptr

func (*Session) HasFeature

func (x *Session) HasFeature(FeatureTypeVar types.GType) bool

Tests if @session has at a feature of type @feature_type (which can be the type of either a [iface@SessionFeature], or else a subtype of some class managed by another feature, such as [class@Auth]).

func (*Session) PreconnectAsync

func (x *Session) PreconnectAsync(MsgVar *Message, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr)

Start a preconnection to @msg.

Once the connection is done, it will remain in idle state so that it can be reused by future requests. If there's already an idle connection for the given @msg host, the operation finishes successfully without creating a new connection. If a new request for the given @msg host is made while the preconnect is still ongoing, the request will take the ownership of the connection and the preconnect operation will finish successfully (if there's a connection error it will be handled by the request).

The operation finishes when the connection is done or an error occurred.

func (*Session) PreconnectFinish

func (x *Session) PreconnectFinish(ResultVar gio.AsyncResult) (bool, error)

Complete a preconnect async operation started with [method@Session.preconnect_async].

func (*Session) RemoveFeature

func (x *Session) RemoveFeature(FeatureVar SessionFeature)

Removes @feature's functionality from @session.

func (*Session) RemoveFeatureByType

func (x *Session) RemoveFeatureByType(FeatureTypeVar types.GType)

Removes all features of type @feature_type (or any subclass of @feature_type) from @session.

func (*Session) Send

func (x *Session) Send(MsgVar *Message, CancellableVar *gio.Cancellable) (*gio.InputStream, error)

Synchronously sends @msg and waits for the beginning of a response.

On success, a [class@Gio.InputStream] will be returned which you can use to read the response body. ("Success" here means only that an HTTP response was received and understood; it does not necessarily mean that a 2xx class status code was received.)

If non-%NULL, @cancellable can be used to cancel the request; [method@Session.send] will return a %G_IO_ERROR_CANCELLED error. Note that with requests that have side effects (eg, `POST`, `PUT`, `DELETE`) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If @msg is requeued due to a redirect or authentication, the initial (`3xx/401/407`) response body will be suppressed, and [method@Session.send] will only return once a final response has been received.

Possible error domains include [error@SessionError], [error@Gio.IOErrorEnum], and [error@Gio.TlsError] which you may want to specifically handle.

func (*Session) SendAndRead

func (x *Session) SendAndRead(MsgVar *Message, CancellableVar *gio.Cancellable) (*glib.Bytes, error)

Synchronously sends @msg and reads the response body.

On success, a [struct@GLib.Bytes] will be returned with the response body. This function should only be used when the resource to be retrieved is not too long and can be stored in memory.

See [method@Session.send] for more details on the general semantics.

func (*Session) SendAndReadAsync

func (x *Session) SendAndReadAsync(MsgVar *Message, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr)

Asynchronously sends @msg and reads the response body.

When @callback is called, then either @msg has been sent, and its response body read, or else an error has occurred. This function should only be used when the resource to be retrieved is not too long and can be stored in memory. Call [method@Session.send_and_read_finish] to get a [struct@GLib.Bytes] with the response body.

See [method@Session.send] for more details on the general semantics.

func (*Session) SendAndReadFinish

func (x *Session) SendAndReadFinish(ResultVar gio.AsyncResult) (*glib.Bytes, error)

Gets the response to a [method@Session.send_and_read_async].

If successful, returns a [struct@GLib.Bytes] with the response body.

func (*Session) SendAndSplice

func (x *Session) SendAndSplice(MsgVar *Message, OutStreamVar *gio.OutputStream, FlagsVar gio.OutputStreamSpliceFlags, CancellableVar *gio.Cancellable) (int, error)

Synchronously sends @msg and splices the response body stream into @out_stream.

See [method@Session.send] for more details on the general semantics.

func (*Session) SendAndSpliceAsync

func (x *Session) SendAndSpliceAsync(MsgVar *Message, OutStreamVar *gio.OutputStream, FlagsVar gio.OutputStreamSpliceFlags, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr)

Asynchronously sends @msg and splices the response body stream into @out_stream. When @callback is called, then either @msg has been sent and its response body spliced, or else an error has occurred.

See [method@Session.send] for more details on the general semantics.

func (*Session) SendAndSpliceFinish

func (x *Session) SendAndSpliceFinish(ResultVar gio.AsyncResult) (int, error)

Gets the response to a [method@Session.send_and_splice_async].

func (*Session) SendAsync

func (x *Session) SendAsync(MsgVar *Message, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr)

Asynchronously sends @msg and waits for the beginning of a response.

When @callback is called, then either @msg has been sent, and its response headers received, or else an error has occurred. Call [method@Session.send_finish] to get a [class@Gio.InputStream] for reading the response body.

See [method@Session.send] for more details on the general semantics.

func (*Session) SendFinish

func (x *Session) SendFinish(ResultVar gio.AsyncResult) (*gio.InputStream, error)

Gets the response to a [method@Session.send_async] call.

If successful returns a [class@Gio.InputStream] that can be used to read the response body.

func (*Session) SetAcceptLanguage

func (x *Session) SetAcceptLanguage(AcceptLanguageVar string)

Set the value to use for the "Accept-Language" header on [class@Message]s sent from @session.

If @accept_language is %NULL then no "Accept-Language" will be included in requests. See [property@Session:accept-language] for more information.

func (*Session) SetAcceptLanguageAuto

func (x *Session) SetAcceptLanguageAuto(AcceptLanguageAutoVar bool)

Set whether @session will automatically set the "Accept-Language" header on requests using a value generated from system languages based on [func@GLib.get_language_names].

See [property@Session:accept-language-auto] for more information.

func (*Session) SetGoPointer

func (c *Session) SetGoPointer(ptr uintptr)

func (*Session) SetIdleTimeout

func (x *Session) SetIdleTimeout(TimeoutVar uint)

Set a timeout in seconds for idle connection lifetime to be used by @session on new connections.

See [property@Session:idle-timeout] for more information.

func (*Session) SetPropertyAcceptLanguage added in v0.0.4

func (x *Session) SetPropertyAcceptLanguage(value string)

SetPropertyAcceptLanguage sets the "accept-language" property. If non-%NULL, the value to use for the "Accept-Language" header on [class@Message]s sent from this session.

Setting this will disable [property@Session:accept-language-auto].

func (*Session) SetPropertyAcceptLanguageAuto added in v0.0.4

func (x *Session) SetPropertyAcceptLanguageAuto(value bool)

SetPropertyAcceptLanguageAuto sets the "accept-language-auto" property. If %TRUE, #SoupSession will automatically set the string for the "Accept-Language" header on every [class@Message] sent, based on the return value of [func@GLib.get_language_names].

Setting this will override any previous value of [property@Session:accept-language].

func (*Session) SetPropertyIdleTimeout added in v0.0.4

func (x *Session) SetPropertyIdleTimeout(value uint)

SetPropertyIdleTimeout sets the "idle-timeout" property. Connection lifetime (in seconds) when idle. Any connection left idle longer than this will be closed.

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value.

func (*Session) SetPropertyMaxConns added in v0.0.4

func (x *Session) SetPropertyMaxConns(value int)

SetPropertyMaxConns sets the "max-conns" property. The maximum number of connections that the session can open at once.

func (*Session) SetPropertyMaxConnsPerHost added in v0.0.4

func (x *Session) SetPropertyMaxConnsPerHost(value int)

SetPropertyMaxConnsPerHost sets the "max-conns-per-host" property. The maximum number of connections that the session can open at once to a given host.

func (*Session) SetPropertyTimeout added in v0.0.4

func (x *Session) SetPropertyTimeout(value uint)

SetPropertyTimeout sets the "timeout" property. The timeout (in seconds) for socket I/O operations (including connecting to a server, and waiting for a reply to an HTTP request).

Although you can change this property at any time, it will only affect newly-created connections, not currently-open ones. You can call [method@Session.abort] after setting this if you want to ensure that all future connections will have this timeout value.

Not to be confused with [property@Session:idle-timeout] (which is the length of time that idle persistent connections will be kept open).

func (*Session) SetPropertyUserAgent added in v0.0.4

func (x *Session) SetPropertyUserAgent(value string)

SetPropertyUserAgent sets the "user-agent" property. User-Agent string.

If non-%NULL, the value to use for the "User-Agent" header on [class@Message]s sent from this session.

RFC 2616 says: "The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests."

The User-Agent header contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

If you set a [property@Session:user-agent] property that has trailing whitespace, #SoupSession will append its own product token (eg, `libsoup/2.3.2`) to the end of the header for you.

func (*Session) SetProxyResolver

func (x *Session) SetProxyResolver(ProxyResolverVar gio.ProxyResolver)

Set a [iface@Gio.ProxyResolver] to be used by @session on new connections.

If @proxy_resolver is %NULL then no proxies will be used. See [property@Session:proxy-resolver] for more information.

func (*Session) SetTimeout

func (x *Session) SetTimeout(TimeoutVar uint)

Set a timeout in seconds for socket I/O operations to be used by @session on new connections.

See [property@Session:timeout] for more information.

func (*Session) SetTlsDatabase

func (x *Session) SetTlsDatabase(TlsDatabaseVar *gio.TlsDatabase)

Set a [class@Gio.TlsDatabase] to be used by @session on new connections.

If @tls_database is %NULL then certificate validation will always fail. See [property@Session:tls-database] for more information.

func (*Session) SetTlsInteraction

func (x *Session) SetTlsInteraction(TlsInteractionVar *gio.TlsInteraction)

Set a [class@Gio.TlsInteraction] to be used by @session on new connections.

If @tls_interaction is %NULL then client certificate validation will always fail.

See [property@Session:tls-interaction] for more information.

func (*Session) SetUserAgent

func (x *Session) SetUserAgent(UserAgentVar string)

Set the value to use for the "User-Agent" header on [class@Message]s sent from @session.

If @user_agent has trailing whitespace, @session will append its own product token (eg, `libsoup/3.0.0`) to the end of the header for you. If @user_agent is %NULL then no "User-Agent" will be included in requests. See [property@Session:user-agent] for more information.

func (*Session) WebsocketConnectAsync

func (x *Session) WebsocketConnectAsync(MsgVar *Message, OriginVar *string, ProtocolsVar []string, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr)

Asynchronously creates a [class@WebsocketConnection] to communicate with a remote server.

All necessary WebSocket-related headers will be added to @msg, and it will then be sent and asynchronously processed normally (including handling of redirection and HTTP authentication).

If the server returns "101 Switching Protocols", then @msg's status code and response headers will be updated, and then the WebSocket handshake will be completed. On success, [method@Session.websocket_connect_finish] will return a new [class@WebsocketConnection]. On failure it will return a #GError.

If the server returns a status other than "101 Switching Protocols", then @msg will contain the complete response headers and body from the server's response, and [method@Session.websocket_connect_finish] will return %SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET.

func (*Session) WebsocketConnectFinish

func (x *Session) WebsocketConnectFinish(ResultVar gio.AsyncResult) (*WebsocketConnection, error)

Gets the [class@WebsocketConnection] response to a [method@Session.websocket_connect_async] call.

If successful, returns a [class@WebsocketConnection] that can be used to communicate with the server.

type SessionClass

type SessionClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*SessionClass) GetRequestQueued

func (x *SessionClass) GetRequestQueued() func(*Session, *Message)

GetRequestQueued gets the "request_queued" callback function.

func (*SessionClass) GetRequestUnqueued

func (x *SessionClass) GetRequestUnqueued() func(*Session, *Message)

GetRequestUnqueued gets the "request_unqueued" callback function.

func (*SessionClass) GetSoupReserved1

func (x *SessionClass) GetSoupReserved1() func()

GetSoupReserved1 gets the "_soup_reserved1" callback function.

func (*SessionClass) GetSoupReserved2

func (x *SessionClass) GetSoupReserved2() func()

GetSoupReserved2 gets the "_soup_reserved2" callback function.

func (*SessionClass) GetSoupReserved3

func (x *SessionClass) GetSoupReserved3() func()

GetSoupReserved3 gets the "_soup_reserved3" callback function.

func (*SessionClass) GetSoupReserved4

func (x *SessionClass) GetSoupReserved4() func()

GetSoupReserved4 gets the "_soup_reserved4" callback function.

func (*SessionClass) GetSoupReserved5

func (x *SessionClass) GetSoupReserved5() func()

GetSoupReserved5 gets the "_soup_reserved5" callback function.

func (*SessionClass) GetSoupReserved6

func (x *SessionClass) GetSoupReserved6() func()

GetSoupReserved6 gets the "_soup_reserved6" callback function.

func (*SessionClass) GetSoupReserved7

func (x *SessionClass) GetSoupReserved7() func()

GetSoupReserved7 gets the "_soup_reserved7" callback function.

func (*SessionClass) GetSoupReserved8

func (x *SessionClass) GetSoupReserved8() func()

GetSoupReserved8 gets the "_soup_reserved8" callback function.

func (*SessionClass) GoPointer

func (x *SessionClass) GoPointer() uintptr

func (*SessionClass) OverrideRequestQueued

func (x *SessionClass) OverrideRequestQueued(cb func(*Session, *Message))

OverrideRequestQueued sets the "request_queued" callback function.

func (*SessionClass) OverrideRequestUnqueued

func (x *SessionClass) OverrideRequestUnqueued(cb func(*Session, *Message))

OverrideRequestUnqueued sets the "request_unqueued" callback function.

func (*SessionClass) OverrideSoupReserved1

func (x *SessionClass) OverrideSoupReserved1(cb func())

OverrideSoupReserved1 sets the "_soup_reserved1" callback function.

func (*SessionClass) OverrideSoupReserved2

func (x *SessionClass) OverrideSoupReserved2(cb func())

OverrideSoupReserved2 sets the "_soup_reserved2" callback function.

func (*SessionClass) OverrideSoupReserved3

func (x *SessionClass) OverrideSoupReserved3(cb func())

OverrideSoupReserved3 sets the "_soup_reserved3" callback function.

func (*SessionClass) OverrideSoupReserved4

func (x *SessionClass) OverrideSoupReserved4(cb func())

OverrideSoupReserved4 sets the "_soup_reserved4" callback function.

func (*SessionClass) OverrideSoupReserved5

func (x *SessionClass) OverrideSoupReserved5(cb func())

OverrideSoupReserved5 sets the "_soup_reserved5" callback function.

func (*SessionClass) OverrideSoupReserved6

func (x *SessionClass) OverrideSoupReserved6(cb func())

OverrideSoupReserved6 sets the "_soup_reserved6" callback function.

func (*SessionClass) OverrideSoupReserved7

func (x *SessionClass) OverrideSoupReserved7(cb func())

OverrideSoupReserved7 sets the "_soup_reserved7" callback function.

func (*SessionClass) OverrideSoupReserved8

func (x *SessionClass) OverrideSoupReserved8(cb func())

OverrideSoupReserved8 sets the "_soup_reserved8" callback function.

type SessionError

type SessionError int

A #SoupSession error.

const (

	// the server's response could not
	//   be parsed
	SessionErrorParsingValue SessionError = 0
	// the server's response was in an
	//   unsupported format
	SessionErrorEncodingValue SessionError = 1
	// the message has been redirected
	//   too many times
	SessionErrorTooManyRedirectsValue SessionError = 2
	// the message has been restarted
	//   too many times
	SessionErrorTooManyRestartsValue SessionError = 3
	// failed to redirect message because
	//   Location header was missing or empty in response
	SessionErrorRedirectNoLocationValue SessionError = 4
	// failed to redirect message because
	//   Location header contains an invalid URI
	SessionErrorRedirectBadUriValue SessionError = 5
	// the message is already in the
	//   session queue. Messages can only be reused after unqueued.
	SessionErrorMessageAlreadyInQueueValue SessionError = 6
)

type SessionFeature

type SessionFeature interface {
	GoPointer() uintptr
	SetGoPointer(uintptr)
}

Interface for miscellaneous [class@Session] features.

#SoupSessionFeature is the interface used by classes that extend the functionality of a [class@Session]. Some features like HTTP authentication handling are implemented internally via `SoupSessionFeature`s. Other features can be added to the session by the application. (Eg, [class@Logger], [class@CookieJar].)

See [method@Session.add_feature], etc, to add a feature to a session.

type SessionFeatureBase

type SessionFeatureBase struct {
	Ptr uintptr
}

func (*SessionFeatureBase) GoPointer

func (x *SessionFeatureBase) GoPointer() uintptr

func (*SessionFeatureBase) SetGoPointer

func (x *SessionFeatureBase) SetGoPointer(ptr uintptr)

type SessionFeatureInterface

type SessionFeatureInterface struct {
	// contains filtered or unexported fields
}

The interface implemented by [iface@SessionFeature]s.

func (*SessionFeatureInterface) GoPointer

func (x *SessionFeatureInterface) GoPointer() uintptr

type Status

type Status int

These represent the known HTTP status code values, plus various network and internal errors.

Note that no libsoup functions take or return this type directly; any function that works with status codes will accept unrecognized status codes as well.

const (

	// No status available. (Eg, the message has not
	// been sent yet)
	StatusNoneValue Status = 0
	// 100 Continue (HTTP)
	StatusContinueValue Status = 100
	// 101 Switching Protocols (HTTP)
	StatusSwitchingProtocolsValue Status = 101
	// 102 Processing (WebDAV)
	StatusProcessingValue Status = 102
	// 200 Success (HTTP). Also used by many lower-level
	// soup routines to indicate success.
	StatusOkValue Status = 200
	// 201 Created (HTTP)
	StatusCreatedValue Status = 201
	// 202 Accepted (HTTP)
	StatusAcceptedValue Status = 202
	// 203 Non-Authoritative Information
	// (HTTP)
	StatusNonAuthoritativeValue Status = 203
	// 204 No Content (HTTP)
	StatusNoContentValue Status = 204
	// 205 Reset Content (HTTP)
	StatusResetContentValue Status = 205
	// 206 Partial Content (HTTP)
	StatusPartialContentValue Status = 206
	// 207 Multi-Status (WebDAV)
	StatusMultiStatusValue Status = 207
	// 300 Multiple Choices (HTTP)
	StatusMultipleChoicesValue Status = 300
	// 301 Moved Permanently (HTTP)
	StatusMovedPermanentlyValue Status = 301
	// 302 Found (HTTP)
	StatusFoundValue Status = 302
	// 302 Moved Temporarily (old name,
	// RFC 2068)
	StatusMovedTemporarilyValue Status = 302
	// 303 See Other (HTTP)
	StatusSeeOtherValue Status = 303
	// 304 Not Modified (HTTP)
	StatusNotModifiedValue Status = 304
	// 305 Use Proxy (HTTP)
	StatusUseProxyValue Status = 305
	// 306 [Unused] (HTTP)
	StatusNotAppearingInThisProtocolValue Status = 306
	// 307 Temporary Redirect (HTTP)
	StatusTemporaryRedirectValue Status = 307
	// 308 Permanent Redirect (HTTP)
	StatusPermanentRedirectValue Status = 308
	// 400 Bad Request (HTTP)
	StatusBadRequestValue Status = 400
	// 401 Unauthorized (HTTP)
	StatusUnauthorizedValue Status = 401
	// 402 Payment Required (HTTP)
	StatusPaymentRequiredValue Status = 402
	// 403 Forbidden (HTTP)
	StatusForbiddenValue Status = 403
	// 404 Not Found (HTTP)
	StatusNotFoundValue Status = 404
	// 405 Method Not Allowed (HTTP)
	StatusMethodNotAllowedValue Status = 405
	// 406 Not Acceptable (HTTP)
	StatusNotAcceptableValue Status = 406
	// 407 Proxy Authentication
	// Required (HTTP)
	StatusProxyAuthenticationRequiredValue Status = 407
	// shorter alias for
	// %SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED
	StatusProxyUnauthorizedValue Status = 407
	// 408 Request Timeout (HTTP)
	StatusRequestTimeoutValue Status = 408
	// 409 Conflict (HTTP)
	StatusConflictValue Status = 409
	// 410 Gone (HTTP)
	StatusGoneValue Status = 410
	// 411 Length Required (HTTP)
	StatusLengthRequiredValue Status = 411
	// 412 Precondition Failed (HTTP)
	StatusPreconditionFailedValue Status = 412
	// 413 Request Entity Too Large
	// (HTTP)
	StatusRequestEntityTooLargeValue Status = 413
	// 414 Request-URI Too Long (HTTP)
	StatusRequestUriTooLongValue Status = 414
	// 415 Unsupported Media Type
	// (HTTP)
	StatusUnsupportedMediaTypeValue Status = 415
	// 416 Requested Range
	// Not Satisfiable (HTTP)
	StatusRequestedRangeNotSatisfiableValue Status = 416
	// shorter alias for
	// %SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE
	StatusInvalidRangeValue Status = 416
	// 417 Expectation Failed (HTTP)
	StatusExpectationFailedValue Status = 417
	// 421 Misdirected Request
	StatusMisdirectedRequestValue Status = 421
	// 422 Unprocessable Entity
	// (WebDAV)
	StatusUnprocessableEntityValue Status = 422
	// 423 Locked (WebDAV)
	StatusLockedValue Status = 423
	// 424 Failed Dependency (WebDAV)
	StatusFailedDependencyValue Status = 424
	// 500 Internal Server Error
	// (HTTP)
	StatusInternalServerErrorValue Status = 500
	// 501 Not Implemented (HTTP)
	StatusNotImplementedValue Status = 501
	// 502 Bad Gateway (HTTP)
	StatusBadGatewayValue Status = 502
	// 503 Service Unavailable (HTTP)
	StatusServiceUnavailableValue Status = 503
	// 504 Gateway Timeout (HTTP)
	StatusGatewayTimeoutValue Status = 504
	// 505 HTTP Version Not
	// Supported (HTTP)
	StatusHttpVersionNotSupportedValue Status = 505
	// 507 Insufficient Storage
	// (WebDAV)
	StatusInsufficientStorageValue Status = 507
	// 510 Not Extended (RFC 2774)
	StatusNotExtendedValue Status = 510
)

type TLDError

type TLDError int

Error codes for %SOUP_TLD_ERROR.

const (

	// A hostname was syntactically
	//   invalid.
	TldErrorInvalidHostnameValue TLDError = 0
	// The passed-in "hostname" was
	//   actually an IP address (and thus has no base domain or
	//   public suffix).
	TldErrorIsIpAddressValue TLDError = 1
	// The passed-in hostname
	//   did not have enough components. Eg, calling
	//   [func@tld_get_base_domain] on <literal>"co.uk"</literal>.
	TldErrorNotEnoughDomainsValue TLDError = 2
	// The passed-in hostname has
	//   no recognized public suffix.
	TldErrorNoBaseDomainValue TLDError = 3
	// The Public Suffix List was not
	//   available.
	TldErrorNoPslDataValue TLDError = 4
)

type URIComponent

type URIComponent int

Enum values passed to [func@uri_copy] to indicate the components of the URI that should be updated with the given values.

const (

	// no component
	UriNoneValue URIComponent = 0
	// the URI scheme component
	UriSchemeValue URIComponent = 1
	// the URI user component
	UriUserValue URIComponent = 2
	// the URI password component
	UriPasswordValue URIComponent = 3
	// the URI authentication parameters component
	UriAuthParamsValue URIComponent = 4
	// the URI host component
	UriHostValue URIComponent = 5
	// the URI port component
	UriPortValue URIComponent = 6
	// the URI path component
	UriPathValue URIComponent = 7
	// the URI query component
	UriQueryValue URIComponent = 8
	// the URI fragment component
	UriFragmentValue URIComponent = 9
)

type WebsocketCloseCode

type WebsocketCloseCode int

Pre-defined close codes that can be passed to [method@WebsocketConnection.close] or received from [method@WebsocketConnection.get_close_code].

However, other codes are also allowed.

const (

	// a normal, non-error close
	WebsocketCloseNormalValue WebsocketCloseCode = 1000
	// the client/server is going away
	WebsocketCloseGoingAwayValue WebsocketCloseCode = 1001
	// a protocol error occurred
	WebsocketCloseProtocolErrorValue WebsocketCloseCode = 1002
	// the endpoint received data
	//   of a type that it does not support.
	WebsocketCloseUnsupportedDataValue WebsocketCloseCode = 1003
	// reserved value indicating that
	//   no close code was present; must not be sent.
	WebsocketCloseNoStatusValue WebsocketCloseCode = 1005
	// reserved value indicating that
	//   the connection was closed abnormally; must not be sent.
	WebsocketCloseAbnormalValue WebsocketCloseCode = 1006
	// the endpoint received data that
	//   was invalid (eg, non-UTF-8 data in a text message).
	WebsocketCloseBadDataValue WebsocketCloseCode = 1007
	// generic error code
	//   indicating some sort of policy violation.
	WebsocketClosePolicyViolationValue WebsocketCloseCode = 1008
	// the endpoint received a message
	//   that is too big to process.
	WebsocketCloseTooBigValue WebsocketCloseCode = 1009
	// the client is closing the
	//   connection because the server failed to negotiate a required
	//   extension.
	WebsocketCloseNoExtensionValue WebsocketCloseCode = 1010
	// the server is closing the
	//   connection because it was unable to fulfill the request.
	WebsocketCloseServerErrorValue WebsocketCloseCode = 1011
	// reserved value indicating that
	//   the TLS handshake failed; must not be sent.
	WebsocketCloseTlsHandshakeValue WebsocketCloseCode = 1015
)

type WebsocketConnection

type WebsocketConnection struct {
	gobject.Object
}

The WebSocket Protocol

Provides support for the [WebSocket](http://tools.ietf.org/html/rfc6455) protocol.

To connect to a WebSocket server, create a [class@Session] and call [method@Session.websocket_connect_async]. To accept WebSocket connections, create a [class@Server] and add a handler to it with [method@Server.add_websocket_handler].

(Lower-level support is available via [func@websocket_client_prepare_handshake] and [func@websocket_client_verify_handshake], for handling the client side of the WebSocket handshake, and [func@websocket_server_process_handshake] for handling the server side.)

#SoupWebsocketConnection handles the details of WebSocket communication. You can use [method@WebsocketConnection.send_text] and [method@WebsocketConnection.send_binary] to send data, and the [signal@WebsocketConnection::message] signal to receive data. (#SoupWebsocketConnection currently only supports asynchronous I/O.)

func NewWebsocketConnection

func NewWebsocketConnection(StreamVar *gio.IOStream, UriVar *glib.Uri, TypeVar WebsocketConnectionType, OriginVar *string, ProtocolVar *string, ExtensionsVar *glib.List) *WebsocketConnection

Creates a #SoupWebsocketConnection on @stream with the given active @extensions.

This should be called after completing the handshake to begin using the WebSocket protocol.

func WebsocketConnectionNewFromInternalPtr

func WebsocketConnectionNewFromInternalPtr(ptr uintptr) *WebsocketConnection

func (*WebsocketConnection) Close

func (x *WebsocketConnection) Close(CodeVar uint16, DataVar *string)

Close the connection in an orderly fashion.

Note that until the [signal@WebsocketConnection::closed] signal fires, the connection is not yet completely closed. The close message is not even sent until the main loop runs.

The @code and @data are sent to the peer along with the close request. If @code is %SOUP_WEBSOCKET_CLOSE_NO_STATUS a close message with no body (without code and data) is sent. Note that the @data must be UTF-8 valid.

func (*WebsocketConnection) ConnectClosed

func (x *WebsocketConnection) ConnectClosed(cb *func(WebsocketConnection)) uint

Emitted when the connection has completely closed.

This happens either due to an orderly close from the peer, one initiated via [method@WebsocketConnection.close] or a fatal error condition that caused a close.

This signal will be emitted once.

func (*WebsocketConnection) ConnectClosing

func (x *WebsocketConnection) ConnectClosing(cb *func(WebsocketConnection)) uint

This signal will be emitted during an orderly close.

func (*WebsocketConnection) ConnectError

func (x *WebsocketConnection) ConnectError(cb *func(WebsocketConnection, uintptr)) uint

Emitted when an error occurred on the WebSocket.

This may be fired multiple times. Fatal errors will be followed by the [signal@WebsocketConnection::closed] signal being emitted.

func (*WebsocketConnection) ConnectMessage

func (x *WebsocketConnection) ConnectMessage(cb *func(WebsocketConnection, int, uintptr)) uint

Emitted when we receive a message from the peer.

As a convenience, the @message data will always be %NULL-terminated, but the NUL byte will not be included in the length count.

func (*WebsocketConnection) ConnectPong

func (x *WebsocketConnection) ConnectPong(cb *func(WebsocketConnection, uintptr)) uint

Emitted when we receive a Pong frame (solicited or unsolicited) from the peer.

As a convenience, the @message data will always be %NULL-terminated, but the NUL byte will not be included in the length count.

func (*WebsocketConnection) GetCloseCode

func (x *WebsocketConnection) GetCloseCode() uint16

Get the close code received from the WebSocket peer.

This only becomes valid once the WebSocket is in the %SOUP_WEBSOCKET_STATE_CLOSED state. The value will often be in the [enum@WebsocketCloseCode] enumeration, but may also be an application defined close code.

func (*WebsocketConnection) GetCloseData

func (x *WebsocketConnection) GetCloseData() string

Get the close data received from the WebSocket peer.

This only becomes valid once the WebSocket is in the %SOUP_WEBSOCKET_STATE_CLOSED state. The data may be freed once the main loop is run, so copy it if you need to keep it around.

func (*WebsocketConnection) GetConnectionType

func (x *WebsocketConnection) GetConnectionType() WebsocketConnectionType

Get the connection type (client/server) of the connection.

func (*WebsocketConnection) GetExtensions

func (x *WebsocketConnection) GetExtensions() *glib.List

Get the extensions chosen via negotiation with the peer.

func (*WebsocketConnection) GetIoStream

func (x *WebsocketConnection) GetIoStream() *gio.IOStream

Get the I/O stream the WebSocket is communicating over.

func (*WebsocketConnection) GetKeepaliveInterval

func (x *WebsocketConnection) GetKeepaliveInterval() uint

Gets the keepalive interval in seconds or 0 if disabled.

func (*WebsocketConnection) GetKeepalivePongTimeout

func (x *WebsocketConnection) GetKeepalivePongTimeout() uint

Gets the keepalive pong timeout in seconds or 0 if disabled.

func (*WebsocketConnection) GetMaxIncomingPayloadSize

func (x *WebsocketConnection) GetMaxIncomingPayloadSize() uint64

Gets the maximum payload size allowed for incoming packets.

func (*WebsocketConnection) GetOrigin

func (x *WebsocketConnection) GetOrigin() string

Get the origin of the WebSocket.

func (*WebsocketConnection) GetPropertyExtensions added in v0.0.4

func (x *WebsocketConnection) GetPropertyExtensions() uintptr

GetPropertyExtensions gets the "extensions" property. List of [class@WebsocketExtension] objects that are active in the connection.

func (*WebsocketConnection) GetPropertyKeepaliveInterval added in v0.0.4

func (x *WebsocketConnection) GetPropertyKeepaliveInterval() uint

GetPropertyKeepaliveInterval gets the "keepalive-interval" property. Interval in seconds on when to send a ping message which will serve as a keepalive message.

If set to 0 the keepalive message is disabled.

func (*WebsocketConnection) GetPropertyKeepalivePongTimeout added in v0.0.4

func (x *WebsocketConnection) GetPropertyKeepalivePongTimeout() uint

GetPropertyKeepalivePongTimeout gets the "keepalive-pong-timeout" property. Timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection. The WebSocket will be transitioned to a closed state when this happens.

If set to 0 then the absence of pongs from keepalive pings is ignored.

func (*WebsocketConnection) GetPropertyMaxIncomingPayloadSize added in v0.0.4

func (x *WebsocketConnection) GetPropertyMaxIncomingPayloadSize() uint64

GetPropertyMaxIncomingPayloadSize gets the "max-incoming-payload-size" property. The maximum payload size for incoming packets.

The protocol expects or 0 to not limit it.

func (*WebsocketConnection) GetPropertyOrigin added in v0.0.4

func (x *WebsocketConnection) GetPropertyOrigin() string

GetPropertyOrigin gets the "origin" property. The client's Origin.

func (*WebsocketConnection) GetPropertyProtocol added in v0.0.4

func (x *WebsocketConnection) GetPropertyProtocol() string

GetPropertyProtocol gets the "protocol" property. The chosen protocol, or %NULL if a protocol was not agreed upon.

func (*WebsocketConnection) GetPropertyUri added in v0.0.4

func (x *WebsocketConnection) GetPropertyUri() uintptr

GetPropertyUri gets the "uri" property. The URI of the WebSocket.

For servers this represents the address of the WebSocket, and for clients it is the address connected to.

func (*WebsocketConnection) GetProtocol

func (x *WebsocketConnection) GetProtocol() string

Get the protocol chosen via negotiation with the peer.

func (*WebsocketConnection) GetState

func (x *WebsocketConnection) GetState() WebsocketState

Get the current state of the WebSocket.

func (*WebsocketConnection) GetUri

func (x *WebsocketConnection) GetUri() *glib.Uri

Get the URI of the WebSocket.

For servers this represents the address of the WebSocket, and for clients it is the address connected to.

func (*WebsocketConnection) GoPointer

func (c *WebsocketConnection) GoPointer() uintptr

func (*WebsocketConnection) SendBinary

func (x *WebsocketConnection) SendBinary(DataVar []byte, LengthVar uint)

Send a binary message to the peer.

If @length is 0, @data may be %NULL.

The message is queued to be sent and will be sent when the main loop is run.

func (*WebsocketConnection) SendMessage

func (x *WebsocketConnection) SendMessage(TypeVar WebsocketDataType, MessageVar *glib.Bytes)

Send a message of the given @type to the peer. Note that this method, allows to send text messages containing %NULL characters.

The message is queued to be sent and will be sent when the main loop is run.

func (*WebsocketConnection) SendText

func (x *WebsocketConnection) SendText(TextVar string)

Send a %NULL-terminated text (UTF-8) message to the peer.

If you need to send text messages containing %NULL characters use [method@WebsocketConnection.send_message] instead.

The message is queued to be sent and will be sent when the main loop is run.

func (*WebsocketConnection) SetGoPointer

func (c *WebsocketConnection) SetGoPointer(ptr uintptr)

func (*WebsocketConnection) SetKeepaliveInterval

func (x *WebsocketConnection) SetKeepaliveInterval(IntervalVar uint)

Sets the interval in seconds on when to send a ping message which will serve as a keepalive message.

If set to 0 the keepalive message is disabled.

func (*WebsocketConnection) SetKeepalivePongTimeout

func (x *WebsocketConnection) SetKeepalivePongTimeout(PongTimeoutVar uint)

Set the timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection.

If set to 0 then the absence of pongs from keepalive pings is ignored.

func (*WebsocketConnection) SetMaxIncomingPayloadSize

func (x *WebsocketConnection) SetMaxIncomingPayloadSize(MaxIncomingPayloadSizeVar uint64)

Sets the maximum payload size allowed for incoming packets.

It does not limit the outgoing packet size.

func (*WebsocketConnection) SetPropertyExtensions added in v0.0.4

func (x *WebsocketConnection) SetPropertyExtensions(value uintptr)

SetPropertyExtensions sets the "extensions" property. List of [class@WebsocketExtension] objects that are active in the connection.

func (*WebsocketConnection) SetPropertyKeepaliveInterval added in v0.0.4

func (x *WebsocketConnection) SetPropertyKeepaliveInterval(value uint)

SetPropertyKeepaliveInterval sets the "keepalive-interval" property. Interval in seconds on when to send a ping message which will serve as a keepalive message.

If set to 0 the keepalive message is disabled.

func (*WebsocketConnection) SetPropertyKeepalivePongTimeout added in v0.0.4

func (x *WebsocketConnection) SetPropertyKeepalivePongTimeout(value uint)

SetPropertyKeepalivePongTimeout sets the "keepalive-pong-timeout" property. Timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection. The WebSocket will be transitioned to a closed state when this happens.

If set to 0 then the absence of pongs from keepalive pings is ignored.

func (*WebsocketConnection) SetPropertyMaxIncomingPayloadSize added in v0.0.4

func (x *WebsocketConnection) SetPropertyMaxIncomingPayloadSize(value uint64)

SetPropertyMaxIncomingPayloadSize sets the "max-incoming-payload-size" property. The maximum payload size for incoming packets.

The protocol expects or 0 to not limit it.

func (*WebsocketConnection) SetPropertyOrigin added in v0.0.4

func (x *WebsocketConnection) SetPropertyOrigin(value string)

SetPropertyOrigin sets the "origin" property. The client's Origin.

func (*WebsocketConnection) SetPropertyProtocol added in v0.0.4

func (x *WebsocketConnection) SetPropertyProtocol(value string)

SetPropertyProtocol sets the "protocol" property. The chosen protocol, or %NULL if a protocol was not agreed upon.

func (*WebsocketConnection) SetPropertyUri added in v0.0.4

func (x *WebsocketConnection) SetPropertyUri(value uintptr)

SetPropertyUri sets the "uri" property. The URI of the WebSocket.

For servers this represents the address of the WebSocket, and for clients it is the address connected to.

type WebsocketConnectionClass

type WebsocketConnectionClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

The abstract base class for [class@WebsocketConnection].

func (*WebsocketConnectionClass) GoPointer

func (x *WebsocketConnectionClass) GoPointer() uintptr

type WebsocketConnectionType

type WebsocketConnectionType int

The type of a [class@WebsocketConnection].

const (

	// unknown/invalid connection
	WebsocketConnectionUnknownValue WebsocketConnectionType = 0
	// a client-side connection
	WebsocketConnectionClientValue WebsocketConnectionType = 1
	// a server-side connection
	WebsocketConnectionServerValue WebsocketConnectionType = 2
)

type WebsocketDataType

type WebsocketDataType int

The type of data contained in a [signal@WebsocketConnection::message] signal.

const (

	// UTF-8 text
	WebsocketDataTextValue WebsocketDataType = 1
	// binary data
	WebsocketDataBinaryValue WebsocketDataType = 2
)

type WebsocketError

type WebsocketError int

WebSocket-related errors.

const (

	// a generic error
	WebsocketErrorFailedValue WebsocketError = 0
	// attempted to handshake with a
	//   server that does not appear to understand WebSockets.
	WebsocketErrorNotWebsocketValue WebsocketError = 1
	// the WebSocket handshake failed
	//   because some detail was invalid (eg, incorrect accept key).
	WebsocketErrorBadHandshakeValue WebsocketError = 2
	// the WebSocket handshake failed
	//   because the "Origin" header was not an allowed value.
	WebsocketErrorBadOriginValue WebsocketError = 3
)

type WebsocketExtension

type WebsocketExtension struct {
	gobject.Object
}

A WebSocket extension

#SoupWebsocketExtension is the base class for WebSocket extension objects.

func WebsocketExtensionNewFromInternalPtr

func WebsocketExtensionNewFromInternalPtr(ptr uintptr) *WebsocketExtension

func (*WebsocketExtension) Configure

func (x *WebsocketExtension) Configure(ConnectionTypeVar WebsocketConnectionType, ParamsVar *glib.HashTable) (bool, error)

Configures @extension with the given @params.

func (*WebsocketExtension) GetRequestParams

func (x *WebsocketExtension) GetRequestParams() string

Get the parameters strings to be included in the request header.

If the extension doesn't include any parameter in the request, this function returns %NULL.

func (*WebsocketExtension) GetResponseParams

func (x *WebsocketExtension) GetResponseParams() string

Get the parameters strings to be included in the response header.

If the extension doesn't include any parameter in the response, this function returns %NULL.

func (*WebsocketExtension) GoPointer

func (c *WebsocketExtension) GoPointer() uintptr

func (*WebsocketExtension) ProcessIncomingMessage

func (x *WebsocketExtension) ProcessIncomingMessage(HeaderVar byte, PayloadVar *glib.Bytes) (*glib.Bytes, error)

Process a message after it's received.

If the payload isn't changed the given @payload is just returned, otherwise [method@GLib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data.

Extensions using reserved bits of the header will reset them in @header.

func (*WebsocketExtension) ProcessOutgoingMessage

func (x *WebsocketExtension) ProcessOutgoingMessage(HeaderVar byte, PayloadVar *glib.Bytes) (*glib.Bytes, error)

Process a message before it's sent.

If the payload isn't changed the given @payload is just returned, otherwise [method@Glib.Bytes.unref] is called on the given @payload and a new [struct@GLib.Bytes] is returned with the new data.

Extensions using reserved bits of the header will change them in @header.

func (*WebsocketExtension) SetGoPointer

func (c *WebsocketExtension) SetGoPointer(ptr uintptr)

type WebsocketExtensionClass

type WebsocketExtensionClass struct {
	ParentClass gobject.ObjectClass

	Name uintptr

	Padding [6]uintptr
	// contains filtered or unexported fields
}

The class structure for the #SoupWebsocketExtension.

func (*WebsocketExtensionClass) GetConfigure

GetConfigure gets the "configure" callback function. called to configure the extension with the given parameters

func (*WebsocketExtensionClass) GetGetRequestParams

func (x *WebsocketExtensionClass) GetGetRequestParams() func(*WebsocketExtension) string

GetGetRequestParams gets the "get_request_params" callback function. called by the client to build the request header.

It should include the parameters string starting with ';'

func (*WebsocketExtensionClass) GetGetResponseParams

func (x *WebsocketExtensionClass) GetGetResponseParams() func(*WebsocketExtension) string

GetGetResponseParams gets the "get_response_params" callback function. called by the server to build the response header.

It should include the parameters string starting with ';'

func (*WebsocketExtensionClass) GetProcessIncomingMessage

func (x *WebsocketExtensionClass) GetProcessIncomingMessage() func(*WebsocketExtension, byte, *glib.Bytes) *glib.Bytes

GetProcessIncomingMessage gets the "process_incoming_message" callback function. called to process the payload data of a message

after it's received. Reserved bits of the header should be cleared.

func (*WebsocketExtensionClass) GetProcessOutgoingMessage

func (x *WebsocketExtensionClass) GetProcessOutgoingMessage() func(*WebsocketExtension, byte, *glib.Bytes) *glib.Bytes

GetProcessOutgoingMessage gets the "process_outgoing_message" callback function. called to process the payload data of a message

before it's sent. Reserved bits of the header should be changed.

func (*WebsocketExtensionClass) GoPointer

func (x *WebsocketExtensionClass) GoPointer() uintptr

func (*WebsocketExtensionClass) OverrideConfigure

OverrideConfigure sets the "configure" callback function. called to configure the extension with the given parameters

func (*WebsocketExtensionClass) OverrideGetRequestParams

func (x *WebsocketExtensionClass) OverrideGetRequestParams(cb func(*WebsocketExtension) string)

OverrideGetRequestParams sets the "get_request_params" callback function. called by the client to build the request header.

It should include the parameters string starting with ';'

func (*WebsocketExtensionClass) OverrideGetResponseParams

func (x *WebsocketExtensionClass) OverrideGetResponseParams(cb func(*WebsocketExtension) string)

OverrideGetResponseParams sets the "get_response_params" callback function. called by the server to build the response header.

It should include the parameters string starting with ';'

func (*WebsocketExtensionClass) OverrideProcessIncomingMessage

func (x *WebsocketExtensionClass) OverrideProcessIncomingMessage(cb func(*WebsocketExtension, byte, *glib.Bytes) *glib.Bytes)

OverrideProcessIncomingMessage sets the "process_incoming_message" callback function. called to process the payload data of a message

after it's received. Reserved bits of the header should be cleared.

func (*WebsocketExtensionClass) OverrideProcessOutgoingMessage

func (x *WebsocketExtensionClass) OverrideProcessOutgoingMessage(cb func(*WebsocketExtension, byte, *glib.Bytes) *glib.Bytes)

OverrideProcessOutgoingMessage sets the "process_outgoing_message" callback function. called to process the payload data of a message

before it's sent. Reserved bits of the header should be changed.

type WebsocketExtensionDeflate

type WebsocketExtensionDeflate struct {
	WebsocketExtension
}

A SoupWebsocketExtensionDeflate is a [class@WebsocketExtension] implementing permessage-deflate (RFC 7692).

This extension is used by default in a [class@Session] when [class@WebsocketExtensionManager] feature is present, and always used by [class@Server].

func WebsocketExtensionDeflateNewFromInternalPtr

func WebsocketExtensionDeflateNewFromInternalPtr(ptr uintptr) *WebsocketExtensionDeflate

func (*WebsocketExtensionDeflate) GoPointer

func (c *WebsocketExtensionDeflate) GoPointer() uintptr

func (*WebsocketExtensionDeflate) SetGoPointer

func (c *WebsocketExtensionDeflate) SetGoPointer(ptr uintptr)

type WebsocketExtensionDeflateClass

type WebsocketExtensionDeflateClass struct {
	ParentClass WebsocketExtensionClass
	// contains filtered or unexported fields
}

func (*WebsocketExtensionDeflateClass) GoPointer

func (x *WebsocketExtensionDeflateClass) GoPointer() uintptr

type WebsocketExtensionManager

type WebsocketExtensionManager struct {
	gobject.Object
}

SoupWebsocketExtensionManager is the [iface@SessionFeature] that handles WebSockets extensions for a [class@Session].

A #SoupWebsocketExtensionManager is added to the session by default, and normally you don't need to worry about it at all. However, if you want to disable WebSocket extensions, you can remove the feature from the session with [method@Session.remove_feature_by_type] or disable it on individual requests with [method@Message.disable_feature].

func WebsocketExtensionManagerNewFromInternalPtr

func WebsocketExtensionManagerNewFromInternalPtr(ptr uintptr) *WebsocketExtensionManager

func (*WebsocketExtensionManager) GoPointer

func (c *WebsocketExtensionManager) GoPointer() uintptr

func (*WebsocketExtensionManager) SetGoPointer

func (c *WebsocketExtensionManager) SetGoPointer(ptr uintptr)

type WebsocketExtensionManagerClass

type WebsocketExtensionManagerClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*WebsocketExtensionManagerClass) GoPointer

func (x *WebsocketExtensionManagerClass) GoPointer() uintptr

type WebsocketState

type WebsocketState int

The state of the WebSocket connection.

const (

	// the connection is ready to send messages
	WebsocketStateOpenValue WebsocketState = 1
	// the connection is in the process of
	//   closing down; messages may be received, but not sent
	WebsocketStateClosingValue WebsocketState = 2
	// the connection is completely closed down
	WebsocketStateClosedValue WebsocketState = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL