soup

package
v0.0.0-...-dee1973 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ADDRESS_ANY_PORT = 0

ADDRESS_ANY_PORT: this can be passed to any Address method that expects a port, to indicate that you don't care what port is used.

View Source
const ADDRESS_FAMILY = "family"

ADDRESS_FAMILY alias for the Address:family property. (The AddressFamily for this address.).

View Source
const ADDRESS_NAME = "name"

ADDRESS_NAME alias for the Address:name property. (The hostname for this address.).

View Source
const ADDRESS_PHYSICAL = "physical"

ADDRESS_PHYSICAL alias for the Address:physical property. (The stringified IP address for this address.).

View Source
const ADDRESS_PORT = "port"

ADDRESS_PORT alias for the Address:port property. (The port for this address.).

View Source
const ADDRESS_PROTOCOL = "protocol"

ADDRESS_PROTOCOL alias for the Address:protocol property. (The URI scheme used with this address.).

View Source
const ADDRESS_SOCKADDR = "sockaddr"

ADDRESS_SOCKADDR alias for the Address:sockaddr property. (A pointer to the struct sockaddr for this address.).

View Source
const AUTH_DOMAIN_ADD_PATH = "add-path"

AUTH_DOMAIN_ADD_PATH alias for the AuthDomain:add-path property. (Shortcut for calling soup_auth_domain_add_path().).

View Source
const AUTH_DOMAIN_BASIC_AUTH_CALLBACK = "auth-callback"

AUTH_DOMAIN_BASIC_AUTH_CALLBACK alias for the AuthDomainBasic:auth-callback property. (The AuthDomainBasicAuthCallback.).

View Source
const AUTH_DOMAIN_BASIC_AUTH_DATA = "auth-data"

AUTH_DOMAIN_BASIC_AUTH_DATA alias for the AuthDomainBasic:auth-data property. (The data to pass to the AuthDomainBasicAuthCallback.).

View Source
const AUTH_DOMAIN_DIGEST_AUTH_CALLBACK = "auth-callback"

AUTH_DOMAIN_DIGEST_AUTH_CALLBACK alias for the AuthDomainDigest:auth-callback property. (The AuthDomainDigestAuthCallback.).

View Source
const AUTH_DOMAIN_DIGEST_AUTH_DATA = "auth-data"

AUTH_DOMAIN_DIGEST_AUTH_DATA alias for the AuthDomainDigest:auth-callback property. (The AuthDomainDigestAuthCallback.).

View Source
const AUTH_DOMAIN_FILTER = "filter"

AUTH_DOMAIN_FILTER alias for the AuthDomain:filter property. (The AuthDomainFilter for the domain.).

View Source
const AUTH_DOMAIN_FILTER_DATA = "filter-data"

AUTH_DOMAIN_FILTER_DATA alias for the AuthDomain:filter-data property. (Data to pass to the AuthDomainFilter.).

View Source
const AUTH_DOMAIN_GENERIC_AUTH_CALLBACK = "generic-auth-callback"

AUTH_DOMAIN_GENERIC_AUTH_CALLBACK alias for the AuthDomain:generic-auth-callback property. (The AuthDomainGenericAuthCallback.).

View Source
const AUTH_DOMAIN_GENERIC_AUTH_DATA = "generic-auth-data"

AUTH_DOMAIN_GENERIC_AUTH_DATA alias for the AuthDomain:generic-auth-data property. (The data to pass to the AuthDomainGenericAuthCallback.).

View Source
const AUTH_DOMAIN_PROXY = "proxy"

AUTH_DOMAIN_PROXY alias for the AuthDomain:proxy property. (Whether or not this is a proxy auth domain.).

View Source
const AUTH_DOMAIN_REALM = "realm"

AUTH_DOMAIN_REALM alias for the AuthDomain:realm property. (The realm of this auth domain.).

View Source
const AUTH_DOMAIN_REMOVE_PATH = "remove-path"

AUTH_DOMAIN_REMOVE_PATH alias for the AuthDomain:remove-path property. (Shortcut for calling soup_auth_domain_remove_path().).

View Source
const AUTH_HOST = "host"

AUTH_HOST alias for the Auth:host property. (The host being authenticated to.).

View Source
const AUTH_IS_AUTHENTICATED = "is-authenticated"

AUTH_IS_AUTHENTICATED alias for the Auth:is-authenticated property. (Whether or not the auth has been authenticated.).

View Source
const AUTH_IS_FOR_PROXY = "is-for-proxy"

AUTH_IS_FOR_PROXY alias for the Auth:is-for-proxy property. (Whether or not the auth is for a proxy server.).

View Source
const AUTH_REALM = "realm"

AUTH_REALM alias for the Auth:realm property. (The authentication realm.).

View Source
const AUTH_SCHEME_NAME = "scheme-name"

AUTH_SCHEME_NAME alias for the Auth:scheme-name property. (The authentication scheme name.).

View Source
const CHAR_HTTP_CTL = 16
View Source
const CHAR_HTTP_SEPARATOR = 8
View Source
const CHAR_URI_GEN_DELIMS = 2
View Source
const CHAR_URI_PERCENT_ENCODED = 1
View Source
const CHAR_URI_SUB_DELIMS = 4
View Source
const COOKIE_JAR_ACCEPT_POLICY = "accept-policy"

COOKIE_JAR_ACCEPT_POLICY alias for the CookieJar:accept-policy property.

View Source
const COOKIE_JAR_DB_FILENAME = "filename"

COOKIE_JAR_DB_FILENAME alias for the CookieJarDB:filename property. (The cookie-storage filename.).

View Source
const COOKIE_JAR_READ_ONLY = "read-only"

COOKIE_JAR_READ_ONLY alias for the CookieJar:read-only property. (Whether or not the cookie jar is read-only.).

View Source
const COOKIE_JAR_TEXT_FILENAME = "filename"

COOKIE_JAR_TEXT_FILENAME alias for the CookieJarText:filename property. (The cookie-storage filename.).

View Source
const COOKIE_MAX_AGE_ONE_DAY = 0

COOKIE_MAX_AGE_ONE_DAY: constant corresponding to 1 day, for use with soup_cookie_new() and soup_cookie_set_max_age().

View Source
const COOKIE_MAX_AGE_ONE_HOUR = 3600

COOKIE_MAX_AGE_ONE_HOUR: constant corresponding to 1 hour, for use with soup_cookie_new() and soup_cookie_set_max_age().

View Source
const COOKIE_MAX_AGE_ONE_WEEK = 0

COOKIE_MAX_AGE_ONE_WEEK: constant corresponding to 1 week, for use with soup_cookie_new() and soup_cookie_set_max_age().

View Source
const COOKIE_MAX_AGE_ONE_YEAR = 0

COOKIE_MAX_AGE_ONE_YEAR: constant corresponding to 1 year, for use with soup_cookie_new() and soup_cookie_set_max_age().

View Source
const FORM_MIME_TYPE_MULTIPART = "multipart/form-data"

FORM_MIME_TYPE_MULTIPART: macro containing the value <literal>"multipart/form-data"</literal>; the MIME type used for posting form data that contains files to be uploaded.

View Source
const FORM_MIME_TYPE_URLENCODED = "application/x-www-form-urlencoded"

FORM_MIME_TYPE_URLENCODED: macro containing the value <literal>"application/x-www-form-urlencoded"</literal>; the default MIME type for POSTing HTML form data.

View Source
const HSTS_ENFORCER_DB_FILENAME = "filename"
View Source
const HSTS_POLICY_MAX_AGE_PAST = 0
View Source
const LOGGER_LEVEL = "level"

LOGGER_LEVEL alias for the Logger:level property, qv.

View Source
const LOGGER_MAX_BODY_SIZE = "max-body-size"

LOGGER_MAX_BODY_SIZE alias for the Logger:max-body-size property, qv.

View Source
const MAJOR_VERSION = 2

MAJOR_VERSION: like soup_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.

View Source
const MESSAGE_FIRST_PARTY = "first-party"

MESSAGE_FIRST_PARTY alias for the Message:first-party property. (The URI loaded in the application when the message was queued.).

View Source
const MESSAGE_FLAGS = "flags"

MESSAGE_FLAGS alias for the Message:flags property. (The message's MessageFlags.).

View Source
const MESSAGE_HTTP_VERSION = "http-version"

MESSAGE_HTTP_VERSION alias for the Message:http-version property. (The message's HTTPVersion.).

View Source
const MESSAGE_IS_TOP_LEVEL_NAVIGATION = "is-top-level-navigation"
View Source
const MESSAGE_METHOD = "method"

MESSAGE_METHOD alias for the Message:method property. (The message's HTTP method.).

View Source
const MESSAGE_PRIORITY = "priority"

MESSAGE_PRIORITY sets the priority of the Message. See soup_message_set_priority() for further details.

View Source
const MESSAGE_REASON_PHRASE = "reason-phrase"

MESSAGE_REASON_PHRASE alias for the Message:reason-phrase property. (The message's HTTP response reason phrase.).

View Source
const MESSAGE_REQUEST_BODY = "request-body"

MESSAGE_REQUEST_BODY alias for the Message:request-body property. (The message's HTTP request body.).

View Source
const MESSAGE_REQUEST_BODY_DATA = "request-body-data"

MESSAGE_REQUEST_BODY_DATA alias for the Message:request-body-data property. (The message's HTTP request body, as a #GBytes.).

View Source
const MESSAGE_REQUEST_HEADERS = "request-headers"

MESSAGE_REQUEST_HEADERS alias for the Message:request-headers property. (The message's HTTP request headers.).

View Source
const MESSAGE_RESPONSE_BODY = "response-body"

MESSAGE_RESPONSE_BODY alias for the Message:response-body property. (The message's HTTP response body.).

View Source
const MESSAGE_RESPONSE_BODY_DATA = "response-body-data"

MESSAGE_RESPONSE_BODY_DATA alias for the Message:response-body-data property. (The message's HTTP response body, as a #GBytes.).

View Source
const MESSAGE_RESPONSE_HEADERS = "response-headers"

MESSAGE_RESPONSE_HEADERS alias for the Message:response-headers property. (The message's HTTP response headers.).

View Source
const MESSAGE_SERVER_SIDE = "server-side"

MESSAGE_SERVER_SIDE alias for the Message:server-side property. (TRUE if the message was created by Server.).

View Source
const MESSAGE_SITE_FOR_COOKIES = "site-for-cookies"
View Source
const MESSAGE_STATUS_CODE = "status-code"

MESSAGE_STATUS_CODE alias for the Message:status-code property. (The message's HTTP response status code.).

View Source
const MESSAGE_TLS_CERTIFICATE = "tls-certificate"

MESSAGE_TLS_CERTIFICATE alias for the Message:tls-certificate property. (The TLS certificate associated with the message, if any.).

View Source
const MESSAGE_TLS_ERRORS = "tls-errors"

MESSAGE_TLS_ERRORS alias for the Message:tls-errors property. (The verification errors on Message:tls-certificate.).

View Source
const MESSAGE_URI = "uri"

MESSAGE_URI alias for the Message:uri property. (The message's URI.).

View Source
const MICRO_VERSION = 3

MICRO_VERSION: like soup_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.

View Source
const MINOR_VERSION = 74

MINOR_VERSION: like soup_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.

View Source
const REQUEST_SESSION = "session"

REQUEST_SESSION alias for the Request:session property, qv.

View Source
const REQUEST_URI = "uri"

REQUEST_URI alias for the Request:uri property, qv.

View Source
const SERVER_ADD_WEBSOCKET_EXTENSION = "add-websocket-extension"

SERVER_ADD_WEBSOCKET_EXTENSION alias for the Server:add-websocket-extension property, qv.

View Source
const SERVER_ASYNC_CONTEXT = "async-context"

SERVER_ASYNC_CONTEXT alias for the deprecated Server:async-context property, qv.

Deprecated: The new API uses the thread-default Context rather than having an explicitly-specified one.

View Source
const SERVER_HTTPS_ALIASES = "https-aliases"

SERVER_HTTPS_ALIASES alias for the Server:https-aliases property, qv.

View Source
const SERVER_HTTP_ALIASES = "http-aliases"

SERVER_HTTP_ALIASES alias for the Server:http-aliases property, qv.

View Source
const SERVER_INTERFACE = "interface"

SERVER_INTERFACE alias for the Server:interface property, qv.

Deprecated: Servers can listen on multiple interfaces at once now. Use soup_server_listen(), etc, to listen on an interface, and soup_server_get_uris() to see what addresses are being listened on.

View Source
const SERVER_PORT = "port"

SERVER_PORT alias for the deprecated Server:port property, qv.

Deprecated: Servers can listen on multiple interfaces at once now. Use soup_server_listen(), etc, to listen on a port, and soup_server_get_uris() to see what ports are being listened on.

View Source
const SERVER_RAW_PATHS = "raw-paths"

SERVER_RAW_PATHS alias for the Server:raw-paths property. (If TRUE, percent-encoding in the Request-URI path will not be automatically decoded.).

View Source
const SERVER_REMOVE_WEBSOCKET_EXTENSION = "remove-websocket-extension"

SERVER_REMOVE_WEBSOCKET_EXTENSION alias for the Server:remove-websocket-extension property, qv.

View Source
const SERVER_SERVER_HEADER = "server-header"

SERVER_SERVER_HEADER alias for the Server:server-header property, qv.

View Source
const SERVER_SSL_CERT_FILE = "ssl-cert-file"

SERVER_SSL_CERT_FILE alias for the Server:ssl-cert-file property, qv.

Deprecated: use Server:tls-certificate or soup_server_set_ssl_certificate().

View Source
const SERVER_SSL_KEY_FILE = "ssl-key-file"

SERVER_SSL_KEY_FILE alias for the Server:ssl-key-file property, qv.

Deprecated: use Server:tls-certificate or soup_server_set_ssl_certificate().

View Source
const SERVER_TLS_CERTIFICATE = "tls-certificate"

SERVER_TLS_CERTIFICATE alias for the Server:tls-certificate property, qv.

View Source
const SESSION_ACCEPT_LANGUAGE = "accept-language"

SESSION_ACCEPT_LANGUAGE alias for the Session:accept-language property, qv.

View Source
const SESSION_ACCEPT_LANGUAGE_AUTO = "accept-language-auto"

SESSION_ACCEPT_LANGUAGE_AUTO alias for the Session:accept-language-auto property, qv.

View Source
const SESSION_ADD_FEATURE = "add-feature"

SESSION_ADD_FEATURE alias for the Session:add-feature property, qv.

View Source
const SESSION_ADD_FEATURE_BY_TYPE = "add-feature-by-type"

SESSION_ADD_FEATURE_BY_TYPE alias for the Session:add-feature-by-type property, qv.

View Source
const SESSION_ASYNC_CONTEXT = "async-context"

SESSION_ASYNC_CONTEXT alias for the Session:async-context property, qv.

View Source
const SESSION_HTTPS_ALIASES = "https-aliases"

SESSION_HTTPS_ALIASES alias for the Session:https-aliases property, qv.

View Source
const SESSION_HTTP_ALIASES = "http-aliases"

SESSION_HTTP_ALIASES alias for the Session:http-aliases property, qv.

View Source
const SESSION_IDLE_TIMEOUT = "idle-timeout"

SESSION_IDLE_TIMEOUT alias for the Session:idle-timeout property, qv.

View Source
const SESSION_LOCAL_ADDRESS = "local-address"

SESSION_LOCAL_ADDRESS alias for the Session:local-address property, qv.

View Source
const SESSION_MAX_CONNS = "max-conns"

SESSION_MAX_CONNS alias for the Session:max-conns property, qv.

View Source
const SESSION_MAX_CONNS_PER_HOST = "max-conns-per-host"

SESSION_MAX_CONNS_PER_HOST alias for the Session:max-conns-per-host property, qv.

View Source
const SESSION_PROXY_RESOLVER = "proxy-resolver"

SESSION_PROXY_RESOLVER alias for the Session:proxy-resolver property, qv.

View Source
const SESSION_PROXY_URI = "proxy-uri"

SESSION_PROXY_URI alias for the Session:proxy-uri property, qv.

View Source
const SESSION_REMOVE_FEATURE_BY_TYPE = "remove-feature-by-type"

SESSION_REMOVE_FEATURE_BY_TYPE alias for the Session:remove-feature-by-type property, qv.

View Source
const SESSION_SSL_CA_FILE = "ssl-ca-file"

SESSION_SSL_CA_FILE alias for the Session:ssl-ca-file property, qv.

View Source
const SESSION_SSL_STRICT = "ssl-strict"

SESSION_SSL_STRICT alias for the Session:ssl-strict property, qv.

View Source
const SESSION_SSL_USE_SYSTEM_CA_FILE = "ssl-use-system-ca-file"

SESSION_SSL_USE_SYSTEM_CA_FILE alias for the Session:ssl-use-system-ca-file property, qv.

View Source
const SESSION_TIMEOUT = "timeout"

SESSION_TIMEOUT alias for the Session:timeout property, qv.

View Source
const SESSION_TLS_DATABASE = "tls-database"

SESSION_TLS_DATABASE alias for the Session:tls-database property, qv.

View Source
const SESSION_TLS_INTERACTION = "tls-interaction"

SESSION_TLS_INTERACTION alias for the Session:tls-interaction property, qv.

View Source
const SESSION_USER_AGENT = "user-agent"

SESSION_USER_AGENT alias for the Session:user-agent property, qv.

View Source
const SESSION_USE_NTLM = "use-ntlm"

SESSION_USE_NTLM alias for the Session:use-ntlm property, qv.

View Source
const SESSION_USE_THREAD_CONTEXT = "use-thread-context"

SESSION_USE_THREAD_CONTEXT alias for the Session:use-thread-context property, qv.

View Source
const SOCKET_ASYNC_CONTEXT = "async-context"

SOCKET_ASYNC_CONTEXT alias for the Socket:async-context property. (The socket's Context.).

View Source
const SOCKET_FLAG_NONBLOCKING = "non-blocking"

SOCKET_FLAG_NONBLOCKING alias for the Socket:non-blocking property. (Whether or not the socket uses non-blocking I/O.).

View Source
const SOCKET_IS_SERVER = "is-server"

SOCKET_IS_SERVER alias for the Socket:is-server property, qv.

View Source
const SOCKET_LOCAL_ADDRESS = "local-address"

SOCKET_LOCAL_ADDRESS alias for the Socket:local-address property. (Address of local end of socket.).

View Source
const SOCKET_REMOTE_ADDRESS = "remote-address"

SOCKET_REMOTE_ADDRESS alias for the Socket:remote-address property. (Address of remote end of socket.).

View Source
const SOCKET_SSL_CREDENTIALS = "ssl-creds"

SOCKET_SSL_CREDENTIALS alias for the Socket:ssl-creds property. (SSL credential information.).

View Source
const SOCKET_SSL_FALLBACK = "ssl-fallback"

SOCKET_SSL_FALLBACK alias for the Socket:ssl-fallback property.

View Source
const SOCKET_SSL_STRICT = "ssl-strict"

SOCKET_SSL_STRICT alias for the Socket:ssl-strict property.

View Source
const SOCKET_TIMEOUT = "timeout"

SOCKET_TIMEOUT alias for the Socket:timeout property. (The timeout in seconds for blocking socket I/O operations.).

View Source
const SOCKET_TLS_CERTIFICATE = "tls-certificate"

SOCKET_TLS_CERTIFICATE alias for the Socket:tls-certificate property. Note that this property's value is only useful if the socket is for a TLS connection, and only reliable after some data has been transferred to or from it.

View Source
const SOCKET_TLS_ERRORS = "tls-errors"

SOCKET_TLS_ERRORS alias for the Socket:tls-errors property. Note that this property's value is only useful if the socket is for a TLS connection, and only reliable after some data has been transferred to or from it.

View Source
const SOCKET_TRUSTED_CERTIFICATE = "trusted-certificate"

SOCKET_TRUSTED_CERTIFICATE alias for the Socket:trusted-certificate property.

View Source
const SOCKET_USE_THREAD_CONTEXT = "use-thread-context"

SOCKET_USE_THREAD_CONTEXT alias for the Socket:use-thread-context property. (Use g_main_context_get_thread_default()).

View Source
const VERSION_MIN_REQUIRED = 2

VERSION_MIN_REQUIRED: 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).

Variables

View Source
var (
	GTypeAddressFamily = coreglib.Type(C.soup_address_family_get_type())
	GTypeAddress       = coreglib.Type(C.soup_address_get_type())
)

GType values.

View Source
var (
	GTypeDateFormat = coreglib.Type(C.soup_date_format_get_type())
	GTypeDate       = coreglib.Type(C.soup_date_get_type())
)

GType values.

View Source
var (
	GTypeLoggerLogLevel = coreglib.Type(C.soup_logger_log_level_get_type())
	GTypeLogger         = coreglib.Type(C.soup_logger_get_type())
)

GType values.

View Source
var (
	GTypeMemoryUse   = coreglib.Type(C.soup_memory_use_get_type())
	GTypeBuffer      = coreglib.Type(C.soup_buffer_get_type())
	GTypeMessageBody = coreglib.Type(C.soup_message_body_get_type())
)

GType values.

View Source
var (
	GTypeEncoding           = coreglib.Type(C.soup_encoding_get_type())
	GTypeMessageHeadersType = coreglib.Type(C.soup_message_headers_type_get_type())
	GTypeExpectation        = coreglib.Type(C.soup_expectation_get_type())
	GTypeMessageHeaders     = coreglib.Type(C.soup_message_headers_get_type())
)

GType values.

View Source
var (
	GTypeHTTPVersion     = coreglib.Type(C.soup_http_version_get_type())
	GTypeMessagePriority = coreglib.Type(C.soup_message_priority_get_type())
	GTypeMessageFlags    = coreglib.Type(C.soup_message_flags_get_type())
	GTypeMessage         = coreglib.Type(C.soup_message_get_type())
)

GType values.

View Source
var (
	GTypeServer        = coreglib.Type(C.soup_server_get_type())
	GTypeClientContext = coreglib.Type(C.soup_client_context_get_type())
)

GType values.

View Source
var (
	GTypeSocketIOStatus = coreglib.Type(C.soup_socket_io_status_get_type())
	GTypeSocket         = coreglib.Type(C.soup_socket_get_type())
)

GType values.

View Source
var (
	GTypeWebsocketCloseCode      = coreglib.Type(C.soup_websocket_close_code_get_type())
	GTypeWebsocketConnectionType = coreglib.Type(C.soup_websocket_connection_type_get_type())
	GTypeWebsocketDataType       = coreglib.Type(C.soup_websocket_data_type_get_type())
	GTypeWebsocketError          = coreglib.Type(C.soup_websocket_error_get_type())
	GTypeWebsocketState          = coreglib.Type(C.soup_websocket_state_get_type())
)

GType values.

View Source
var (
	GTypeCacheResponse   = coreglib.Type(C.soup_cache_response_get_type())
	GTypeConnectionState = coreglib.Type(C.soup_connection_state_get_type())
	GTypeKnownStatusCode = coreglib.Type(C.soup_known_status_code_get_type())
	GTypeRequesterError  = coreglib.Type(C.soup_requester_error_get_type())
	GTypeSameSitePolicy  = coreglib.Type(C.soup_same_site_policy_get_type())
	GTypeXMLRPCError     = coreglib.Type(C.soup_xmlrpc_error_get_type())
	GTypeCacheability    = coreglib.Type(C.soup_cacheability_get_type())
	GTypeAuthBasic       = coreglib.Type(C.soup_auth_basic_get_type())
	GTypeAuthDigest      = coreglib.Type(C.soup_auth_digest_get_type())
	GTypeAuthNTLM        = coreglib.Type(C.soup_auth_ntlm_get_type())
	GTypeAuthNegotiate   = coreglib.Type(C.soup_auth_negotiate_get_type())
)

GType values.

View Source
var (
	GTypeAuth = coreglib.Type(C.soup_auth_get_type())
)

GType values.

View Source
var (
	GTypeAuthDomain = coreglib.Type(C.soup_auth_domain_get_type())
)

GType values.

View Source
var (
	GTypeAuthDomainBasic = coreglib.Type(C.soup_auth_domain_basic_get_type())
)

GType values.

View Source
var (
	GTypeAuthDomainDigest = coreglib.Type(C.soup_auth_domain_digest_get_type())
)

GType values.

View Source
var (
	GTypeAuthManager = coreglib.Type(C.soup_auth_manager_get_type())
)

GType values.

View Source
var (
	GTypeCache = coreglib.Type(C.soup_cache_get_type())
)

GType values.

View Source
var (
	GTypeCacheType = coreglib.Type(C.soup_cache_type_get_type())
)

GType values.

View Source
var (
	GTypeContentDecoder = coreglib.Type(C.soup_content_decoder_get_type())
)

GType values.

View Source
var (
	GTypeContentSniffer = coreglib.Type(C.soup_content_sniffer_get_type())
)

GType values.

View Source
var (
	GTypeCookie = coreglib.Type(C.soup_cookie_get_type())
)

GType values.

View Source
var (
	GTypeCookieJar = coreglib.Type(C.soup_cookie_jar_get_type())
)

GType values.

View Source
var (
	GTypeCookieJarAcceptPolicy = coreglib.Type(C.soup_cookie_jar_accept_policy_get_type())
)

GType values.

View Source
var (
	GTypeCookieJarDB = coreglib.Type(C.soup_cookie_jar_db_get_type())
)

GType values.

View Source
var (
	GTypeCookieJarText = coreglib.Type(C.soup_cookie_jar_text_get_type())
)

GType values.

View Source
var (
	GTypeHSTSEnforcer = coreglib.Type(C.soup_hsts_enforcer_get_type())
)

GType values.

View Source
var (
	GTypeHSTSEnforcerDB = coreglib.Type(C.soup_hsts_enforcer_db_get_type())
)

GType values.

View Source
var (
	GTypeHSTSPolicy = coreglib.Type(C.soup_hsts_policy_get_type())
)

GType values.

View Source
var (
	GTypeMultipart = coreglib.Type(C.soup_multipart_get_type())
)

GType values.

View Source
var (
	GTypeMultipartInputStream = coreglib.Type(C.soup_multipart_input_stream_get_type())
)

GType values.

View Source
var (
	GTypeProxyResolver = coreglib.Type(C.soup_proxy_resolver_get_type())
)

GType values.

View Source
var (
	GTypeProxyResolverDefault = coreglib.Type(C.soup_proxy_resolver_default_get_type())
)

GType values.

View Source
var (
	GTypeProxyURIResolver = coreglib.Type(C.soup_proxy_uri_resolver_get_type())
)

GType values.

View Source
var (
	GTypeRequest = coreglib.Type(C.soup_request_get_type())
)

GType values.

View Source
var (
	GTypeRequestData = coreglib.Type(C.soup_request_data_get_type())
)

GType values.

View Source
var (
	GTypeRequestError = coreglib.Type(C.soup_request_error_get_type())
)

GType values.

View Source
var (
	GTypeRequestFile = coreglib.Type(C.soup_request_file_get_type())
)

GType values.

View Source
var (
	GTypeRequestHTTP = coreglib.Type(C.soup_request_http_get_type())
)

GType values.

View Source
var (
	GTypeServerListenOptions = coreglib.Type(C.soup_server_listen_options_get_type())
)

GType values.

View Source
var (
	GTypeSession = coreglib.Type(C.soup_session_get_type())
)

GType values.

View Source
var (
	GTypeSessionAsync = coreglib.Type(C.soup_session_async_get_type())
)

GType values.

View Source
var (
	GTypeSessionFeature = coreglib.Type(C.soup_session_feature_get_type())
)

GType values.

View Source
var (
	GTypeSessionSync = coreglib.Type(C.soup_session_sync_get_type())
)

GType values.

View Source
var (
	GTypeStatus = coreglib.Type(C.soup_status_get_type())
)

GType values.

View Source
var (
	GTypeTLDError = coreglib.Type(C.soup_tld_error_get_type())
)

GType values.

View Source
var (
	GTypeURI = coreglib.Type(C.soup_uri_get_type())
)

GType values.

View Source
var (
	GTypeWebsocketConnection = coreglib.Type(C.soup_websocket_connection_get_type())
)

GType values.

View Source
var (
	GTypeWebsocketExtension = coreglib.Type(C.soup_websocket_extension_get_type())
)

GType values.

View Source
var (
	GTypeWebsocketExtensionDeflate = coreglib.Type(C.soup_websocket_extension_deflate_get_type())
)

GType values.

View Source
var (
	GTypeWebsocketExtensionManager = coreglib.Type(C.soup_websocket_extension_manager_get_type())
)

GType values.

View Source
var (
	GTypeXMLRPCFault = coreglib.Type(C.soup_xmlrpc_fault_get_type())
)

GType values.

Functions

func AuthDomainDigestEncodePassword

func AuthDomainDigestEncodePassword(username, realm, password string) string

AuthDomainDigestEncodePassword 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 AuthDomainDigest's auth handler.

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

The function takes the following parameters:

  • username: username.
  • realm: auth realm name.
  • password for username in realm.

The function returns the following values:

  • utf8: encoded password.

func AuthNegotiateSupported

func AuthNegotiateSupported() bool

AuthNegotiateSupported 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 Session, but libsoup will never attempt to actually use this auth type.

The function returns the following values:

func CheckVersion

func CheckVersion(major, minor, micro uint) bool

CheckVersion: like SOUP_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.

The function takes the following parameters:

  • major version to check.
  • minor version to check.
  • micro version to check.

The function returns the following values:

  • ok: TRUE if the version of the libsoup currently loaded is the same as or newer than the passed-in version.

func CookiesToCookieHeader

func CookiesToCookieHeader(cookies []*Cookie) string

CookiesToCookieHeader serializes a List of Cookie into a string suitable for setting as the value of the "Cookie" header.

The function takes the following parameters:

  • cookies of Cookie.

The function returns the following values:

  • utf8: serialization of cookies.

func CookiesToRequest

func CookiesToRequest(cookies []*Cookie, msg *Message)

CookiesToRequest 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.).

The function takes the following parameters:

  • cookies of Cookie.
  • msg: Message.

func CookiesToResponse

func CookiesToResponse(cookies []*Cookie, msg *Message)

CookiesToResponse 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.).

The function takes the following parameters:

  • cookies of Cookie.
  • msg: Message.

func FormDecode

func FormDecode(encodedForm string) map[string]string

FormDecode decodes form, which is an urlencoded dataset as defined in the HTML 4.01 spec.

The function takes the following parameters:

  • encodedForm: data of type "application/x-www-form-urlencoded".

The function returns the following values:

  • hashTable: hash table containing the name/value pairs from encoded_form, which you can free with g_hash_table_destroy().

func FormEncodeHash

func FormEncodeHash(formDataSet map[string]string) string

FormEncodeHash encodes form_data_set into a value of type "application/x-www-form-urlencoded", 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 soup_form_encode_datalist().

The function takes the following parameters:

  • formDataSet: hash table containing name/value pairs (as strings).

The function returns the following values:

  • utf8: encoded form.

func GetMajorVersion

func GetMajorVersion() uint

GetMajorVersion 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 UP_MAJOR_VERSION macro, which represents the major version of the libsoup headers you have included when compiling your code.

The function returns the following values:

  • guint: major version number of the libsoup library.

func GetMicroVersion

func GetMicroVersion() uint

GetMicroVersion 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 UP_MICRO_VERSION macro, which represents the micro version of the libsoup headers you have included when compiling your code.

The function returns the following values:

  • guint: micro version number of the libsoup library.

func GetMinorVersion

func GetMinorVersion() uint

GetMinorVersion 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 UP_MINOR_VERSION macro, which represents the minor version of the libsoup headers you have included when compiling your code.

The function returns the following values:

  • guint: minor version number of the libsoup library.

func HTTPErrorQuark

func HTTPErrorQuark() glib.Quark

The function returns the following values:

func HeaderContains

func HeaderContains(header, token string) bool

HeaderContains 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.

The function takes the following parameters:

  • header: HTTP header suitable for parsing with soup_header_parse_list().
  • token: token.

The function returns the following values:

  • ok: whether or not header contains token.

func HeaderFreeParamList

func HeaderFreeParamList(paramList map[string]string)

HeaderFreeParamList frees param_list.

The function takes the following parameters:

  • paramList returned from soup_header_parse_param_list() or soup_header_parse_semi_param_list().

func HeaderParseList

func HeaderParseList(header string) []string

HeaderParseList parses a header whose content is described by RFC2616 as "#something", where "something" does not itself contain commas, except as part of quoted-strings.

The function takes the following parameters:

  • header value.

The function returns the following values:

  • sList of list elements, as allocated strings.

func HeaderParseParamList

func HeaderParseParamList(header string) map[string]string

HeaderParseParamList parses a header which is a comma-delimited list of something like: <literal>token [ "=" ( token | quoted-string ) ]</literal>.

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).

The function takes the following parameters:

  • header value.

The function returns the following values:

  • hashTable: a Table of list elements, which can be freed with soup_header_free_param_list().

func HeaderParseParamListStrict

func HeaderParseParamListStrict(header string) map[string]string

HeaderParseParamListStrict: strict version of soup_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 soup_header_parse_param_list() instead.

The function takes the following parameters:

  • header value.

The function returns the following values:

  • hashTable (optional): a Table of list elements, which can be freed with soup_header_free_param_list() or NULL if there are duplicate elements.

func HeaderParseQualityList

func HeaderParseQualityList(header string) (unacceptable, sList []string)

HeaderParseQualityList 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.

The function takes the following parameters:

  • header value.

The function returns the following values:

  • unacceptable (optional): on return, will contain a list of unacceptable values.
  • sList of acceptable values (as allocated strings), highest-qvalue first.

func HeaderParseSemiParamList

func HeaderParseSemiParamList(header string) map[string]string

HeaderParseSemiParamList parses a header which is a semicolon-delimited list of something like: <literal>token [ "=" ( token | quoted-string ) ]</literal>.

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).

The function takes the following parameters:

  • header value.

The function returns the following values:

  • hashTable: a Table of list elements, which can be freed with soup_header_free_param_list().

func HeaderParseSemiParamListStrict

func HeaderParseSemiParamListStrict(header string) map[string]string

HeaderParseSemiParamListStrict: strict version of soup_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 soup_header_parse_semi_param_list() instead.

The function takes the following parameters:

  • header value.

The function returns the following values:

  • hashTable (optional): a Table of list elements, which can be freed with soup_header_free_param_list() or NULL if there are duplicate elements.

func HeadersParse

func HeadersParse(str string, len int, dest *MessageHeaders) bool

HeadersParse 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 soup_headers_parse_request() or soup_headers_parse_response().

The function takes the following parameters:

  • str: header string (including the Request-Line or Status-Line, but not the trailing blank line).
  • len: length of str.
  • dest to store the header values in.

The function returns the following values:

  • ok success or failure.

func NewValueHash deprecated

func NewValueHash() map[string]coreglib.Value

NewValueHash creates a Table whose keys are strings and whose values are #GValue.

Deprecated: Use #GVariant API instead.

The function returns the following values:

  • hashTable: new empty Table.

func RequestErrorQuark

func RequestErrorQuark() glib.Quark

The function returns the following values:

func StatusGetPhrase

func StatusGetPhrase(statusCode uint) string

StatusGetPhrase looks up the stock HTTP description of status_code. This is used by soup_message_set_status() to get the correct text to go with a given status code.

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

The function takes the following parameters:

  • statusCode: HTTP status code.

The function returns the following values:

  • utf8: (terse, English) description of status_code.

func StatusProxify

func StatusProxify(statusCode uint) uint

StatusProxify turns SOUP_STATUS_CANT_RESOLVE into SOUP_STATUS_CANT_RESOLVE_PROXY and SOUP_STATUS_CANT_CONNECT into SOUP_STATUS_CANT_CONNECT_PROXY. Other status codes are passed through unchanged.

The function takes the following parameters:

  • statusCode status code.

The function returns the following values:

  • guint: "proxified" equivalent of status_code.

func StrCaseEqual

func StrCaseEqual(v1, v2 unsafe.Pointer) bool

StrCaseEqual compares v1 and v2 in a case-insensitive manner.

The function takes the following parameters:

  • v1 (optional): ASCII string.
  • v2 (optional): another ASCII string.

The function returns the following values:

  • ok: TRUE if they are equal (modulo case).

func StrCaseHash

func StrCaseHash(key unsafe.Pointer) uint

StrCaseHash hashes key in a case-insensitive manner.

The function takes the following parameters:

  • key (optional): ASCII string to hash.

The function returns the following values:

  • guint: hash code.

func TLDErrorQuark

func TLDErrorQuark() glib.Quark

The function returns the following values:

func TldDomainIsPublicSuffix

func TldDomainIsPublicSuffix(domain string) bool

TldDomainIsPublicSuffix 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.

The function takes the following parameters:

  • domain name.

The function returns the following values:

  • ok: TRUE if it is a public domain, FALSE otherwise.

func TldGetBaseDomain

func TldGetBaseDomain(hostname string) (string, error)

TldGetBaseDomain 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).

The function takes the following parameters:

  • hostname: hostname.

The function returns the following values:

  • utf8: pointer to the start of the base domain in hostname. If an error occurs, NULL will be returned and error set.

func URIDecode

func URIDecode(part string) string

URIDecode: fully %<!-- -->-decodes part.

In the past, this would return NULL if part contained invalid percent-encoding, but now it just ignores the problem (as soup_uri_new() already did).

The function takes the following parameters:

  • part: URI part.

The function returns the following values:

  • utf8: decoded URI part.

func URIEncode

func URIEncode(part, escapeExtra string) string

URIEncode: this %<!-- -->-encodes the given URI part and returns the escaped version in allocated memory, which the caller must free when it is done.

The function takes the following parameters:

  • part: URI part.
  • escapeExtra (optional): additional reserved characters to escape (or NULL).

The function returns the following values:

  • utf8: encoded URI part.

func URINormalize

func URINormalize(part, unescapeExtra string) string

URINormalize: %<!-- -->-decodes any "unreserved" characters (or characters in unescape_extra) in part, and %<!-- -->-encodes any non-ASCII characters, spaces, and non-printing characters in part.

"Unreserved" characters are those that are not allowed to be used for punctuation according to the URI spec. For example, letters are unreserved, so soup_uri_normalize() will turn <literal>http://example.com/foo/b%<!-- -->61r</literal> into <literal>http://example.com/foo/bar</literal>, which is guaranteed to mean the same thing. However, "/" is "reserved", so <literal>http://example.com/foo%<!-- -->2Fbar</literal> would not be changed, because it might mean something different to the server.

In the past, this would return NULL if part contained invalid percent-encoding, but now it just ignores the problem (as soup_uri_new() already did).

The function takes the following parameters:

  • part: URI part.
  • unescapeExtra (optional): reserved characters to unescape (or NULL).

The function returns the following values:

  • utf8: normalized URI part.

func ValueHashInsertValue deprecated

func ValueHashInsertValue(hash map[string]coreglib.Value, key string, value *coreglib.Value)

ValueHashInsertValue inserts value into hash. (Unlike with g_hash_table_insert(), both the key and the value are copied).

Deprecated: Use #GVariant API instead.

The function takes the following parameters:

  • hash: value hash.
  • key: key.
  • value: value.

func WebsocketClientPrepareHandshake

func WebsocketClientPrepareHandshake(msg *Message, origin string, protocols []string)

WebsocketClientPrepareHandshake adds the necessary headers to msg to request a WebSocket handshake. The message body and non-WebSocket-related headers are not modified.

Use soup_websocket_client_prepare_handshake_with_extensions() if you want to include "Sec-WebSocket-Extensions" header in the request.

This is a low-level function; if you use soup_session_websocket_connect_async() to create a WebSocket connection, it will call this for you.

The function takes the following parameters:

  • msg: Message.
  • origin (optional): "Origin" header to set.
  • protocols (optional): list of protocols to offer.

func WebsocketClientVerifyHandshake

func WebsocketClientVerifyHandshake(msg *Message) error

WebsocketClientVerifyHandshake 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 the response contains the "Sec-WebSocket-Extensions" header, the handshake will be considered invalid. You need to use soup_websocket_client_verify_handshake_with_extensions() to handle responses with extensions.

This is a low-level function; if you use soup_session_websocket_connect_async() to create a WebSocket connection, it will call this for you.

The function takes the following parameters:

  • msg containing both client and server sides of a WebSocket handshake.

func WebsocketErrorGetQuark

func WebsocketErrorGetQuark() glib.Quark

The function returns the following values:

func WebsocketServerCheckHandshake

func WebsocketServerCheckHandshake(msg *Message, origin string, protocols []string) error

WebsocketServerCheckHandshake 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.

Requests containing "Sec-WebSocket-Extensions" header will be accepted even if the header is not valid. To check a request with extensions you need to use soup_websocket_server_check_handshake_with_extensions() and provide the list of supported extension types.

Normally soup_websocket_server_process_handshake() will take care of this for you, and if you use soup_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.

The function takes the following parameters:

  • msg containing the client side of a WebSocket handshake.
  • origin (optional): expected Origin header.
  • protocols (optional): allowed WebSocket protocols.

func WebsocketServerProcessHandshake

func WebsocketServerProcessHandshake(msg *Message, expectedOrigin string, protocols []string) bool

WebsocketServerProcessHandshake 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.

Requests containing "Sec-WebSocket-Extensions" header will be accepted even if the header is not valid. To process a request with extensions you need to use soup_websocket_server_process_handshake_with_extensions() and provide the list of supported extension types.

This is a low-level function; if you use soup_server_add_websocket_handler() to handle accepting WebSocket connections, it will call this for you.

The function takes the following parameters:

  • msg containing the client side of a WebSocket handshake.
  • expectedOrigin (optional): expected Origin header.
  • protocols (optional): allowed WebSocket protocols.

The function returns the following values:

  • ok: TRUE if msg contained a valid WebSocket handshake request and was updated to contain a handshake response. FALSE if not.

func XMLRPCErrorQuark

func XMLRPCErrorQuark() glib.Quark

The function returns the following values:

func XMLRPCFaultQuark

func XMLRPCFaultQuark() glib.Quark

The function returns the following values:

func XmlrpcBuildMethodCall deprecated

func XmlrpcBuildMethodCall(methodName string, params []coreglib.Value) string

XmlrpcBuildMethodCall: this creates an XML-RPC methodCall and returns it as a string. This is the low-level method that soup_xmlrpc_request_new() is built on.

params is an array of #GValue representing the parameters to method. (It is *not* a Array, although if you have a Array, you can just pass its <literal>values</literal>f and <literal>n_values</literal> fields.)

The correspondence between glib types and XML-RPC types is:

int: #int (G_TYPE_INT)
boolean: #gboolean (G_TYPE_BOOLEAN)
string: #char* (G_TYPE_STRING)
double: #double (G_TYPE_DOUBLE)
datetime.iso8601: Date (SOUP_TYPE_DATE)
base64: Array (SOUP_TYPE_BYTE_ARRAY)
struct: Table (G_TYPE_HASH_TABLE)
array: Array (G_TYPE_VALUE_ARRAY)

For structs, use a Table that maps strings to #GValue; soup_value_hash_new() and related methods can help with this.

Deprecated: Use soup_xmlrpc_build_request() instead.

The function takes the following parameters:

  • methodName: name of the XML-RPC method.
  • params arguments to method.

The function returns the following values:

  • utf8 (optional): text of the methodCall, or NULL on error.

func XmlrpcBuildMethodResponse deprecated

func XmlrpcBuildMethodResponse(value *coreglib.Value) string

XmlrpcBuildMethodResponse: this creates a (successful) XML-RPC methodResponse and returns it as a string. To create a fault response, use soup_xmlrpc_build_fault().

The glib type to XML-RPC type mapping is as with soup_xmlrpc_build_method_call(), qv.

Deprecated: Use soup_xmlrpc_build_response() instead.

The function takes the following parameters:

  • value: return value.

The function returns the following values:

  • utf8 (optional): text of the methodResponse, or NULL on error.

func XmlrpcBuildRequest

func XmlrpcBuildRequest(methodName string, params *glib.Variant) (string, error)

XmlrpcBuildRequest: this creates an XML-RPC methodCall and returns it as a string. This is the low-level method that soup_xmlrpc_message_new() is built on.

params is a #GVariant tuple representing the method parameters.

Serialization details: - "a{s*}" and "{s*}" are serialized as &lt;struct&gt; - "ay" is serialized as &lt;base64&gt; - Other arrays and tuples are serialized as &lt;array&gt; - booleans are serialized as &lt;boolean&gt; - byte, int16, uint16 and int32 are serialized as &lt;int&gt; - uint32 and int64 are serialized as the nonstandard &lt;i8&gt; type - doubles are serialized as &lt;double&gt; - Strings are serialized as &lt;string&gt; - Variants (i.e. "v" type) are unwrapped and their child is serialized. - #GVariants created by soup_xmlrpc_variant_new_datetime() are serialized as &lt;dateTime.iso8601&gt; - Other types are not supported and will return NULL and set error. This notably includes: object-paths, signatures, uint64, handles, maybes and dictionaries with non-string keys.

If params is floating, it is consumed.

The function takes the following parameters:

  • methodName: name of the XML-RPC method.
  • params: #GVariant tuple.

The function returns the following values:

  • utf8: text of the methodCall, or NULL on error.

func XmlrpcBuildResponse

func XmlrpcBuildResponse(value *glib.Variant) (string, error)

XmlrpcBuildResponse: this creates a (successful) XML-RPC methodResponse and returns it as a string. To create a fault response, use soup_xmlrpc_build_fault(). This is the low-level method that soup_xmlrpc_message_set_response() is built on.

See soup_xmlrpc_build_request() for serialization details, but note that since a method can only have a single return value, value should not be a tuple here (unless the return value is an array).

If value is floating, it is consumed.

The function takes the following parameters:

  • value: return value.

The function returns the following values:

  • utf8: text of the methodResponse, or NULL on error.

func XmlrpcMessageSetResponse

func XmlrpcMessageSetResponse(msg *Message, value *glib.Variant) error

XmlrpcMessageSetResponse sets the status code and response body of msg to indicate a successful XML-RPC call, with a return value given by value. To set a fault response, use soup_xmlrpc_message_set_fault().

See soup_xmlrpc_build_request() for serialization details.

If value is floating, it is consumed.

The function takes the following parameters:

  • msg: XML-RPC request.
  • value: #GVariant.

func XmlrpcParseMethodResponse deprecated

func XmlrpcParseMethodResponse(methodResponse string, length int) (coreglib.Value, error)

XmlrpcParseMethodResponse parses method_response and returns the return value in value. If method_response is a fault, value will be unchanged, and error will be set to an error of type SOUP_XMLRPC_FAULT, with the error #code containing the fault code, and the error #message containing the fault string. (If method_response cannot be parsed at all, soup_xmlrpc_parse_method_response() will return FALSE, but error will be unset.)

Deprecated: Use soup_xmlrpc_parse_response() instead.

The function takes the following parameters:

  • methodResponse: XML-RPC methodResponse string.
  • length of method_response, or -1 if it is NUL-terminated.

The function returns the following values:

  • value: on return, the return value from method_call.

func XmlrpcParseResponse

func XmlrpcParseResponse(methodResponse string, length int, signature string) (*glib.Variant, error)

XmlrpcParseResponse parses method_response and returns the return value. If method_response is a fault, NULL is returned, and error will be set to an error in the SOUP_XMLRPC_FAULT domain, with the error code containing the fault code, and the error message containing the fault string. If method_response cannot be parsed, NULL is returned, and error will be set to an error in the SOUP_XMLRPC_ERROR domain.

See soup_xmlrpc_params_parse() for deserialization details.

The function takes the following parameters:

  • methodResponse: XML-RPC methodResponse string.
  • length of method_response, or -1 if it is NUL-terminated.
  • signature (optional): valid #GVariant type string, or NULL.

The function returns the following values:

  • variant: new (non-floating) #GVariant, or NULL.

func XmlrpcVariantNewDatetime

func XmlrpcVariantNewDatetime(date *Date) *glib.Variant

XmlrpcVariantNewDatetime: construct a special #GVariant used to serialize a &lt;dateTime.iso8601&gt; node. See soup_xmlrpc_build_request().

The actual type of the returned #GVariant is unspecified and "v" or "*" should be used in variant format strings. For example: <informalexample><programlisting> args = g_variant_new ("(v)", soup_xmlrpc_variant_new_datetime (date)); </programlisting></informalexample>.

The function takes the following parameters:

  • date: Date.

The function returns the following values:

  • variant: floating #GVariant.

Types

type Address

type Address struct {
	*coreglib.Object

	gio.SocketConnectable
	// contains filtered or unexported fields
}

func NewAddress

func NewAddress(name string, port uint) *Address

NewAddress creates a Address from name and port. The Address's IP address may not be available right away; the caller can call soup_address_resolve_async() or soup_address_resolve_sync() to force a DNS resolution.

The function takes the following parameters:

  • name or physical address.
  • port number.

The function returns the following values:

  • address: Address.

func NewAddressAny

func NewAddressAny(family AddressFamily, port uint) *Address

NewAddressAny returns a Address corresponding to the "any" address for family (or NULL if family isn't supported), suitable for using as a listening Socket.

The function takes the following parameters:

  • family address family.
  • port number (usually SOUP_ADDRESS_ANY_PORT).

The function returns the following values:

  • address (optional): new Address.

func (*Address) EqualByIP

func (addr1 *Address) EqualByIP(addr2 *Address) bool

EqualByIP tests if addr1 and addr2 have the same IP address. This method can be used with soup_address_hash_by_ip() to create a Table that hashes on IP address.

This would be used to distinguish hosts in situations where different virtual hosts on the same IP address should be considered the same. Eg, if "www.example.com" and "www.example.net" have the same IP address, then a single connection can be used to talk to either of them.

See also soup_address_equal_by_name(), which compares by name rather than by IP address.

The function takes the following parameters:

  • addr2: another Address with a resolved IP address.

The function returns the following values:

  • ok: whether or not addr1 and addr2 have the same IP address.

func (*Address) EqualByName

func (addr1 *Address) EqualByName(addr2 *Address) bool

EqualByName tests if addr1 and addr2 have the same "name". This method can be used with soup_address_hash_by_name() to create a Table that hashes on address "names".

Comparing by name normally means comparing the addresses by their hostnames. But if the address was originally created using an IP address literal, then it will be compared by that instead.

In particular, if "www.example.com" has the IP address 10.0.0.1, and addr1 was created with the name "www.example.com" and addr2 was created with the name "10.0.0.1", then they will compare as unequal for purposes of soup_address_equal_by_name().

This would be used to distinguish hosts in situations where different virtual hosts on the same IP address should be considered different. Eg, for purposes of HTTP authentication or cookies, two hosts with the same IP address but different names are considered to be different hosts.

See also soup_address_equal_by_ip(), which compares by IP address rather than by name.

The function takes the following parameters:

  • addr2: another Address with a resolved name.

The function returns the following values:

  • ok: whether or not addr1 and addr2 have the same name.

func (*Address) Gsockaddr

func (addr *Address) Gsockaddr() gio.SocketAddresser

Gsockaddr creates a new Address corresponding to addr (which is assumed to only have one socket address associated with it).

The function returns the following values:

  • socketAddress: new Address.

func (*Address) HashByIP

func (addr *Address) HashByIP() uint

HashByIP: hash function (for Table) that corresponds to soup_address_equal_by_ip(), qv.

The function returns the following values:

  • guint: IP-based hash value for addr.

func (*Address) HashByName

func (addr *Address) HashByName() uint

HashByName: hash function (for Table) that corresponds to soup_address_equal_by_name(), qv.

The function returns the following values:

  • guint: named-based hash value for addr.

func (*Address) IsResolved

func (addr *Address) IsResolved() bool

IsResolved tests if addr has already been resolved. Unlike the other Address "get" methods, this is safe to call when addr might be being resolved in another thread.

The function returns the following values:

  • ok: TRUE if addr has been resolved.

func (*Address) Name

func (addr *Address) Name() string

Name returns the hostname associated with addr.

This method is not thread-safe; if you call it while addr is being resolved in another thread, it may return garbage. You can use soup_address_is_resolved() to safely test whether or not an address is resolved before fetching its name or address.

The function returns the following values:

  • utf8 (optional): hostname, or NULL if it is not known.

func (*Address) Physical

func (addr *Address) Physical() string

Physical returns the physical address associated with addr as a string. (Eg, "127.0.0.1"). If the address is not yet known, returns NULL.

This method is not thread-safe; if you call it while addr is being resolved in another thread, it may return garbage. You can use soup_address_is_resolved() to safely test whether or not an address is resolved before fetching its name or address.

The function returns the following values:

  • utf8 (optional): physical address, or NULL.

func (*Address) Port

func (addr *Address) Port() uint

Port returns the port associated with addr.

The function returns the following values:

  • guint: port.

func (*Address) ResolveAsync

func (addr *Address) ResolveAsync(ctx context.Context, asyncContext *glib.MainContext, callback AddressCallback)

ResolveAsync: asynchronously resolves the missing half of addr (its IP address if it was created with soup_address_new(), or its hostname if it was created with soup_address_new_from_sockaddr() or soup_address_new_any().)

If cancellable is non-NULL, it can be used to cancel the resolution. callback will still be invoked in this case, with a status of SOUP_STATUS_CANCELLED.

It is safe to call this more than once on a given address, from the same thread, with the same async_context (and doing so will not result in redundant DNS queries being made). But it is not safe to call from multiple threads, or with different async_contexts, or mixed with calls to soup_address_resolve_sync().

The function takes the following parameters:

  • ctx (optional) object, or NULL.
  • asyncContext (optional) to call callback from.
  • callback to call with the result.

func (*Address) ResolveSync

func (addr *Address) ResolveSync(ctx context.Context) uint

ResolveSync: synchronously resolves the missing half of addr, as with soup_address_resolve_async().

If cancellable is non-NULL, it can be used to cancel the resolution. soup_address_resolve_sync() will then return a status of SOUP_STATUS_CANCELLED.

It is safe to call this more than once, even from different threads, but it is not safe to mix calls to soup_address_resolve_sync() with calls to soup_address_resolve_async() on the same address.

The function takes the following parameters:

  • ctx (optional) object, or NULL.

The function returns the following values:

  • guint: SOUP_STATUS_OK, SOUP_STATUS_CANT_RESOLVE, or SOUP_STATUS_CANCELLED.

type AddressCallback

type AddressCallback func(addr *Address, status uint)

AddressCallback: callback function passed to soup_address_resolve_async().

type AddressClass

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

AddressClass: instance of this type is always passed by reference.

type AddressFamily

type AddressFamily C.gint

AddressFamily: supported address families.

const (
	// AddressFamilyInvalid: invalid SoupAddress.
	AddressFamilyInvalid AddressFamily = -1
	// AddressFamilyIPv4: IPv4 address.
	AddressFamilyIPv4 AddressFamily = 2
	// AddressFamilyIPv6: IPv6 address.
	AddressFamilyIPv6 AddressFamily = 10
)

func (AddressFamily) String

func (a AddressFamily) String() string

String returns the name in string for AddressFamily.

type AddressOverrides

type AddressOverrides struct {
}

AddressOverrides contains methods that are overridable.

type Auth

type Auth struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

Auth: 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.

func BaseAuth

func BaseAuth(obj Auther) *Auth

BaseAuth returns the underlying base object.

func NewAuth

func NewAuth(typ coreglib.Type, msg *Message, authHeader string) *Auth

NewAuth creates a new Auth of type type with the information from msg and auth_header.

This is called by Session; you will normally not create auths yourself.

The function takes the following parameters:

  • typ: type of auth to create (a subtype of Auth).
  • msg the auth is being created for.
  • authHeader: WWW-Authenticate/Proxy-Authenticate header.

The function returns the following values:

  • auth (optional): new Auth, or NULL if it could not be created.

func (*Auth) Authenticate

func (auth *Auth) Authenticate(username, password string)

Authenticate: call this on an auth to authenticate it; normally this will cause the auth's message to be requeued with the new authentication info.

The function takes the following parameters:

  • username provided by the user or client.
  • password provided by the user or client.

func (*Auth) Authorization

func (auth *Auth) Authorization(msg *Message) string

Authorization generates an appropriate "Authorization" header for msg. (The session will only call this if soup_auth_is_authenticated() returned TRUE.).

The function takes the following parameters:

  • msg to be authorized.

The function returns the following values:

  • utf8: "Authorization" header, which must be freed.

func (*Auth) CanAuthenticate

func (auth *Auth) CanAuthenticate() bool

CanAuthenticate tests if auth is able to authenticate by providing credentials to the soup_auth_authenticate().

The function returns the following values:

  • ok: TRUE if auth is able to accept credentials.

func (*Auth) HasSavedPassword

func (auth *Auth) HasSavedPassword(username, password string)

The function takes the following parameters:

  • username
  • password

func (*Auth) Host

func (auth *Auth) Host() string

Host returns the host that auth is associated with.

The function returns the following values:

  • utf8: hostname.

func (*Auth) Info

func (auth *Auth) Info() string

Info gets an opaque identifier for auth, for use as a hash key or the like. Auth objects from the same server with the same identifier refer to the same authentication domain (eg, the URLs associated with them take the same usernames and passwords).

The function returns the following values:

  • utf8: identifier.

func (*Auth) IsAuthenticated

func (auth *Auth) IsAuthenticated() bool

IsAuthenticated tests if auth has been given a username and password.

The function returns the following values:

  • ok: TRUE if auth has been given a username and password.

func (*Auth) IsForProxy

func (auth *Auth) IsForProxy() bool

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

The function returns the following values:

  • ok: TRUE or FALSE.

func (*Auth) IsReady

func (auth *Auth) IsReady(msg *Message) bool

IsReady tests if auth is ready to make a request for msg with. For most auths, this is equivalent to soup_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.

The function takes the following parameters:

  • msg: Message.

The function returns the following values:

  • ok: TRUE if auth is ready to make a request with.

func (*Auth) ProtectionSpace

func (auth *Auth) ProtectionSpace(sourceUri *URI) []string

ProtectionSpace returns a list of paths on the server which auth extends over. (All subdirectories of these paths are also assumed to be part of auth's protection space, unless otherwise discovered not to be.).

The function takes the following parameters:

  • sourceUri: URI of the request that auth was generated in response to.

The function returns the following values:

  • sList: list of paths, which can be freed with soup_auth_free_protection_space().

func (*Auth) Realm

func (auth *Auth) Realm() string

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

The function returns the following values:

  • utf8: realm name.

func (*Auth) SavePassword

func (auth *Auth) SavePassword(username, password string)

The function takes the following parameters:

  • username
  • password

func (*Auth) SavedPassword

func (auth *Auth) SavedPassword(user string) string

The function takes the following parameters:

The function returns the following values:

func (*Auth) SavedUsers

func (auth *Auth) SavedUsers() []string

The function returns the following values:

func (*Auth) SchemeName

func (auth *Auth) SchemeName() string

SchemeName returns auth's scheme name. (Eg, "Basic", "Digest", or "NTLM").

The function returns the following values:

  • utf8: scheme name.

func (*Auth) Update

func (auth *Auth) Update(msg *Message, authHeader string) bool

Update updates auth with the information from msg and auth_header, possibly un-authenticating it. As with soup_auth_new(), this is normally only used by Session.

The function takes the following parameters:

  • msg auth is being updated for.
  • authHeader: WWW-Authenticate/Proxy-Authenticate header.

The function returns the following values:

  • ok: TRUE if auth is still a valid (but potentially unauthenticated) Auth. FALSE if something about auth_params could not be parsed or incorporated into auth at all.

type AuthBasic

type AuthBasic struct {
	Auth
	// contains filtered or unexported fields
}

type AuthClass

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

AuthClass: instance of this type is always passed by reference.

func (*AuthClass) SchemeName

func (a *AuthClass) SchemeName() string

func (*AuthClass) Strength

func (a *AuthClass) Strength() uint

type AuthDigest

type AuthDigest struct {
	Auth
	// contains filtered or unexported fields
}

type AuthDomain

type AuthDomain struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func BaseAuthDomain

func BaseAuthDomain(obj AuthDomainer) *AuthDomain

BaseAuthDomain returns the underlying base object.

func (*AuthDomain) Accepts

func (domain *AuthDomain) Accepts(msg *Message) string

Accepts checks if msg contains appropriate authorization for domain to accept it. Mirroring soup_auth_domain_covers(), this does not check whether or not domain <emphasis>cares</emphasis> if msg is authorized.

This is used by Server internally and is probably of no use to anyone else.

The function takes the following parameters:

  • msg: Message.

The function returns the following values:

  • utf8 (optional): username that msg has authenticated as, if in fact it has authenticated. NULL otherwise.

func (*AuthDomain) AddPath

func (domain *AuthDomain) AddPath(path string)

AddPath adds path to domain, such that requests under path on domain's server will require authentication (unless overridden by soup_auth_domain_remove_path() or soup_auth_domain_set_filter()).

You can also add paths by setting the SOUP_AUTH_DOMAIN_ADD_PATH property, which can also be used to add one or more paths at construct time.

The function takes the following parameters:

  • path to add to domain.

func (*AuthDomain) Challenge

func (domain *AuthDomain) Challenge(msg *Message)

Challenge adds a "WWW-Authenticate" or "Proxy-Authenticate" header to msg, requesting that the client authenticate, and sets msg's status accordingly.

This is used by Server internally and is probably of no use to anyone else.

The function takes the following parameters:

  • msg: Message.

func (*AuthDomain) CheckPassword

func (domain *AuthDomain) CheckPassword(msg *Message, username, password string) bool

CheckPassword checks if msg authenticates to domain via username and password. This would normally be called from a AuthDomainGenericAuthCallback.

The function takes the following parameters:

  • msg: Message.
  • username: username.
  • password: password.

The function returns the following values:

  • ok: whether or not the message is authenticated.

func (*AuthDomain) Covers

func (domain *AuthDomain) Covers(msg *Message) bool

Covers checks if domain requires msg to be authenticated (according to its paths and filter function). This does not actually look at whether msg <emphasis>is</emphasis> authenticated, merely whether or not it needs to be.

This is used by Server internally and is probably of no use to anyone else.

The function takes the following parameters:

  • msg: Message.

The function returns the following values:

  • ok: TRUE if domain requires msg to be authenticated.

func (*AuthDomain) Realm

func (domain *AuthDomain) Realm() string

Realm gets the realm name associated with domain.

The function returns the following values:

  • utf8 domain's realm.

func (*AuthDomain) RemovePath

func (domain *AuthDomain) RemovePath(path string)

RemovePath removes path from domain, such that requests under path on domain's server will NOT require authentication.

This is not simply an undo-er for soup_auth_domain_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 soup_auth_domain_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.

You can also remove paths by setting the SOUP_AUTH_DOMAIN_REMOVE_PATH property, which can also be used to remove one or more paths at construct time.

The function takes the following parameters:

  • path to remove from domain.

func (*AuthDomain) SetFilter

func (domain *AuthDomain) SetFilter(filter AuthDomainFilter)

SetFilter 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 SOUP_AUTH_DOMAIN_FILTER and SOUP_AUTH_DOMAIN_FILTER_DATA properties, which can also be used to set the filter at construct time.

The function takes the following parameters:

  • filter: auth filter for domain.

func (*AuthDomain) SetGenericAuthCallback

func (domain *AuthDomain) SetGenericAuthCallback(authCallback AuthDomainGenericAuthCallback)

SetGenericAuthCallback 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, AuthDomainDigestAuthCallback), the generic auth callback will be invoked. See AuthDomainGenericAuthCallback for information on what the callback should do.

The function takes the following parameters:

  • authCallback: auth callback.

func (*AuthDomain) TryGenericAuthCallback

func (domain *AuthDomain) TryGenericAuthCallback(msg *Message, username string) bool

The function takes the following parameters:

  • msg
  • username

The function returns the following values:

type AuthDomainBasic

type AuthDomainBasic struct {
	AuthDomain
	// contains filtered or unexported fields
}

func (*AuthDomainBasic) SetAuthCallback

func (domain *AuthDomainBasic) SetAuthCallback(callback AuthDomainBasicAuthCallback)

SetAuthCallback 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 SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK and SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA properties, which can also be used to set the callback at construct time.

The function takes the following parameters:

  • callback: callback.

type AuthDomainBasicAuthCallback

type AuthDomainBasicAuthCallback func(domain *AuthDomainBasic, msg *Message, username, password string) (ok bool)

AuthDomainBasicAuthCallback: callback used by AuthDomainBasic 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 {
	// contains filtered or unexported fields
}

AuthDomainBasicClass: instance of this type is always passed by reference.

func (*AuthDomainBasicClass) ParentClass

func (a *AuthDomainBasicClass) ParentClass() *AuthDomainClass

type AuthDomainBasicOverrides

type AuthDomainBasicOverrides struct {
}

AuthDomainBasicOverrides contains methods that are overridable.

type AuthDomainClass

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

AuthDomainClass: instance of this type is always passed by reference.

type AuthDomainDigest

type AuthDomainDigest struct {
	AuthDomain
	// contains filtered or unexported fields
}

func (*AuthDomainDigest) SetAuthCallback

func (domain *AuthDomainDigest) SetAuthCallback(callback AuthDomainDigestAuthCallback)

SetAuthCallback 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 SOUP_AUTH_DOMAIN_DIGEST_AUTH_CALLBACK and SOUP_AUTH_DOMAIN_DIGEST_AUTH_DATA properties, which can also be used to set the callback at construct time.

The function takes the following parameters:

  • callback: callback.

type AuthDomainDigestAuthCallback

type AuthDomainDigestAuthCallback func(domain *AuthDomainDigest, msg *Message, username string) (utf8 string)

AuthDomainDigestAuthCallback: callback used by AuthDomainDigest for authentication purposes. The application should look up username in its password database, and return the corresponding encoded password (see soup_auth_domain_digest_encode_password()).

type AuthDomainDigestClass

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

AuthDomainDigestClass: instance of this type is always passed by reference.

func (*AuthDomainDigestClass) ParentClass

func (a *AuthDomainDigestClass) ParentClass() *AuthDomainClass

type AuthDomainDigestOverrides

type AuthDomainDigestOverrides struct {
}

AuthDomainDigestOverrides contains methods that are overridable.

type AuthDomainFilter

type AuthDomainFilter func(domain AuthDomainer, msg *Message) (ok bool)

AuthDomainFilter: prototype for a AuthDomain filter; see soup_auth_domain_set_filter() for details.

type AuthDomainGenericAuthCallback

type AuthDomainGenericAuthCallback func(domain AuthDomainer, msg *Message, username string) (ok bool)

AuthDomainGenericAuthCallback: prototype for a AuthDomain generic authentication callback.

The callback should look up the user's password, call soup_auth_domain_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, AuthDomainBasicAuthCallback and 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 Server is used, this is not really relevant, but it may still be worth considering.

type AuthDomainOverrides

type AuthDomainOverrides struct {
	// The function takes the following parameters:
	//
	//   - msg
	//   - header
	//
	// The function returns the following values:
	//
	Accepts func(msg *Message, header string) string
	// Challenge adds a "WWW-Authenticate" or "Proxy-Authenticate" header to
	// msg, requesting that the client authenticate, and sets msg's status
	// accordingly.
	//
	// This is used by Server internally and is probably of no use to anyone
	// else.
	//
	// The function takes the following parameters:
	//
	//   - msg: Message.
	//
	// The function returns the following values:
	//
	Challenge func(msg *Message) string
	// CheckPassword checks if msg authenticates to domain via
	// username and password. This would normally be called from a
	// AuthDomainGenericAuthCallback.
	//
	// The function takes the following parameters:
	//
	//   - msg: Message.
	//   - username: username.
	//   - password: password.
	//
	// The function returns the following values:
	//
	//   - ok: whether or not the message is authenticated.
	//
	CheckPassword func(msg *Message, username, password string) bool
}

AuthDomainOverrides contains methods that are overridable.

type AuthDomainer

type AuthDomainer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AuthDomainer describes types inherited from class AuthDomain.

To get the original type, the caller must assert this to an interface or another type.

type AuthManager

type AuthManager struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func (*AuthManager) ClearCachedCredentials

func (manager *AuthManager) ClearCachedCredentials()

ClearCachedCredentials: clear all credentials cached by manager.

func (*AuthManager) ConnectAuthenticate

func (manager *AuthManager) ConnectAuthenticate(f func(msg *Message, auth Auther, retrying bool)) coreglib.SignalHandle

ConnectAuthenticate is emitted when the manager requires the application to provide authentication credentials.

Session connects to this signal and emits its own Session::authenticate signal when it is emitted, so you shouldn't need to use this signal directly.

func (*AuthManager) UseAuth

func (manager *AuthManager) UseAuth(uri *URI, auth Auther)

UseAuth 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.).

The function takes the following parameters:

  • uri under which auth is to be used.
  • auth to use.

type AuthManagerClass

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

AuthManagerClass: instance of this type is always passed by reference.

type AuthManagerOverrides

type AuthManagerOverrides struct {
	// The function takes the following parameters:
	//
	//   - msg
	//   - auth
	//   - retrying
	//
	Authenticate func(msg *Message, auth Auther, retrying bool)
}

AuthManagerOverrides contains methods that are overridable.

type AuthNTLM

type AuthNTLM struct {
	Auth
	// contains filtered or unexported fields
}

type AuthNegotiate

type AuthNegotiate struct {
	Auth
	// contains filtered or unexported fields
}

type AuthOverrides

type AuthOverrides struct {
	// Authenticate: call this on an auth to authenticate it; normally this will
	// cause the auth's message to be requeued with the new authentication info.
	//
	// The function takes the following parameters:
	//
	//   - username provided by the user or client.
	//   - password provided by the user or client.
	//
	Authenticate func(username, password string)
	// CanAuthenticate tests if auth is able to authenticate by providing
	// credentials to the soup_auth_authenticate().
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if auth is able to accept credentials.
	//
	CanAuthenticate func() bool
	// Authorization generates an appropriate "Authorization" header for msg.
	// (The session will only call this if soup_auth_is_authenticated() returned
	// TRUE.).
	//
	// The function takes the following parameters:
	//
	//   - msg to be authorized.
	//
	// The function returns the following values:
	//
	//   - utf8: "Authorization" header, which must be freed.
	//
	Authorization func(msg *Message) string
	// ProtectionSpace returns a list of paths on the server which auth extends
	// over. (All subdirectories of these paths are also assumed to be part of
	// auth's protection space, unless otherwise discovered not to be.).
	//
	// The function takes the following parameters:
	//
	//   - sourceUri: URI of the request that auth was generated in response to.
	//
	// The function returns the following values:
	//
	//   - sList: list of paths, which can be freed with
	//     soup_auth_free_protection_space().
	//
	ProtectionSpace func(sourceUri *URI) []string
	// IsAuthenticated tests if auth has been given a username and password.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if auth has been given a username and password.
	//
	IsAuthenticated func() bool
	// IsReady tests if auth is ready to make a request for msg with. For most
	// auths, this is equivalent to soup_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.
	//
	// The function takes the following parameters:
	//
	//   - msg: Message.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if auth is ready to make a request with.
	//
	IsReady func(msg *Message) bool
	// Update updates auth with the information from msg and auth_header,
	// possibly un-authenticating it. As with soup_auth_new(), this is normally
	// only used by Session.
	//
	// The function takes the following parameters:
	//
	//   - msg auth is being updated for.
	//   - authHeader: WWW-Authenticate/Proxy-Authenticate header.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if auth is still a valid (but potentially unauthenticated)
	//     Auth. FALSE if something about auth_params could not be parsed or
	//     incorporated into auth at all.
	//
	Update func(msg *Message, authHeader map[unsafe.Pointer]unsafe.Pointer) bool
}

AuthOverrides contains methods that are overridable.

type Auther

type Auther interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

Auther describes types inherited from class Auth.

To get the original type, the caller must assert this to an interface or another type.

type Buffer

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

Buffer: data buffer, generally used to represent a chunk of a MessageBody.

data is a #char because that's generally convenient; in some situations you may need to cast it to #guchar or another type.

An instance of this type is always passed by reference.

func FormDecodeMultipart

func FormDecodeMultipart(msg *Message, fileControlName string) (filename, contentType string, file *Buffer, hashTable map[string]string)

FormDecodeMultipart decodes the "multipart/form-data" request in msg; 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 soup_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 soup_form_decode()) in the returned Table.

You may pass NULL for filename, content_type and/or file if you do not care about those fields. soup_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 g_free(), and the returned file data with soup_buffer_free().

If you have a form with more than one file upload control, you will need to decode it manually, using soup_multipart_new_from_message() and soup_multipart_get_part().

The function takes the following parameters:

  • msg containing a "multipart/form-data" request body.
  • fileControlName (optional): name of the HTML file upload control, or NULL.

The function returns the following values:

  • filename (optional): return location for the name of the uploaded file, or NULL.
  • contentType (optional): return location for the MIME type of the uploaded file, or NULL.
  • file (optional): return location for the uploaded file data, or NULL.
  • hashTable (optional): a hash table containing the name/value pairs (other than file_control_name) from msg, which you can free with g_hash_table_destroy(). On error, it will return NULL.

func NewBuffer

func NewBuffer(data []byte) *Buffer

NewBuffer constructs a struct Buffer.

func (*Buffer) AsBytes

func (buffer *Buffer) AsBytes() *glib.Bytes

AsBytes creates a #GBytes pointing to the same memory as buffer. The #GBytes will hold a reference on buffer to ensure that it is not freed while the #GBytes is still valid.

The function returns the following values:

  • bytes: new #GBytes which has the same content as the Buffer.

func (*Buffer) Copy

func (buffer *Buffer) Copy() *Buffer

Copy makes a copy of buffer. In reality, Buffer is a refcounted type, and calling soup_buffer_copy() will normally just increment the refcount on buffer and return it. However, if buffer was created with UP_MEMORY_TEMPORARY memory, then soup_buffer_copy() will actually return a copy of it, so that the data in the copy will remain valid after the temporary buffer is freed.

The function returns the following values:

  • ret: new (or newly-reffed) buffer.

func (*Buffer) Data

func (buffer *Buffer) Data() []byte

Data: this function exists for use by language bindings, because it's not currently possible to get the right effect by annotating the fields of Buffer.

The function returns the following values:

  • data: pointer to the buffer data is stored here.

func (*Buffer) Length

func (b *Buffer) Length() uint

Length: length of data.

func (*Buffer) NewSubbuffer

func (parent *Buffer) NewSubbuffer(offset uint, length uint) *Buffer

NewSubbuffer creates a new Buffer containing length bytes "copied" from parent starting at offset. (Normally this will not actually copy any data, but will instead simply reference the same data as parent does.).

The function takes the following parameters:

  • offset within parent to start at.
  • length: number of bytes to copy from parent.

The function returns the following values:

  • buffer: new Buffer.

func (*Buffer) Owner

func (buffer *Buffer) Owner() unsafe.Pointer

Owner gets the "owner" object for a buffer created with soup_buffer_new_with_owner().

The function returns the following values:

  • gpointer (optional): owner pointer.

func (*Buffer) SetLength

func (b *Buffer) SetLength(length uint)

Length: length of data.

type Cache

type Cache struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func NewCache

func NewCache(cacheDir string, cacheType CacheType) *Cache

NewCache creates a new Cache.

The function takes the following parameters:

  • cacheDir (optional): directory to store the cached data, or NULL to use the default one. Note that since the cache isn't safe to access for multiple processes at once, and the default directory isn't namespaced by process, clients are strongly discouraged from passing NULL.
  • cacheType of the cache.

The function returns the following values:

  • cache: new Cache.

func (*Cache) Clear

func (cache *Cache) Clear()

Clear will remove all entries in the cache plus all the cache files.

func (*Cache) Dump

func (cache *Cache) Dump()

Dump: synchronously writes the cache index out to disk. Contrast with soup_cache_flush(), which writes pending cache <emphasis>entries</emphasis> to disk.

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

func (*Cache) Flush

func (cache *Cache) Flush()

Flush: this function will force all pending writes in the cache to be committed to disk. For doing so it will iterate the Context associated with cache's session as long as needed.

Contrast with soup_cache_dump(), which writes out the cache index file.

func (*Cache) Load

func (cache *Cache) Load()

Load loads the contents of cache's index into memory.

func (*Cache) MaxSize

func (cache *Cache) MaxSize() uint

MaxSize gets the maximum size of the cache.

The function returns the following values:

  • guint: maximum size of the cache, in bytes.

func (*Cache) SetMaxSize

func (cache *Cache) SetMaxSize(maxSize uint)

SetMaxSize sets the maximum size of the cache.

The function takes the following parameters:

  • maxSize: maximum size of the cache, in bytes.

type CacheClass

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

CacheClass: instance of this type is always passed by reference.

type CacheOverrides

type CacheOverrides struct {
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Cacheability func(msg *Message) Cacheability
}

CacheOverrides contains methods that are overridable.

type CacheResponse

type CacheResponse C.gint
const (
	CacheResponseFresh CacheResponse = iota
	CacheResponseNeedsValidation
	CacheResponseStale
)

func (CacheResponse) String

func (c CacheResponse) String() string

String returns the name in string for CacheResponse.

type CacheType

type CacheType C.gint

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

const (
	// CacheSingleUser: single-user cache.
	CacheSingleUser CacheType = iota
	// CacheShared: shared cache.
	CacheShared
)

func (CacheType) String

func (c CacheType) String() string

String returns the name in string for CacheType.

type Cacheability

type Cacheability C.guint
const (
	CacheCacheable   Cacheability = 0b1
	CacheUncacheable Cacheability = 0b10
	CacheInvalidates Cacheability = 0b100
	CacheValidates   Cacheability = 0b1000
)

func (Cacheability) Has

func (c Cacheability) Has(other Cacheability) bool

Has returns true if c contains other.

func (Cacheability) String

func (c Cacheability) String() string

String returns the names in string for Cacheability.

type ChunkAllocator deprecated

type ChunkAllocator func(msg *Message, maxLen uint) (buffer *Buffer)

ChunkAllocator: prototype for a chunk allocation callback. This should allocate a new Buffer and return it for the I/O layer to read message body data off the network into.

If max_len is non-0, it indicates the maximum number of bytes that could be read, based on what is known about the message size. Note that this might be a very large number, and you should not simply try to allocate that many bytes blindly. If max_len is 0, that means that libsoup does not know how many bytes remain to be read, and the allocator should return a buffer of a size that it finds convenient.

If the allocator returns NULL, the message will be paused. It is up to the application to make sure that it gets unpaused when it becomes possible to allocate a new buffer.

Deprecated: Use Request if you want to read into your own buffers.

type ClientContext

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

ClientContext provides additional information about the client making a particular request. In particular, you can use soup_client_context_get_auth_domain() and soup_client_context_get_auth_user() to determine if HTTP authentication was used successfully.

soup_client_context_get_remote_address() and/or soup_client_context_get_host() can be used to get information for logging or debugging purposes. soup_client_context_get_gsocket() may also be of use in some situations (eg, tracking when multiple requests are made on the same connection).

An instance of this type is always passed by reference.

func (*ClientContext) Address deprecated

func (client *ClientContext) Address() *Address

Address retrieves the Address associated with the remote end of a connection.

Deprecated: Use soup_client_context_get_remote_address(), which returns a Address.

The function returns the following values:

  • address (optional) with the remote end of a connection, it may be NULL if you used soup_server_accept_iostream().

func (*ClientContext) AuthDomain

func (client *ClientContext) AuthDomain() AuthDomainer

AuthDomain checks whether the request associated with client has been authenticated, and if so returns the AuthDomain that authenticated it.

The function returns the following values:

  • authDomain (optional) or NULL if the request was not authenticated.

func (*ClientContext) AuthUser

func (client *ClientContext) AuthUser() string

AuthUser checks whether the request associated with client has been authenticated, and if so returns the username that the client authenticated as.

The function returns the following values:

  • utf8 (optional) authenticated-as user, or NULL if the request was not authenticated.

func (*ClientContext) Gsocket

func (client *ClientContext) Gsocket() *gio.Socket

Gsocket retrieves the #GSocket that client is associated with.

If you are using this method to observe when multiple requests are made on the same persistent HTTP connection (eg, as the ntlm-test test program does), you will need to pay attention to socket destruction as well (eg, by using weak references), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket.

The function returns the following values:

  • socket (optional) that client is associated with, NULL if you used soup_server_accept_iostream().

func (*ClientContext) Host

func (client *ClientContext) Host() string

Host retrieves the IP address associated with the remote end of a connection.

The function returns the following values:

  • utf8 (optional): IP address associated with the remote end of a connection, it may be NULL if you used soup_server_accept_iostream().

func (*ClientContext) LocalAddress

func (client *ClientContext) LocalAddress() gio.SocketAddresser

LocalAddress retrieves the Address associated with the local end of a connection.

The function returns the following values:

  • socketAddress (optional) with the local end of a connection, it may be NULL if you used soup_server_accept_iostream().

func (*ClientContext) RemoteAddress

func (client *ClientContext) RemoteAddress() gio.SocketAddresser

RemoteAddress retrieves the Address associated with the remote end of a connection.

The function returns the following values:

  • socketAddress (optional) with the remote end of a connection, it may be NULL if you used soup_server_accept_iostream().

func (*ClientContext) Socket deprecated

func (client *ClientContext) Socket() *Socket

Socket retrieves the Socket that client 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 (either by using weak references, or by connecting to the Socket::disconnected signal), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket.

Deprecated: use soup_client_context_get_gsocket(), which returns a #GSocket.

The function returns the following values:

  • socket that client is associated with.

func (*ClientContext) StealConnection

func (client *ClientContext) StealConnection() gio.IOStreamer

StealConnection: "Steals" the HTTP connection associated with client from its Server. This happens immediately, regardless of the current state of the connection; if the response to the current Message has not yet finished being sent, then it will be discarded; you can steal the connection from a Message:wrote-informational or Message: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, client will most likely be freed as a side effect.

The function returns the following values:

  • ioStream formerly associated with client (or NULL if client was no longer associated with a connection). No guarantees are made about what kind of OStream is returned.

type ConnectionState

type ConnectionState C.gint
const (
	NewConnection ConnectionState = iota
	ConnectionConnecting
	ConnectionIdle
	ConnectionInUse
	ConnectionRemoteDisconnected
	ConnectionDisconnected
)

func (ConnectionState) String

func (c ConnectionState) String() string

String returns the name in string for ConnectionState.

type ContentDecoder

type ContentDecoder struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

type ContentDecoderClass

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

ContentDecoderClass: instance of this type is always passed by reference.

type ContentDecoderOverrides

type ContentDecoderOverrides struct {
}

ContentDecoderOverrides contains methods that are overridable.

type ContentSniffer

type ContentSniffer struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func NewContentSniffer

func NewContentSniffer() *ContentSniffer

NewContentSniffer creates a new ContentSniffer.

The function returns the following values:

  • contentSniffer: new ContentSniffer.

func (*ContentSniffer) BufferSize

func (sniffer *ContentSniffer) BufferSize() uint

BufferSize gets the number of bytes sniffer needs in order to properly sniff a buffer.

The function returns the following values:

  • gsize: number of bytes to sniff.

func (*ContentSniffer) Sniff

func (sniffer *ContentSniffer) Sniff(msg *Message, buffer *Buffer) (map[string]string, string)

Sniff sniffs buffer to determine its Content-Type. The result may also be influenced by the Content-Type declared in msg's response headers.

The function takes the following parameters:

  • msg: message to sniff.
  • buffer containing the start of msg's response body.

The function returns the following values:

  • params (optional): return location for Content-Type parameters (eg, "charset"), or NULL.
  • utf8: sniffed Content-Type of buffer; this will never be NULL, but may be "application/octet-stream".

type ContentSnifferClass

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

ContentSnifferClass: instance of this type is always passed by reference.

type ContentSnifferOverrides

type ContentSnifferOverrides struct {
	// BufferSize gets the number of bytes sniffer needs in order to properly
	// sniff a buffer.
	//
	// The function returns the following values:
	//
	//   - gsize: number of bytes to sniff.
	//
	BufferSize func() uint
	// Sniff sniffs buffer to determine its Content-Type. The result may also be
	// influenced by the Content-Type declared in msg's response headers.
	//
	// The function takes the following parameters:
	//
	//   - msg: message to sniff.
	//   - buffer containing the start of msg's response body.
	//
	// The function returns the following values:
	//
	//   - params (optional): return location for Content-Type parameters (eg,
	//     "charset"), or NULL.
	//   - utf8: sniffed Content-Type of buffer; this will never be NULL,
	//     but may be "application/octet-stream".
	//
	Sniff func(msg *Message, buffer *Buffer) (map[string]string, string)
}

ContentSnifferOverrides contains methods that are overridable.

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

Cookie: HTTP cookie.

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.

An instance of this type is always passed by reference.

func CookieParse

func CookieParse(header string, origin *URI) *Cookie

CookieParse parses header and returns a Cookie. (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 Cookie, and you will need to fill in some appropriate string for the domain if you want to actually make use of the cookie.

The function takes the following parameters:

  • header: cookie string (eg, the value of a Set-Cookie header).
  • origin of the cookie, or NULL.

The function returns the following values:

  • cookie (optional): new Cookie, or NULL if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from origin.

func CookiesFromRequest

func CookiesFromRequest(msg *Message) []*Cookie

CookiesFromRequest parses msg's Cookie request header and returns a List of Cookie<!-- -->s. As the "Cookie" header, unlike "Set-Cookie", only contains cookie names and values, none of the other Cookie fields will be filled in. (Thus, you can't generally pass a cookie returned from this method directly to soup_cookies_to_response().).

The function takes the following parameters:

  • msg containing a "Cookie" request header.

The function returns the following values:

  • sList Cookie<!-- -->s, which can be freed with soup_cookies_free().

func CookiesFromResponse

func CookiesFromResponse(msg *Message) []*Cookie

CookiesFromResponse parses msg's Set-Cookie response headers and returns a List of Cookie<!-- -->s. Cookies that do not specify "path" or "domain" attributes will have their values defaulted from msg.

The function takes the following parameters:

  • msg containing a "Set-Cookie" response header.

The function returns the following values:

  • sList Cookie<!-- -->s, which can be freed with soup_cookies_free().

func NewCookie

func NewCookie(name string, value string, domain string, path string, maxAge int) *Cookie

NewCookie constructs a struct Cookie.

func (*Cookie) AppliesToURI

func (cookie *Cookie) AppliesToURI(uri *URI) bool

AppliesToURI 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.).

The function takes the following parameters:

  • uri: URI.

The function returns the following values:

  • ok: TRUE if cookie should be sent to uri, FALSE if not.

func (*Cookie) Copy

func (cookie *Cookie) Copy() *Cookie

Copy copies cookie.

The function returns the following values:

  • ret: copy of cookie.

func (*Cookie) Domain

func (cookie *Cookie) Domain() string

Domain gets cookie's domain.

The function returns the following values:

  • utf8 cookie's domain.

func (*Cookie) DomainMatches

func (cookie *Cookie) DomainMatches(host string) bool

DomainMatches checks if the cookie's domain and host match in the sense that cookie should be sent when making a request to host, or that cookie should be accepted when receiving a response from host.

The function takes the following parameters:

  • host: URI.

The function returns the following values:

  • ok: TRUE if the domains match, FALSE otherwise.

func (*Cookie) Equal

func (cookie1 *Cookie) Equal(cookie2 *Cookie) bool

Equal 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.

The function takes the following parameters:

  • cookie2: Cookie.

The function returns the following values:

  • ok: whether the cookies are equal.

func (*Cookie) Expires

func (cookie *Cookie) Expires() *Date

Expires gets cookie's expiration time.

The function returns the following values:

  • date (optional) cookie's expiration time, which is owned by cookie and should not be modified or freed.

func (*Cookie) HTTPOnly

func (cookie *Cookie) HTTPOnly() bool

HTTPOnly gets cookie's HttpOnly attribute.

The function returns the following values:

  • ok cookie's HttpOnly attribute.

func (*Cookie) Name

func (cookie *Cookie) Name() string

Name gets cookie's name.

The function returns the following values:

  • utf8 cookie's name.

func (*Cookie) Path

func (cookie *Cookie) Path() string

Path gets cookie's path.

The function returns the following values:

  • utf8 cookie's path.

func (*Cookie) SameSitePolicy

func (cookie *Cookie) SameSitePolicy() SameSitePolicy

The function returns the following values:

  • sameSitePolicy: SameSitePolicy.

func (*Cookie) Secure

func (cookie *Cookie) Secure() bool

Secure gets cookie's secure attribute.

The function returns the following values:

  • ok cookie's secure attribute.

func (*Cookie) SetDomain

func (cookie *Cookie) SetDomain(domain string)

SetDomain sets cookie's domain to domain.

The function takes the following parameters:

  • domain: new domain.

func (*Cookie) SetExpires

func (cookie *Cookie) SetExpires(expires *Date)

SetExpires 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 soup_cookie_set_max_age().).

The function takes the following parameters:

  • expires: new expiration time, or NULL.

func (*Cookie) SetHTTPOnly

func (cookie *Cookie) SetHTTPOnly(httpOnly bool)

SetHTTPOnly 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.

The function takes the following parameters:

  • httpOnly: new value for the HttpOnly attribute.

func (*Cookie) SetMaxAge

func (cookie *Cookie) SetMaxAge(maxAge int)

SetMaxAge 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 soup_cookie_set_expires().).

The function takes the following parameters:

  • maxAge: new max age.

func (*Cookie) SetName

func (cookie *Cookie) SetName(name string)

SetName sets cookie's name to name.

The function takes the following parameters:

  • name: new name.

func (*Cookie) SetPath

func (cookie *Cookie) SetPath(path string)

SetPath sets cookie's path to path.

The function takes the following parameters:

  • path: new path.

func (*Cookie) SetSameSitePolicy

func (cookie *Cookie) SetSameSitePolicy(policy SameSitePolicy)

SetSameSitePolicy: when used in conjunction with soup_cookie_jar_get_cookie_list_with_same_site_info() this sets the policy of when this cookie should be exposed.

The function takes the following parameters:

  • policy: SameSitePolicy.

func (*Cookie) SetSecure

func (cookie *Cookie) SetSecure(secure bool)

SetSecure sets cookie's secure attribute to secure. If TRUE, cookie will only be transmitted from the client to the server over secure (https) connections.

The function takes the following parameters:

  • secure: new value for the secure attribute.

func (*Cookie) SetValue

func (cookie *Cookie) SetValue(value string)

SetValue sets cookie's value to value.

The function takes the following parameters:

  • value: new value.

func (*Cookie) ToCookieHeader

func (cookie *Cookie) ToCookieHeader() string

ToCookieHeader serializes cookie in the format used by the Cookie header (ie, for returning a cookie from a Session to a server).

The function returns the following values:

  • utf8: header.

func (*Cookie) ToSetCookieHeader

func (cookie *Cookie) ToSetCookieHeader() string

ToSetCookieHeader serializes cookie in the format used by the Set-Cookie header (ie, for sending a cookie from a Server to a client).

The function returns the following values:

  • utf8: header.

func (*Cookie) Value

func (cookie *Cookie) Value() string

Value gets cookie's value.

The function returns the following values:

  • utf8 cookie's value.

type CookieJar

type CookieJar struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func NewCookieJar

func NewCookieJar() *CookieJar

NewCookieJar creates a new CookieJar. The base CookieJar class does not support persistent storage of cookies; use a subclass for that.

The function returns the following values:

  • cookieJar: new CookieJar.

func (*CookieJar) AcceptPolicy

func (jar *CookieJar) AcceptPolicy() CookieJarAcceptPolicy

AcceptPolicy gets jar's CookieJarAcceptPolicy.

The function returns the following values:

  • cookieJarAcceptPolicy set in the jar.

func (*CookieJar) AddCookie

func (jar *CookieJar) AddCookie(cookie *Cookie)

AddCookie adds cookie to jar, emitting the '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.

The function takes the following parameters:

  • cookie: Cookie.

func (*CookieJar) AddCookieFull

func (jar *CookieJar) AddCookieFull(cookie *Cookie, uri, firstParty *URI)

AddCookieFull adds cookie to jar, emitting the '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.

The function takes the following parameters:

  • cookie: Cookie.
  • uri (optional): URI setting the cookie.
  • firstParty (optional): URI for the main document.

func (*CookieJar) AddCookieWithFirstParty

func (jar *CookieJar) AddCookieWithFirstParty(firstParty *URI, cookie *Cookie)

AddCookieWithFirstParty adds cookie to jar, emitting the '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 soup_cookie_jar_add_cookie_full().

The function takes the following parameters:

  • firstParty: URI for the main document.
  • cookie: Cookie.

func (*CookieJar) AllCookies

func (jar *CookieJar) AllCookies() []*Cookie

AllCookies constructs a 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.

The function returns the following values:

  • sList all the cookies in the jar.

func (*CookieJar) ConnectChanged

func (jar *CookieJar) ConnectChanged(f func(oldCookie, newCookie *Cookie)) coreglib.SignalHandle

ConnectChanged is 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) CookieList

func (jar *CookieJar) CookieList(uri *URI, forHttp bool) []*Cookie

CookieList retrieves the list of cookies that would be sent with a request to uri as a List of Cookie 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 CookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting for_http to FALSE if you are calling this.

The function takes the following parameters:

  • uri: URI.
  • forHttp: whether or not the return value is being passed directly to an HTTP operation.

The function returns the following values:

  • sList the cookies in the jar that would be sent with a request to uri.

func (*CookieJar) CookieListWithSameSiteInfo

func (jar *CookieJar) CookieListWithSameSiteInfo(uri, topLevel, siteForCookies *URI, forHttp, isSafeMethod, isTopLevelNavigation bool) []*Cookie

CookieListWithSameSiteInfo: this is an extended version of soup_cookie_jar_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.

The function takes the following parameters:

  • uri: URI.
  • topLevel (optional) for the top level document.
  • siteForCookies (optional) indicating the origin to get cookies for.
  • forHttp: whether or not the return value is being passed directly to an HTTP operation.
  • isSafeMethod: if the HTTP method is safe, as defined by RFC 7231, ignored when for_http is FALSE.
  • isTopLevelNavigation: whether or not the HTTP request is part of top level navigation.

The function returns the following values:

  • sList the cookies in the jar that would be sent with a request to uri.

func (*CookieJar) Cookies

func (jar *CookieJar) Cookies(uri *URI, forHttp bool) string

Cookies 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 CookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting for_http to FALSE if you are calling this.

The function takes the following parameters:

  • uri: URI.
  • forHttp: whether or not the return value is being passed directly to an HTTP operation.

The function returns the following values:

  • utf8 (optional): cookies, in string form, or NULL if there are no cookies for uri.

func (*CookieJar) DeleteCookie

func (jar *CookieJar) DeleteCookie(cookie *Cookie)

DeleteCookie deletes cookie from jar, emitting the 'changed' signal.

The function takes the following parameters:

  • cookie: Cookie.

func (*CookieJar) IsPersistent

func (jar *CookieJar) IsPersistent() bool

IsPersistent gets whether jar stores cookies persistenly.

The function returns the following values:

  • ok: TRUE if jar storage is persistent or FALSE otherwise.

func (*CookieJar) Save deprecated

func (jar *CookieJar) Save()

Save: this function exists for backward compatibility, but does not do anything any more; cookie jars are saved automatically when they are changed.

Deprecated: This is a no-op.

func (*CookieJar) SetAcceptPolicy

func (jar *CookieJar) SetAcceptPolicy(policy CookieJarAcceptPolicy)

SetAcceptPolicy sets policy as the cookie acceptance policy for jar.

The function takes the following parameters:

  • policy: CookieJarAcceptPolicy.

func (*CookieJar) SetCookie

func (jar *CookieJar) SetCookie(uri *URI, cookie string)

SetCookie 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 CookieJarAcceptPolicy set is either SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY or SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY you'll need to use soup_cookie_jar_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.

The function takes the following parameters:

  • uri: URI setting the cookie.
  • cookie: stringified cookie to set.

func (*CookieJar) SetCookieWithFirstParty

func (jar *CookieJar) SetCookieWithFirstParty(uri, firstParty *URI, cookie string)

SetCookieWithFirstParty 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.

The function takes the following parameters:

  • uri: URI setting the cookie.
  • firstParty: URI for the main document.
  • cookie: stringified cookie to set.

type CookieJarAcceptPolicy

type CookieJarAcceptPolicy C.gint

CookieJarAcceptPolicy: policy for accepting or rejecting cookies returned in responses.

const (
	// CookieJarAcceptAlways: accept all cookies unconditionally.
	CookieJarAcceptAlways CookieJarAcceptPolicy = iota
	// CookieJarAcceptNever: reject all cookies unconditionally.
	CookieJarAcceptNever
	// CookieJarAcceptNoThirdParty: 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
	// soup_message_set_first_party() on each outgoing Message, setting the
	// 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.
	CookieJarAcceptNoThirdParty
	// CookieJarAcceptGrandfatheredThirdParty: 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
	// soup_message_set_first_party() on each outgoing Message, setting the
	// 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. Since 2.72.
	CookieJarAcceptGrandfatheredThirdParty
)

func (CookieJarAcceptPolicy) String

func (c CookieJarAcceptPolicy) String() string

String returns the name in string for CookieJarAcceptPolicy.

type CookieJarClass

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

CookieJarClass: instance of this type is always passed by reference.

type CookieJarDB

type CookieJarDB struct {
	CookieJar
	// contains filtered or unexported fields
}

func NewCookieJarDB

func NewCookieJarDB(filename string, readOnly bool) *CookieJarDB

NewCookieJarDB creates a CookieJarDB.

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 'changed' signal is emitted from the jar. (If read_only is TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.).

The function takes the following parameters:

  • filename to read to/write from, or NULL.
  • readOnly: TRUE if filename is read-only.

The function returns the following values:

  • cookieJarDB: new CookieJar.

type CookieJarDBClass

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

CookieJarDBClass: instance of this type is always passed by reference.

func (*CookieJarDBClass) ParentClass

func (c *CookieJarDBClass) ParentClass() *CookieJarClass

type CookieJarDBOverrides

type CookieJarDBOverrides struct {
}

CookieJarDBOverrides contains methods that are overridable.

type CookieJarOverrides

type CookieJarOverrides struct {
	// The function takes the following parameters:
	//
	//   - oldCookie
	//   - newCookie
	//
	Changed func(oldCookie, newCookie *Cookie)
	// IsPersistent gets whether jar stores cookies persistenly.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if jar storage is persistent or FALSE otherwise.
	//
	IsPersistent func() bool
	// Save: this function exists for backward compatibility, but does not do
	// anything any more; cookie jars are saved automatically when they are
	// changed.
	//
	// Deprecated: This is a no-op.
	Save func()
}

CookieJarOverrides contains methods that are overridable.

type CookieJarText

type CookieJarText struct {
	CookieJar
	// contains filtered or unexported fields
}

func NewCookieJarText

func NewCookieJarText(filename string, readOnly bool) *CookieJarText

NewCookieJarText creates a CookieJarText.

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 'changed' signal is emitted from the jar. (If read_only is TRUE, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.).

The function takes the following parameters:

  • filename to read to/write from.
  • readOnly: TRUE if filename is read-only.

The function returns the following values:

  • cookieJarText: new CookieJar.

type CookieJarTextClass

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

CookieJarTextClass: instance of this type is always passed by reference.

func (*CookieJarTextClass) ParentClass

func (c *CookieJarTextClass) ParentClass() *CookieJarClass

type CookieJarTextOverrides

type CookieJarTextOverrides struct {
}

CookieJarTextOverrides contains methods that are overridable.

type Date

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

Date: date and time. The date is assumed to be in the (proleptic) Gregorian calendar. The time is in UTC if utc is TRUE. Otherwise, the time is a local time, and offset gives the offset from UTC in minutes (such that adding offset to the time would give the correct UTC time). If utc is FALSE and offset is 0, then the SoupDate represents a "floating" time with no associated timezone information.

An instance of this type is always passed by reference.

func NewDate

func NewDate(year int, month int, day int, hour int, minute int, second int) *Date

NewDate constructs a struct Date.

func NewDateFromNow

func NewDateFromNow(offsetSeconds int) *Date

NewDateFromNow constructs a struct Date.

func NewDateFromString

func NewDateFromString(dateString string) *Date

NewDateFromString constructs a struct Date.

func NewDateFromTimeT

func NewDateFromTimeT(when int32) *Date

NewDateFromTimeT constructs a struct Date.

func XmlrpcVariantGetDatetime

func XmlrpcVariantGetDatetime(variant *glib.Variant) (*Date, error)

XmlrpcVariantGetDatetime: get the Date from special #GVariant created by soup_xmlrpc_variant_new_datetime() or by parsing a &lt;dateTime.iso8601&gt; node. See soup_xmlrpc_params_parse().

If variant does not contain a datetime it will return an error but it is not considered a programmer error because it generally means parameters received are not in the expected type.

The function takes the following parameters:

  • variant: #GVariant.

The function returns the following values:

  • date: new Date, or NULL on error.

func (*Date) Copy

func (date *Date) Copy() *Date

Copy copies date.

The function returns the following values:

func (*Date) Day

func (date *Date) Day() int

Day gets date's day.

The function returns the following values:

  • gint date's day.

func (*Date) Hour

func (date *Date) Hour() int

Hour gets date's hour.

The function returns the following values:

  • gint date's hour.

func (*Date) IsPast

func (date *Date) IsPast() bool

IsPast determines if date is in the past.

The function returns the following values:

  • ok: TRUE if date is in the past.

func (*Date) Minute

func (date *Date) Minute() int

Minute gets date's minute.

The function returns the following values:

  • gint date's minute.

func (*Date) Month

func (date *Date) Month() int

Month gets date's month.

The function returns the following values:

  • gint date's month.

func (*Date) Offset

func (date *Date) Offset() int

Offset gets date's offset from UTC.

The function returns the following values:

  • gint date's offset from UTC. If soup_date_get_utc() returns FALSE but soup_date_get_offset() returns 0, that means the date is a "floating" time with no associated offset information.

func (*Date) Second

func (date *Date) Second() int

Second gets date's second.

The function returns the following values:

  • gint date's second.

func (*Date) String

func (date *Date) String(format DateFormat) string

String converts date to a string in the format described by format.

The function takes the following parameters:

  • format to generate the date in.

The function returns the following values:

  • utf8: date as a string.

func (*Date) ToTimeT

func (date *Date) ToTimeT() int32

ToTimeT converts date to a <type>time_t</type>, assumming it to be in UTC.

If date is not representable as a <type>time_t</type>, it will be clamped into range. (In particular, some HTTP cookies have expiration dates after "Y2.038k" (2038-01-19T03:14:07Z).).

The function returns the following values:

  • glong: date as a <type>time_t</type>.

func (*Date) ToTimeval deprecated

func (date *Date) ToTimeval() *glib.TimeVal

ToTimeval converts date to a Val.

Deprecated: Do not use Val, as it's not Y2038-safe.

The function returns the following values:

  • time structure in which to store the converted time.

func (*Date) UTC

func (date *Date) UTC() int

UTC gets date's UTC flag.

The function returns the following values:

  • gint: TRUE if date is UTC.

func (*Date) Year

func (date *Date) Year() int

Year gets date's year.

The function returns the following values:

  • gint date's year.

type DateFormat

type DateFormat C.gint

DateFormat: date formats that soup_date_to_string() can use.

SOUP_DATE_HTTP and SOUP_DATE_COOKIE always coerce the time to UTC. SOUP_DATE_ISO8601_XMLRPC uses the time as given, ignoring the offset completely. SOUP_DATE_RFC2822 and the other ISO 8601 variants use the local time, appending the offset information if available.

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

const (
	// DateHTTP: RFC 1123 format, used by the HTTP "Date" header. Eg "Sun,
	// 06 Nov 1994 08:49:37 GMT".
	DateHTTP DateFormat = 1
	// DateCookie: format for the "Expires" timestamp in the Netscape cookie
	// specification. Eg, "Sun, 06-Nov-1994 08:49:37 GMT".
	DateCookie DateFormat = 2
	// DateRfc2822: RFC 2822 format, eg "Sun, 6 Nov 1994 09:49:37 -0100".
	DateRfc2822 DateFormat = 3
	// DateISO8601Compact: ISO 8601 date/time with no optional punctuation. Eg,
	// "19941106T094937-0100".
	DateISO8601Compact DateFormat = 4
	// DateISO8601Full: ISO 8601 date/time with all optional punctuation. Eg,
	// "1994-11-06T09:49:37-01:00".
	DateISO8601Full DateFormat = 5
	// DateISO8601 alias for SOUP_DATE_ISO8601_FULL.
	DateISO8601 DateFormat = 5
	// DateISO8601Xmlrpc: ISO 8601 date/time as used by XML-RPC. Eg,
	// "19941106T09:49:37".
	DateISO8601Xmlrpc DateFormat = 6
)

func (DateFormat) String

func (d DateFormat) String() string

String returns the name in string for DateFormat.

type Encoding

type Encoding C.gint

Encoding: how a message body is encoded for transport.

const (
	// EncodingUnrecognized: unknown / error.
	EncodingUnrecognized Encoding = iota
	// EncodingNone: no body is present (which is not the same as a 0-length
	// body, and only occurs in certain places).
	EncodingNone
	// EncodingContentLength: content-Length encoding.
	EncodingContentLength
	// EncodingEOF: response body ends when the connection is closed.
	EncodingEOF
	// EncodingChunked: chunked encoding (currently only supported for
	// response).
	EncodingChunked
	// EncodingByteranges multipart/byteranges (Reserved for future use:
	// NOT CURRENTLY IMPLEMENTED).
	EncodingByteranges
)

func (Encoding) String

func (e Encoding) String() string

String returns the name in string for Encoding.

type Expectation

type Expectation C.guint

Expectation represents the parsed value of the "Expect" header.

const (
	// ExpectationUnrecognized: any unrecognized expectation.
	ExpectationUnrecognized Expectation = 0b1
	// ExpectationContinue: "100-continue".
	ExpectationContinue Expectation = 0b10
)

func (Expectation) Has

func (e Expectation) Has(other Expectation) bool

Has returns true if e contains other.

func (Expectation) String

func (e Expectation) String() string

String returns the names in string for Expectation.

type HSTSEnforcer

type HSTSEnforcer struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func NewHSTSEnforcer

func NewHSTSEnforcer() *HSTSEnforcer

NewHSTSEnforcer creates a new HSTSEnforcer. The base HSTSEnforcer class does not support persistent storage of HSTS policies, see HSTSEnforcerDB for that.

The function returns the following values:

  • hstsEnforcer: new HSTSEnforcer.

func (*HSTSEnforcer) ConnectChanged

func (hstsEnforcer *HSTSEnforcer) ConnectChanged(f func(oldPolicy, newPolicy *HSTSPolicy)) coreglib.SignalHandle

ConnectChanged is 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) ConnectHstsEnforced

func (hstsEnforcer *HSTSEnforcer) ConnectHstsEnforced(f func(message *Message)) coreglib.SignalHandle

ConnectHstsEnforced is emitted when hsts_enforcer has upgraded the protocol for message to HTTPS as a result of matching its domain with a HSTS policy.

func (*HSTSEnforcer) Domains

func (hstsEnforcer *HSTSEnforcer) Domains(sessionPolicies bool) []string

Domains gets a list of domains for which there are policies in enforcer.

The function takes the following parameters:

  • sessionPolicies: whether to include session policies.

The function returns the following values:

  • list: newly allocated list of domains. Use g_list_free_full() and g_free() to free the list.

func (*HSTSEnforcer) HasValidPolicy

func (hstsEnforcer *HSTSEnforcer) HasValidPolicy(domain string) bool

HasValidPolicy gets whether hsts_enforcer has a currently valid policy for domain.

The function takes the following parameters:

  • domain: domain.

The function returns the following values:

  • ok: TRUE if access to domain should happen over HTTPS, false otherwise.

func (*HSTSEnforcer) IsPersistent

func (hstsEnforcer *HSTSEnforcer) IsPersistent() bool

IsPersistent gets whether hsts_enforcer stores policies persistenly.

The function returns the following values:

  • ok: TRUE if hsts_enforcer storage is persistent or FALSE otherwise.

func (*HSTSEnforcer) Policies

func (hstsEnforcer *HSTSEnforcer) Policies(sessionPolicies bool) []*HSTSPolicy

Policies gets a list with the policies in enforcer.

The function takes the following parameters:

  • sessionPolicies: whether to include session policies.

The function returns the following values:

  • list: newly allocated list of policies. Use g_list_free_full() and soup_hsts_policy_free() to free the list.

func (*HSTSEnforcer) SetPolicy

func (hstsEnforcer *HSTSEnforcer) SetPolicy(policy *HSTSPolicy)

SetPolicy 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 soup_hsts_policy_new_session_policy(), the policy will not expire and will be enforced during the lifetime of hsts_enforcer's Session.

The function takes the following parameters:

  • policy of the HSTS host.

func (*HSTSEnforcer) SetSessionPolicy

func (hstsEnforcer *HSTSEnforcer) SetSessionPolicy(domain string, includeSubdomains bool)

SetSessionPolicy sets a session policy for domain. A session policy is a policy that is permanent to the lifetime of hsts_enforcer's Session and doesn't expire.

The function takes the following parameters:

  • domain: policy domain or hostname.
  • includeSubdomains: TRUE if the policy applies on sub domains.

type HSTSEnforcerClass

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

HSTSEnforcerClass: instance of this type is always passed by reference.

type HSTSEnforcerDB

type HSTSEnforcerDB struct {
	HSTSEnforcer
	// contains filtered or unexported fields
}

func NewHSTSEnforcerDB

func NewHSTSEnforcerDB(filename string) *HSTSEnforcerDB

NewHSTSEnforcerDB creates a HSTSEnforcerDB.

filename will be read in during the initialization of a HSTSEnforcerDB, 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 HSTSEnforcerDB will be written to filename when HSTSEnforcer::changed is emitted.

The function takes the following parameters:

  • filename of the database to read/write from.

The function returns the following values:

  • hstsEnforcerDB: new HSTSEnforcer.

type HSTSEnforcerDBClass

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

HSTSEnforcerDBClass: instance of this type is always passed by reference.

func (*HSTSEnforcerDBClass) ParentClass

func (h *HSTSEnforcerDBClass) ParentClass() *HSTSEnforcerClass

type HSTSEnforcerDBOverrides

type HSTSEnforcerDBOverrides struct {
}

HSTSEnforcerDBOverrides contains methods that are overridable.

type HSTSEnforcerOverrides

type HSTSEnforcerOverrides struct {
	// The function takes the following parameters:
	//
	//   - oldPolicy
	//   - newPolicy
	//
	Changed func(oldPolicy, newPolicy *HSTSPolicy)
	// HasValidPolicy gets whether hsts_enforcer has a currently valid policy
	// for domain.
	//
	// The function takes the following parameters:
	//
	//   - domain: domain.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if access to domain should happen over HTTPS, false
	//     otherwise.
	//
	HasValidPolicy func(domain string) bool
	// The function takes the following parameters:
	//
	HstsEnforced func(message *Message)
	// IsPersistent gets whether hsts_enforcer stores policies persistenly.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if hsts_enforcer storage is persistent or FALSE otherwise.
	//
	IsPersistent func() bool
}

HSTSEnforcerOverrides contains methods that are overridable.

type HSTSPolicy

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

HSTSPolicy: HTTP Strict Transport Security policy.

domain represents the host that this policy applies to. The domain must be IDNA-canonicalized. soup_hsts_policy_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.

An instance of this type is always passed by reference.

func NewHSTSPolicy

func NewHSTSPolicy(domain string, maxAge uint32, includeSubdomains bool) *HSTSPolicy

NewHSTSPolicy constructs a struct HSTSPolicy.

func NewHSTSPolicyFromResponse

func NewHSTSPolicyFromResponse(msg *Message) *HSTSPolicy

NewHSTSPolicyFromResponse constructs a struct HSTSPolicy.

func NewHSTSPolicyFull

func NewHSTSPolicyFull(domain string, maxAge uint32, expires *Date, includeSubdomains bool) *HSTSPolicy

NewHSTSPolicyFull constructs a struct HSTSPolicy.

func NewHSTSPolicySessionPolicy

func NewHSTSPolicySessionPolicy(domain string, includeSubdomains bool) *HSTSPolicy

NewHSTSPolicySessionPolicy constructs a struct HSTSPolicy.

func (*HSTSPolicy) Copy

func (policy *HSTSPolicy) Copy() *HSTSPolicy

Copy copies policy.

The function returns the following values:

  • hstsPolicy: copy of policy.

func (*HSTSPolicy) Domain

func (policy *HSTSPolicy) Domain() string

Domain gets policy's domain.

The function returns the following values:

  • utf8 policy's domain.

func (*HSTSPolicy) Equal

func (policy1 *HSTSPolicy) Equal(policy2 *HSTSPolicy) bool

Equal tests if policy1 and policy2 are equal.

The function takes the following parameters:

  • policy2: HSTSPolicy.

The function returns the following values:

  • ok: whether the policies are equal.

func (*HSTSPolicy) Expires

func (h *HSTSPolicy) Expires() *Date

Expires: policy expiration time, or NULL for a permanent session policy.

func (*HSTSPolicy) IncludeSubdomains

func (h *HSTSPolicy) IncludeSubdomains() bool

IncludeSubdomains: TRUE if the policy applies on subdomains.

func (*HSTSPolicy) IncludesSubdomains

func (policy *HSTSPolicy) IncludesSubdomains() bool

IncludesSubdomains gets whether policy include its subdomains.

The function returns the following values:

  • ok: TRUE if policy includes subdomains, FALSE otherwise.

func (*HSTSPolicy) IsExpired

func (policy *HSTSPolicy) IsExpired() bool

IsExpired gets whether policy is expired. Permanent policies never expire.

The function returns the following values:

  • ok: TRUE if policy is expired, FALSE otherwise.

func (*HSTSPolicy) IsSessionPolicy

func (policy *HSTSPolicy) IsSessionPolicy() bool

IsSessionPolicy gets whether policy is a non-permanent, non-expirable session policy. see soup_hsts_policy_new_session_policy() for details.

The function returns the following values:

  • ok: TRUE if policy is permanent, FALSE otherwise.

func (*HSTSPolicy) MaxAge

func (h *HSTSPolicy) MaxAge() uint32

MaxAge: maximum age, in seconds, that the policy is valid.

func (*HSTSPolicy) SetIncludeSubdomains

func (h *HSTSPolicy) SetIncludeSubdomains(includeSubdomains bool)

IncludeSubdomains: TRUE if the policy applies on subdomains.

func (*HSTSPolicy) SetMaxAge

func (h *HSTSPolicy) SetMaxAge(maxAge uint32)

MaxAge: maximum age, in seconds, that the policy is valid.

type HTTPVersion

type HTTPVersion C.gint

HTTPVersion indicates the HTTP protocol version being used.

const (
	// HTTP10: HTTP 1.0 (RFC 1945).
	HTTP10 HTTPVersion = iota
	// HTTP11: HTTP 1.1 (RFC 2616).
	HTTP11
)

func HeadersParseRequest

func HeadersParseRequest(str string, len int, reqHeaders *MessageHeaders) (reqMethod, reqPath string, ver HTTPVersion, guint uint)

HeadersParseRequest 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.

The function takes the following parameters:

  • str headers (up to, but not including, the trailing blank line).
  • len: length of str.
  • reqHeaders to store the header values in.

The function returns the following values:

  • reqMethod (optional): if non-NULL, will be filled in with the request method.
  • reqPath (optional): if non-NULL, will be filled in with the request path.
  • ver (optional): if non-NULL, will be filled in with the HTTP version.
  • guint: SOUP_STATUS_OK if the headers could be parsed, or an HTTP error to be returned to the client if they could not be.

func HeadersParseResponse

func HeadersParseResponse(str string, len int, headers *MessageHeaders) (HTTPVersion, uint, string, bool)

HeadersParseResponse 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.

The function takes the following parameters:

  • str headers (up to, but not including, the trailing blank line).
  • len: length of str.
  • headers to store the header values in.

The function returns the following values:

  • ver (optional): if non-NULL, will be filled in with the HTTP version.
  • statusCode (optional): if non-NULL, will be filled in with the status code.
  • reasonPhrase (optional): if non-NULL, will be filled in with the reason phrase.
  • ok success or failure.

func HeadersParseStatusLine

func HeadersParseStatusLine(statusLine string) (HTTPVersion, uint, string, bool)

HeadersParseStatusLine 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".

The function takes the following parameters:

  • statusLine: HTTP Status-Line.

The function returns the following values:

  • ver (optional): if non-NULL, will be filled in with the HTTP version.
  • statusCode (optional): if non-NULL, will be filled in with the status code.
  • reasonPhrase (optional): if non-NULL, will be filled in with the reason phrase.
  • ok: TRUE if status_line was parsed successfully.

func (HTTPVersion) String

func (h HTTPVersion) String() string

String returns the name in string for HTTPVersion.

type KnownStatusCode

type KnownStatusCode C.gint
const (
	KnownStatusCodeNone                         KnownStatusCode = 0
	KnownStatusCodeCancelled                    KnownStatusCode = 1
	KnownStatusCodeCantResolve                  KnownStatusCode = 2
	KnownStatusCodeCantResolveProxy             KnownStatusCode = 3
	KnownStatusCodeCantConnect                  KnownStatusCode = 4
	KnownStatusCodeCantConnectProxy             KnownStatusCode = 5
	KnownStatusCodeSSLFailed                    KnownStatusCode = 6
	KnownStatusCodeIOError                      KnownStatusCode = 7
	KnownStatusCodeMalformed                    KnownStatusCode = 8
	KnownStatusCodeTryAgain                     KnownStatusCode = 9
	KnownStatusCodeTooManyRedirects             KnownStatusCode = 10
	KnownStatusCodeTLSFailed                    KnownStatusCode = 11
	KnownStatusCodeContinue                     KnownStatusCode = 100
	KnownStatusCodeSwitchingProtocols           KnownStatusCode = 101
	KnownStatusCodeProcessing                   KnownStatusCode = 102
	KnownStatusCodeOK                           KnownStatusCode = 200
	KnownStatusCodeCreated                      KnownStatusCode = 201
	KnownStatusCodeAccepted                     KnownStatusCode = 202
	KnownStatusCodeNonAuthoritative             KnownStatusCode = 203
	KnownStatusCodeNoContent                    KnownStatusCode = 204
	KnownStatusCodeResetContent                 KnownStatusCode = 205
	KnownStatusCodePartialContent               KnownStatusCode = 206
	KnownStatusCodeMultiStatus                  KnownStatusCode = 207
	KnownStatusCodeMultipleChoices              KnownStatusCode = 300
	KnownStatusCodeMovedPermanently             KnownStatusCode = 301
	KnownStatusCodeFound                        KnownStatusCode = 302
	KnownStatusCodeMovedTemporarily             KnownStatusCode = 302
	KnownStatusCodeSeeOther                     KnownStatusCode = 303
	KnownStatusCodeNotModified                  KnownStatusCode = 304
	KnownStatusCodeUseProxy                     KnownStatusCode = 305
	KnownStatusCodeNotAppearingInThisProtocol   KnownStatusCode = 306
	KnownStatusCodeTemporaryRedirect            KnownStatusCode = 307
	KnownStatusCodeBadRequest                   KnownStatusCode = 400
	KnownStatusCodeUnauthorized                 KnownStatusCode = 401
	KnownStatusCodePaymentRequired              KnownStatusCode = 402
	KnownStatusCodeForbidden                    KnownStatusCode = 403
	KnownStatusCodeNotFound                     KnownStatusCode = 404
	KnownStatusCodeMethodNotAllowed             KnownStatusCode = 405
	KnownStatusCodeNotAcceptable                KnownStatusCode = 406
	KnownStatusCodeProxyAuthenticationRequired  KnownStatusCode = 407
	KnownStatusCodeProxyUnauthorized            KnownStatusCode = 407
	KnownStatusCodeRequestTimeout               KnownStatusCode = 408
	KnownStatusCodeConflict                     KnownStatusCode = 409
	KnownStatusCodeGone                         KnownStatusCode = 410
	KnownStatusCodeLengthRequired               KnownStatusCode = 411
	KnownStatusCodePreconditionFailed           KnownStatusCode = 412
	KnownStatusCodeRequestEntityTooLarge        KnownStatusCode = 413
	KnownStatusCodeRequestURITooLong            KnownStatusCode = 414
	KnownStatusCodeUnsupportedMediaType         KnownStatusCode = 415
	KnownStatusCodeRequestedRangeNotSatisfiable KnownStatusCode = 416
	KnownStatusCodeInvalidRange                 KnownStatusCode = 416
	KnownStatusCodeExpectationFailed            KnownStatusCode = 417
	KnownStatusCodeUnprocessableEntity          KnownStatusCode = 422
	KnownStatusCodeLocked                       KnownStatusCode = 423
	KnownStatusCodeFailedDependency             KnownStatusCode = 424
	KnownStatusCodeInternalServerError          KnownStatusCode = 500
	KnownStatusCodeNotImplemented               KnownStatusCode = 501
	KnownStatusCodeBadGateway                   KnownStatusCode = 502
	KnownStatusCodeServiceUnavailable           KnownStatusCode = 503
	KnownStatusCodeGatewayTimeout               KnownStatusCode = 504
	KnownStatusCodeHTTPVersionNotSupported      KnownStatusCode = 505
	KnownStatusCodeInsufficientStorage          KnownStatusCode = 507
	KnownStatusCodeNotExtended                  KnownStatusCode = 510
)

func (KnownStatusCode) String

func (k KnownStatusCode) String() string

String returns the name in string for KnownStatusCode.

type Logger

type Logger struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(level LoggerLogLevel, maxBodySize int) *Logger

NewLogger creates a new Logger with the given debug level. If level is SOUP_LOGGER_LOG_BODY, max_body_size gives the maximum number of bytes of the body that will be logged. (-1 means "no limit".)

If you need finer control over what message parts are and aren't logged, use soup_logger_set_request_filter() and soup_logger_set_response_filter().

The function takes the following parameters:

  • level: debug level.
  • maxBodySize: maximum body size to output, or -1.

The function returns the following values:

  • logger: new Logger.

func (*Logger) Attach deprecated

func (logger *Logger) Attach(session *Session)

Attach sets logger to watch session and print debug information for its messages.

(The session will take a reference on logger, which will be removed when you call soup_logger_detach(), or when the session is destroyed.)

Deprecated: Use soup_session_add_feature() instead.

The function takes the following parameters:

  • session: Session.

func (*Logger) Detach deprecated

func (logger *Logger) Detach(session *Session)

Detach stops logger from watching session.

Deprecated: Use soup_session_remove_feature() instead.

The function takes the following parameters:

  • session: Session.

func (*Logger) SetPrinter

func (logger *Logger) SetPrinter(printer LoggerPrinter)

SetPrinter sets up an alternate log printing routine, if you don't want the log to go to <literal>stdout</literal>.

The function takes the following parameters:

  • printer: callback for printing logging output.

func (*Logger) SetRequestFilter

func (logger *Logger) SetRequestFilter(requestFilter LoggerFilter)

SetRequestFilter 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 soup_logger_new().).

The function takes the following parameters:

  • requestFilter: callback for request debugging.

func (*Logger) SetResponseFilter

func (logger *Logger) SetResponseFilter(responseFilter LoggerFilter)

SetResponseFilter 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 soup_logger_new().).

The function takes the following parameters:

  • responseFilter: callback for response debugging.

type LoggerClass

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

LoggerClass: instance of this type is always passed by reference.

type LoggerFilter

type LoggerFilter func(logger *Logger, msg *Message) (loggerLogLevel LoggerLogLevel)

LoggerFilter: prototype for a logging filter. The filter callback will be invoked for each request or response, and should analyze it and return a LoggerLogLevel value indicating how much of the message to log. Eg, it might choose between SOUP_LOGGER_LOG_BODY and SOUP_LOGGER_LOG_HEADERS depending on the Content-Type.

type LoggerLogLevel

type LoggerLogLevel C.gint

LoggerLogLevel describes the level of logging output to provide.

const (
	// LoggerLogNone: no logging.
	LoggerLogNone LoggerLogLevel = iota
	// LoggerLogMinimal: log the Request-Line or Status-Line and the Soup-Debug
	// pseudo-headers.
	LoggerLogMinimal
	// LoggerLogHeaders: log the full request/response headers.
	LoggerLogHeaders
	// LoggerLogBody: log the full headers and request/response bodies.
	LoggerLogBody
)

func (LoggerLogLevel) String

func (l LoggerLogLevel) String() string

String returns the name in string for LoggerLogLevel.

type LoggerOverrides

type LoggerOverrides struct {
}

LoggerOverrides contains methods that are overridable.

type LoggerPrinter

type LoggerPrinter func(logger *Logger, level LoggerLogLevel, direction byte, data string)

LoggerPrinter: 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:

<informalexample><programlisting> printf ("c s\n", direction, data); </programlisting></informalexample>.

type MemoryUse

type MemoryUse C.gint

MemoryUse describes how Buffer should use the data passed in by the caller.

See also soup_buffer_new_with_owner(), which allows to you create a buffer containing data which is owned by another object.

const (
	// MemoryStatic: 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.
	MemoryStatic MemoryUse = iota
	// MemoryTake: caller has allocated the memory for the Buffer's use; libsoup
	// will assume ownership of it and free it (with g_free()) when it is done
	// with it.
	MemoryTake
	// MemoryCopy: passed-in data belongs to the caller; the Buffer will copy it
	// into new memory, leaving the caller free to reuse the original memory.
	MemoryCopy
	// MemoryTemporary: passed-in data belongs to the caller, but will remain
	// valid for the lifetime of the Buffer. The difference between this and
	// SOUP_MEMORY_STATIC is that if you copy a SOUP_MEMORY_TEMPORARY buffer,
	// it will make a copy of the memory as well, rather than reusing the
	// original memory.
	MemoryTemporary
)

func (MemoryUse) String

func (m MemoryUse) String() string

String returns the name in string for MemoryUse.

type Message

type Message struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

Message represents an HTTP message being sent or received.

status_code will normally be a Status value, eg, SOUP_STATUS_OK, though of course it might actually be an unknown status code. 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 reason_phrase in user-visible messages. Rather, you should look at status_code, and determine an end-user-appropriate message based on that and on what you were trying to do.

As described in the MessageBody documentation, the request_body and response_body <literal>data</literal> fields will not necessarily be filled in at all times. When the body fields are filled in, they will be terminated with a '\0' byte (which is not included in the <literal>length</literal>), so you can use them as ordinary C strings (assuming that you know that the body doesn't have any other '\0' bytes).

For a client-side Message, request_body's <literal>data</literal> is usually filled in right before libsoup writes the request to the network, but you should not count on this; use soup_message_body_flatten() if you want to ensure that <literal>data</literal> is filled in. If you are not using Request to read the response, then response_body's <literal>data</literal> will be filled in before Message::finished is emitted. (If you are using Request, then the message body is not accumulated by default, so response_body's <literal>data</literal> will always be NULL.)

For a server-side Message, request_body's data will be filled in before Message::got_body is emitted.

To prevent the data field from being filled in at all (eg, if you are handling the data from a Message::got_chunk, and so don't need to see it all at the end), call soup_message_body_set_accumulate() on response_body or request_body as appropriate, passing FALSE.

func FormRequestNewFromHash

func FormRequestNewFromHash(method, uri string, formDataSet map[string]string) *Message

FormRequestNewFromHash creates a new SoupMessage and sets it up to send form_data_set to uri via method, as with soup_form_request_new().

The function takes the following parameters:

  • method: HTTP method, either "GET" or "POST".
  • uri: URI to send the form data to.
  • formDataSet: data to send to uri.

The function returns the following values:

  • message: new SoupMessage.

func FormRequestNewFromMultipart

func FormRequestNewFromMultipart(uri string, multipart *Multipart) *Message

FormRequestNewFromMultipart creates a new SoupMessage and sets it up to send multipart to uri via POST.

To send a <literal>"multipart/form-data"</literal> POST, first create a Multipart, using SOUP_FORM_MIME_TYPE_MULTIPART as the MIME type. Then use soup_multipart_append_form_string() and soup_multipart_append_form_file() to add the value of each form control to the multipart. (These are just convenience methods, and you can use soup_multipart_append_part() if you need greater control over the part headers.) Finally, call soup_form_request_new_from_multipart() to serialize the multipart structure and create a Message.

The function takes the following parameters:

  • uri: URI to send the form data to.
  • multipart: "multipart/form-data" Multipart.

The function returns the following values:

  • message: new SoupMessage.

func NewMessage

func NewMessage(method, uriString string) *Message

NewMessage creates a new empty Message, which will connect to uri.

The function takes the following parameters:

  • method: HTTP method for the created request.
  • uriString: destination endpoint (as a string).

The function returns the following values:

  • message (optional): new Message (or NULL if uri could not be parsed).

func NewMessageFromURI

func NewMessageFromURI(method string, uri *URI) *Message

NewMessageFromURI creates a new empty Message, which will connect to uri.

The function takes the following parameters:

  • method: HTTP method for the created request.
  • uri: destination endpoint (as a URI).

The function returns the following values:

  • message: new Message.

func NewXmlrpcMessage

func NewXmlrpcMessage(uri, methodName string, params *glib.Variant) (*Message, error)

NewXmlrpcMessage creates an XML-RPC methodCall and returns a Message, ready to send, for that method call.

See soup_xmlrpc_build_request() for serialization details.

If params is floating, it is consumed.

The function takes the following parameters:

  • uri: URI of the XML-RPC service.
  • methodName: name of the XML-RPC method to invoke at uri.
  • params: #GVariant tuple.

The function returns the following values:

  • message encoding the indicated XML-RPC request, or NULL on error.

func (*Message) Address

func (msg *Message) Address() *Address

Address gets the address msg's URI points to. After first setting the URI on a message, this will be unresolved, although the message's session will resolve it before sending the message.

The function returns the following values:

  • address msg's URI points to.

func (*Message) ConnectContentSniffed

func (msg *Message) ConnectContentSniffed(f func(typ string, params map[string]string)) coreglib.SignalHandle

ConnectContentSniffed: this signal is emitted after Message::got-headers, and before the first Message::got-chunk. 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 Message::got-headers, and type is NULL.

If the ContentSniffer feature is enabled, and the sniffer decided to perform sniffing, the first Message::got-chunk emission may be delayed, so that the sniffer has enough data to correctly sniff the content. It notified the library user that the content has been sniffed, and allows it to change the header contents in the message, if desired.

After this signal is emitted, the data that was spooled so that sniffing could be done is delivered on the first emission of Message::got-chunk.

func (*Message) ConnectFinished

func (msg *Message) ConnectFinished(f func()) coreglib.SignalHandle

ConnectFinished is emitted when all HTTP processing is finished for a message. (After Message::got_body for client-side messages, or after Message::wrote_body for server-side messages.).

func (*Message) ConnectGotBody

func (msg *Message) ConnectGotBody(f func()) coreglib.SignalHandle

ConnectGotBody is emitted after receiving the complete message body. (For a server-side message, this means it has received the request body. For a client-side message, this means it has received the response body and is nearly done with the message.)

See also soup_message_add_header_handler() and soup_message_add_status_code_handler(), which can be used to connect to a subset of emissions of this signal.

func (*Message) ConnectGotChunk

func (msg *Message) ConnectGotChunk(f func(chunk *Buffer)) coreglib.SignalHandle

ConnectGotChunk is 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.

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) ConnectGotHeaders

func (msg *Message) ConnectGotHeaders(f func()) coreglib.SignalHandle

ConnectGotHeaders is emitted after receiving all message headers for a message. (For a client-side message, this is after receiving the Status-Line and response headers; for a server-side message, it is after receiving the Request-Line and request headers.)

See also soup_message_add_header_handler() and soup_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 Message::got_body handler rather than a Message::got_headers handler, so that the existing HTTP connection can be reused.).

func (*Message) ConnectGotInformational

func (msg *Message) ConnectGotInformational(f func()) coreglib.SignalHandle

ConnectGotInformational is 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) ConnectNetworkEvent

func (msg *Message) ConnectNetworkEvent(f func(event gio.SocketClientEvent, connection gio.IOStreamer)) coreglib.SignalHandle

ConnectNetworkEvent is emitted to indicate that some network-related event related to msg has occurred. This essentially proxies the Client::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 Client::event for more information on what the different values of event correspond to, and what connection will be in each case.

func (*Message) ConnectRestarted

func (msg *Message) ConnectRestarted(f func()) coreglib.SignalHandle

ConnectRestarted is emitted when a request that was already sent once is now being sent again (eg, because the first attempt received a redirection response, or because we needed to use authentication).

func (*Message) ConnectStarting

func (msg *Message) ConnectStarting(f func()) coreglib.SignalHandle

ConnectStarting is emitted just before a message is sent.

func (*Message) ConnectWroteBody

func (msg *Message) ConnectWroteBody(f func()) coreglib.SignalHandle

ConnectWroteBody is emitted immediately after writing the complete body for a message. (For a client-side message, this means that libsoup is done writing and is now waiting for the response from the server. For a server-side message, this means that libsoup has finished writing the response and is nearly done with the message.).

func (*Message) ConnectWroteBodyData

func (msg *Message) ConnectWroteBodyData(f func(chunk *Buffer)) coreglib.SignalHandle

ConnectWroteBodyData is emitted immediately after writing a portion of the message body to the network.

Unlike Message::wrote_chunk, this is emitted after every successful write() call, not only after finishing a complete "chunk".

func (*Message) ConnectWroteChunk

func (msg *Message) ConnectWroteChunk(f func()) coreglib.SignalHandle

ConnectWroteChunk is emitted immediately after writing a body chunk for a message.

Note that this signal is not parallel to Message::got_chunk; it is emitted only when a complete chunk (added with soup_message_body_append() or soup_message_body_append_buffer()) has been written. To get more useful continuous progress information, use Message::wrote_body_data.

func (*Message) ConnectWroteHeaders

func (msg *Message) ConnectWroteHeaders(f func()) coreglib.SignalHandle

ConnectWroteHeaders is emitted immediately after writing the headers for a message. (For a client-side message, this is after writing the request headers; for a server-side message, it is after writing the response headers.).

func (*Message) ConnectWroteInformational

func (msg *Message) ConnectWroteInformational(f func()) coreglib.SignalHandle

ConnectWroteInformational is emitted immediately after writing a 1xx (Informational) response for a (server-side) message.

func (*Message) ContentSniffed

func (msg *Message) ContentSniffed(contentType string, params map[unsafe.Pointer]unsafe.Pointer)

The function takes the following parameters:

  • contentType
  • params

func (*Message) DisableFeature

func (msg *Message) DisableFeature(featureType coreglib.Type)

DisableFeature: this disables the actions of SessionFeature<!-- -->s with the given feature_type (or a subclass of that type) on msg, so that msg is processed as though the feature(s) hadn't been added to the session. Eg, passing UP_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.

The function takes the following parameters:

  • featureType of a SessionFeature.

func (*Message) Finished

func (msg *Message) Finished()

func (*Message) FirstParty

func (msg *Message) FirstParty() *URI

FirstParty gets msg's first-party URI.

The function returns the following values:

  • urI msg's first party URI.

func (*Message) Flags

func (msg *Message) Flags() MessageFlags

Flags gets the flags on msg.

The function returns the following values:

  • messageFlags: flags.

func (*Message) GotBody

func (msg *Message) GotBody()

func (*Message) GotChunk

func (msg *Message) GotChunk(chunk *Buffer)

The function takes the following parameters:

func (*Message) GotHeaders

func (msg *Message) GotHeaders()

func (*Message) GotInformational

func (msg *Message) GotInformational()

func (*Message) HTTPSStatus

func (msg *Message) HTTPSStatus() (gio.TLSCertificater, gio.TLSCertificateFlags, bool)

HTTPSStatus: if msg is using https (or attempted to use https but got SOUP_STATUS_SSL_FAILED), this retrieves the Certificate associated with its connection, and the CertificateFlags showing what problems, if any, have been found with that certificate.

<note><para>This is only meaningful with messages processed by a Session and is not useful for messages received by a Server</para></note>.

The function returns the following values:

  • certificate msg's TLS certificate.
  • errors: verification status of certificate.
  • ok: TRUE if msg used/attempted https, FALSE if not.

func (*Message) HTTPVersion

func (msg *Message) HTTPVersion() HTTPVersion

HTTPVersion gets the HTTP version of msg. This is the minimum of the version from the request and the version from the response.

The function returns the following values:

  • httpVersion: HTTP version.

func (*Message) IsFeatureDisabled

func (msg *Message) IsFeatureDisabled(featureType coreglib.Type) bool

IsFeatureDisabled: get whether SessionFeature<!-- -->s of the given feature_type (or a subclass of that type) are disabled on msg. See soup_message_disable_feature().

The function takes the following parameters:

  • featureType of a SessionFeature.

The function returns the following values:

  • ok: TRUE if feature is disabled, or FALSE otherwise.

func (*Message) IsKeepalive

func (msg *Message) IsKeepalive() bool

IsKeepalive determines whether or not msg's connection can be kept alive for further requests after processing msg, based on the HTTP version, Connection header, etc.

The function returns the following values:

  • ok: TRUE or FALSE.

func (*Message) IsTopLevelNavigation

func (msg *Message) IsTopLevelNavigation() bool

The function returns the following values:

func (*Message) Priority

func (msg *Message) Priority() MessagePriority

Priority retrieves the MessagePriority. If not set this value defaults to UP_MESSAGE_PRIORITY_NORMAL.

The function returns the following values:

  • messagePriority: priority of the message.

func (*Message) Restarted

func (msg *Message) Restarted()

func (*Message) SetChunkAllocator deprecated

func (msg *Message) SetChunkAllocator(allocator ChunkAllocator)

SetChunkAllocator sets an alternate chunk-allocation function to use when reading msg's body when using the traditional (ie, non-Request<!-- -->-based) API. Every time data is available to read, libsoup will call allocator, which should return a Buffer. (See ChunkAllocator for additional details.) Libsoup will then read data from the network into that buffer, and update the buffer's <literal>length</literal> to indicate how much data it read.

Generally, a custom chunk allocator would be used in conjunction with soup_message_body_set_accumulate() FALSE and Message::got_chunk, as part of a strategy to avoid unnecessary copying of data. However, you cannot assume that every call to the allocator will be followed by a call to your Message::got_chunk handler; if an I/O error occurs, then the buffer will be unreffed without ever having been used. If your buffer-allocation strategy requires special cleanup, use soup_buffer_new_with_owner() rather than doing the cleanup from the Message::got_chunk handler.

The other thing to remember when using non-accumulating message bodies is that the buffer passed to the Message::got_chunk handler will be unreffed after the handler returns, just as it would be in the non-custom-allocated case. If you want to hand the chunk data off to some other part of your program to use later, you'll need to ref the Buffer (or its owner, in the soup_buffer_new_with_owner() case) to ensure that the data remains valid.

Deprecated: Request provides a much simpler API that lets you read the response directly into your own buffers without needing to mess with callbacks, pausing/unpausing, etc.

The function takes the following parameters:

  • allocator: chunk allocator callback.

func (*Message) SetFirstParty

func (msg *Message) SetFirstParty(firstParty *URI)

SetFirstParty sets first_party as the main document URI for msg. For details of when and how this is used refer to the documentation for CookieJarAcceptPolicy.

The function takes the following parameters:

  • firstParty for the msg's first party.

func (*Message) SetFlags

func (msg *Message) SetFlags(flags MessageFlags)

SetFlags sets the specified flags on msg.

The function takes the following parameters:

  • flags: set of MessageFlags values.

func (*Message) SetHTTPVersion

func (msg *Message) SetHTTPVersion(version HTTPVersion)

SetHTTPVersion sets the HTTP version on msg. The default version is SOUP_HTTP_1_1. Setting it to SOUP_HTTP_1_0 will prevent certain functionality from being used.

The function takes the following parameters:

  • version: HTTP version.

func (*Message) SetIsTopLevelNavigation

func (msg *Message) SetIsTopLevelNavigation(isTopLevelNavigation bool)

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

The function takes the following parameters:

  • isTopLevelNavigation: if TRUE indicate the current request is a top-level navigation.

func (*Message) SetPriority

func (msg *Message) SetPriority(priority MessagePriority)

SetPriority 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 SessionSync (or with synchronous messages on a plain Session) because in the synchronous/blocking case, priority ends up being determined semi-randomly by thread scheduling.

The function takes the following parameters:

  • priority: MessagePriority.

func (*Message) SetRedirect

func (msg *Message) SetRedirect(statusCode uint, redirectUri string)

SetRedirect sets msg's status_code to status_code and adds a Location header pointing to redirect_uri. Use this from a 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 <emphasis>and query</emphasis> of msg's URI.

The function takes the following parameters:

  • statusCode: 3xx status code.
  • redirectUri: URI to redirect msg to.

func (*Message) SetRequest

func (msg *Message) SetRequest(contentType string, reqUse MemoryUse, reqBody string)

SetRequest: convenience function to set the request body of a Message. If content_type is NULL, the request body must be empty as well.

The function takes the following parameters:

  • contentType (optional): MIME Content-Type of the body.
  • reqUse describing how to handle req_body.
  • reqBody (optional): a data buffer containing the body of the message request.

func (*Message) SetResponse

func (msg *Message) SetResponse(contentType string, respUse MemoryUse, respBody string)

SetResponse: convenience function to set the response body of a Message. If content_type is NULL, the response body must be empty as well.

The function takes the following parameters:

  • contentType (optional): MIME Content-Type of the body.
  • respUse describing how to handle resp_body.
  • respBody (optional): a data buffer containing the body of the message response.

func (*Message) SetSiteForCookies

func (msg *Message) SetSiteForCookies(siteForCookies *URI)

SetSiteForCookies 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.

The function takes the following parameters:

  • siteForCookies (optional) for the msg's site for cookies.

func (*Message) SetStatus

func (msg *Message) SetStatus(statusCode uint)

SetStatus sets msg's status code to status_code. If status_code is a known value, it will also set msg's reason_phrase.

The function takes the following parameters:

  • statusCode: HTTP status code.

func (*Message) SetStatusFull

func (msg *Message) SetStatusFull(statusCode uint, reasonPhrase string)

SetStatusFull sets msg's status code and reason phrase.

The function takes the following parameters:

  • statusCode: HTTP status code.
  • reasonPhrase: description of the status.

func (*Message) SetURI

func (msg *Message) SetURI(uri *URI)

SetURI 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 call soup_session_requeue_message().

The function takes the following parameters:

  • uri: new URI.

func (*Message) SiteForCookies

func (msg *Message) SiteForCookies() *URI

SiteForCookies gets msg's site for cookies URI.

The function returns the following values:

  • urI msg's site for cookies URI.

func (*Message) SoupRequest

func (msg *Message) SoupRequest() *Request

SoupRequest: if msg is associated with a Request, this returns that request. Otherwise it returns NULL.

The function returns the following values:

  • request msg's associated Request.

func (*Message) Starting

func (msg *Message) Starting()

func (*Message) URI

func (msg *Message) URI() *URI

URI gets msg's URI.

The function returns the following values:

  • urI: URI msg is targeted for.

func (*Message) WroteBody

func (msg *Message) WroteBody()

func (*Message) WroteBodyData

func (msg *Message) WroteBodyData(chunk *Buffer)

The function takes the following parameters:

func (*Message) WroteChunk

func (msg *Message) WroteChunk()

func (*Message) WroteHeaders

func (msg *Message) WroteHeaders()

func (*Message) WroteInformational

func (msg *Message) WroteInformational()

type MessageBody

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

MessageBody request or response body.

Note that while length always reflects the full length of the message body, data is normally NULL, and will only be filled in after soup_message_body_flatten() is called. For client-side messages, this automatically happens for the response body after it has been fully read, unless you set the SOUP_MESSAGE_OVERWRITE_CHUNKS flags. 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).

An instance of this type is always passed by reference.

func NewMessageBody

func NewMessageBody() *MessageBody

NewMessageBody constructs a struct MessageBody.

func (*MessageBody) Accumulate

func (body *MessageBody) Accumulate() bool

Accumulate gets the accumulate flag on body; see soup_message_body_set_accumulate() for details.

The function returns the following values:

  • ok: accumulate flag for body.

func (*MessageBody) Append

func (body *MessageBody) Append(data []byte)

Append appends length bytes from data to body.

This function is exactly equivalent to soup_message_body_append() with SOUP_MEMORY_TAKE as second argument; it exists mainly for convenience and simplifying language bindings.

The function takes the following parameters:

  • data to append.

func (*MessageBody) AppendBuffer

func (body *MessageBody) AppendBuffer(buffer *Buffer)

AppendBuffer appends the data from buffer to body. (MessageBody uses Buffers internally, so this is normally a constant-time operation that doesn't actually require copying the data in buffer.).

The function takes the following parameters:

  • buffer: Buffer.

func (*MessageBody) Chunk

func (body *MessageBody) Chunk(offset int64) *Buffer

Chunk gets a Buffer 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 soup_message_body_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 soup_message_body_complete() has been called or not; if it has, then soup_message_body_get_chunk() will return a 0-length chunk (indicating the end of body). If it has not, then soup_message_body_get_chunk() will return NULL (indicating that body may still potentially have more data, but that data is not currently available).

The function takes the following parameters:

  • offset: offset.

The function returns the following values:

  • buffer (optional) or NULL.

func (*MessageBody) Complete

func (body *MessageBody) Complete()

Complete tags body as being complete; Call this when using chunked encoding after you have appended the last chunk.

func (*MessageBody) Data

func (m *MessageBody) Data() string

Data: data.

func (*MessageBody) Flatten

func (body *MessageBody) Flatten() *Buffer

Flatten fills in body's data field with a buffer containing all of the data in body (plus an additional '\0' byte not counted by body's length field).

The function returns the following values:

  • buffer containing the same data as body. (You must free this buffer if you do not want it.).

func (*MessageBody) GotChunk

func (body *MessageBody) GotChunk(chunk *Buffer)

GotChunk handles the MessageBody part of receiving a chunk of data from the network. Normally this means appending chunk to body, exactly as with soup_message_body_append_buffer(), 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.

The function takes the following parameters:

  • chunk received from the network.

func (*MessageBody) Length

func (m *MessageBody) Length() int64

Length: length of data.

func (*MessageBody) SetAccumulate

func (body *MessageBody) SetAccumulate(accumulate bool)

SetAccumulate 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.

In particular, if you set this flag to FALSE on an "incoming" message body (that is, the Message:response_body of a client-side message, or Message:request_body of a server-side message), this will cause each chunk of the body to be discarded after its corresponding Message::got_chunk signal is emitted. (This is equivalent to setting the deprecated SOUP_MESSAGE_OVERWRITE_CHUNKS flag on the message.)

If you set this flag to FALSE on the Message:response_body of a server-side message, it will cause each chunk of the body to be discarded after its corresponding Message::wrote_chunk signal is emitted.

If you set the flag to FALSE on the 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 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. However, if you set the SOUP_MESSAGE_CAN_REBUILD flag on the message, then the chunks will be discarded, and you will be responsible for recreating the request body after the Message::restarted signal is emitted.

The function takes the following parameters:

  • accumulate: whether or not to accumulate body chunks in body.

func (*MessageBody) SetLength

func (m *MessageBody) SetLength(length int64)

Length: length of data.

func (*MessageBody) Truncate

func (body *MessageBody) Truncate()

Truncate deletes all of the data in body.

func (*MessageBody) WroteChunk

func (body *MessageBody) WroteChunk(chunk *Buffer)

WroteChunk handles the MessageBody 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.

The function takes the following parameters:

  • chunk returned from soup_message_body_get_chunk().

type MessageClass

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

MessageClass: instance of this type is always passed by reference.

type MessageFlags

type MessageFlags C.guint

MessageFlags various flags that can be set on a Message to alter its behavior.

const (
	// MessageNoRedirect: session should not follow redirect (3xx) responses
	// received by this message.
	MessageNoRedirect MessageFlags = 0b10
	// MessageCanRebuild: caller will rebuild the request body if the message is
	// restarted; see soup_message_body_set_accumulate() for more details.
	MessageCanRebuild MessageFlags = 0b100
	// MessageOverwriteChunks: deprecated: equivalent to calling
	// soup_message_body_set_accumulate() on the incoming message body (ie,
	// Message:response_body for a client-side request), passing FALSE.
	MessageOverwriteChunks MessageFlags = 0b1000
	// MessageContentDecoded: set by ContentDecoder to indicate that it has
	// removed the Content-Encoding on a message (and so headers such as
	// Content-Length may no longer accurately describe the body).
	MessageContentDecoded MessageFlags = 0b10000
	// MessageCertificateTrusted: if set after an https response has been
	// received, indicates that the server's SSL certificate is trusted
	// according to the session's CA.
	MessageCertificateTrusted MessageFlags = 0b100000
	// MessageNewConnection requests that the message should be sent on a
	// newly-created connection, not reusing an existing persistent connection.
	// Note that messages with non-idempotent Message:method<!-- -->s behave
	// this way by default, unless UP_MESSAGE_IDEMPOTENT is set.
	MessageNewConnection MessageFlags = 0b1000000
	// MessageIdempotent: message is considered idempotent, regardless its
	// Message:method, and allows reuse of existing idle connections, instead of
	// always requiring a new one, unless UP_MESSAGE_NEW_CONNECTION is set.
	MessageIdempotent MessageFlags = 0b10000000
	// MessageIgnoreConnectionLimits: request that a new connection is created
	// for the message if there aren't idle connections available and it's not
	// possible to create new connections due to any of the connection limits
	// has been reached. If a dedicated connection is eventually created for
	// this message, it will be dropped when the message finishes. Since 2.50.
	MessageIgnoreConnectionLimits MessageFlags = 0b100000000
	// MessageDoNotUseAuthCache 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 Session::authenticate signal will
	// be emitted, if you want to disable authentication for a message use
	// soup_message_disable_feature() passing UP_TYPE_AUTH_MANAGER instead.
	// Since 2.58.
	MessageDoNotUseAuthCache MessageFlags = 0b1000000000
)

func (MessageFlags) Has

func (m MessageFlags) Has(other MessageFlags) bool

Has returns true if m contains other.

func (MessageFlags) String

func (m MessageFlags) String() string

String returns the names in string for MessageFlags.

type MessageHeaders

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

MessageHeaders: HTTP message headers associated with a request or response.

An instance of this type is always passed by reference.

func NewMessageHeaders

func NewMessageHeaders(typ MessageHeadersType) *MessageHeaders

NewMessageHeaders constructs a struct MessageHeaders.

func (*MessageHeaders) Append

func (hdrs *MessageHeaders) Append(name string, value string)

Append 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 soup_message_headers_replace().)

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

The function takes the following parameters:

  • name: header name to add.
  • value: new value of name.

func (*MessageHeaders) CleanConnectionHeaders

func (hdrs *MessageHeaders) CleanConnectionHeaders()

CleanConnectionHeaders removes all the headers listed in the Connection header.

func (*MessageHeaders) Clear

func (hdrs *MessageHeaders) Clear()

Clear clears hdrs.

func (*MessageHeaders) ContentDisposition

func (hdrs *MessageHeaders) ContentDisposition() (string, map[string]string, bool)

ContentDisposition 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 Multipart and the associated form methods.

The function returns the following values:

  • disposition: return location for the disposition-type, or NULL.
  • params: return location for the Content-Disposition parameters, or NULL.
  • ok: TRUE if hdrs contains a "Content-Disposition" header, FALSE if not (in which case *disposition and *params will be unchanged).

func (*MessageHeaders) ContentLength

func (hdrs *MessageHeaders) ContentLength() int64

ContentLength gets the message body length that hdrs declare. This will only be non-0 if soup_message_headers_get_encoding() returns SOUP_ENCODING_CONTENT_LENGTH.

The function returns the following values:

  • gint64: message body length declared by hdrs.

func (*MessageHeaders) ContentRange

func (hdrs *MessageHeaders) ContentRange() (start int64, end int64, totalLength int64, ok bool)

ContentRange 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.

The function returns the following values:

  • start: return value for the start of the range.
  • end: return value for the end of the range.
  • totalLength (optional): return value for the total length of the resource, or NULL if you don't care.
  • ok: TRUE if hdrs contained a "Content-Range" header containing a byte range which could be parsed, FALSE otherwise.

func (*MessageHeaders) ContentType

func (hdrs *MessageHeaders) ContentType() (map[string]string, string)

ContentType 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.

The function returns the following values:

  • params (optional): return location for the Content-Type parameters (eg, "charset"), or NULL.
  • utf8 (optional): string with the value of the "Content-Type" header or NULL if hdrs does not contain that header or it cannot be parsed (in which case *params will be unchanged).

func (*MessageHeaders) Encoding

func (hdrs *MessageHeaders) Encoding() Encoding

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.

The function returns the following values:

  • encoding declared by hdrs.

func (*MessageHeaders) Expectations

func (hdrs *MessageHeaders) Expectations() Expectation

Expectations gets the expectations declared by hdrs's "Expect" header. Currently this will either be SOUP_EXPECTATION_CONTINUE or SOUP_EXPECTATION_UNRECOGNIZED.

The function returns the following values:

  • expectation contents of hdrs's "Expect" header.

func (*MessageHeaders) ForEach

func (hdrs *MessageHeaders) ForEach(fn MessageHeadersForEachFunc)

ForEach calls func once for each header value in hdrs.

Beware that unlike soup_message_headers_get(), 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 soup_message_headers_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.

The function takes the following parameters:

  • fn: callback function to run for each header.

func (*MessageHeaders) FreeRanges

func (hdrs *MessageHeaders) FreeRanges(ranges *Range)

FreeRanges frees the array of ranges returned from soup_message_headers_get_ranges().

The function takes the following parameters:

  • ranges: array of Range.

func (*MessageHeaders) Get deprecated

func (hdrs *MessageHeaders) Get(name string) string

Get gets the value of header name in hdrs.

This method was supposed to work correctly for both single-valued and list-valued headers, but because some HTTP clients/servers mistakenly send multiple copies of headers that are supposed to be single-valued, it sometimes returns incorrect results. To fix this, the methods soup_message_headers_get_one() and soup_message_headers_get_list() were introduced, so callers can explicitly state which behavior they are expecting.

Deprecated: Use soup_message_headers_get_one() or soup_message_headers_get_list() instead.

The function takes the following parameters:

  • name: header name.

The function returns the following values:

  • utf8 (optional) as with soup_message_headers_get_list().

func (*MessageHeaders) HeaderContains

func (hdrs *MessageHeaders) HeaderContains(name string, token string) bool

HeaderContains 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 soup_header_contains() on its value.).

The function takes the following parameters:

  • name: header name.
  • token to look for.

The function returns the following values:

  • ok: TRUE if the header is present and contains token, FALSE otherwise.

func (*MessageHeaders) HeaderEquals

func (hdrs *MessageHeaders) HeaderEquals(name string, value string) bool

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

The function takes the following parameters:

  • name: header name.
  • value: expected value.

The function returns the following values:

  • ok: TRUE if the header is present and its value is value, FALSE otherwise.

func (*MessageHeaders) HeadersType

func (hdrs *MessageHeaders) HeadersType() MessageHeadersType

HeadersType gets the type of headers.

The function returns the following values:

  • messageHeadersType header's type.

func (*MessageHeaders) List

func (hdrs *MessageHeaders) List(name string) string

List 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 soup_message_headers_get_one().

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

The function takes the following parameters:

  • name: header name.

The function returns the following values:

  • utf8 (optional) header's value or NULL if not found.

func (*MessageHeaders) One

func (hdrs *MessageHeaders) One(name string) string

One gets the value of header name in hdrs. Use this for headers whose values are <emphasis>not</emphasis> comma-delimited lists, and which therefore can only appear at most once in the headers. For list-valued headers, use soup_message_headers_get_list().

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

The function takes the following parameters:

  • name: header name.

The function returns the following values:

  • utf8 (optional) header's value or NULL if not found.

func (*MessageHeaders) Ranges

func (hdrs *MessageHeaders) Ranges(totalLength int64) ([]Range, bool)

Ranges parses hdrs's Range header and returns an array of the requested byte ranges. The returned array must be freed with soup_message_headers_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 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.

<note><para> Server 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. </para></note>.

The function takes the following parameters:

  • totalLength: total_length of the response body.

The function returns the following values:

  • ranges: return location for an array of Range.
  • ok: TRUE if hdrs contained a syntactically-valid "Range" header, FALSE otherwise (in which case range and length will not be set).

func (*MessageHeaders) Remove

func (hdrs *MessageHeaders) Remove(name string)

Remove removes name from hdrs. If there are multiple values for name, they are all removed.

The function takes the following parameters:

  • name: header name to remove.

func (*MessageHeaders) Replace

func (hdrs *MessageHeaders) Replace(name string, value string)

Replace replaces the value of the header name in hdrs with value. (See also soup_message_headers_append().)

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

The function takes the following parameters:

  • name: header name to replace.
  • value: new value of name.

func (*MessageHeaders) SetContentDisposition

func (hdrs *MessageHeaders) SetContentDisposition(disposition string, params map[string]string)

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

See soup_message_headers_get_content_disposition() for a discussion of how Content-Disposition is used in HTTP.

The function takes the following parameters:

  • disposition: disposition-type.
  • params (optional): additional parameters, or NULL.

func (*MessageHeaders) SetContentLength

func (hdrs *MessageHeaders) SetContentLength(contentLength int64)

SetContentLength 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 soup_message_headers_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.

The function takes the following parameters:

  • contentLength: message body length.

func (*MessageHeaders) SetContentRange

func (hdrs *MessageHeaders) SetContentRange(start int64, end int64, totalLength int64)

SetContentRange 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.)

<note><para> Server has built-in handling for range requests, and you do not normally need to call this function youself. See soup_message_headers_get_ranges() for more details. </para></note>.

The function takes the following parameters:

  • start of the range.
  • end of the range.
  • totalLength: total length of the resource, or -1 if unknown.

func (*MessageHeaders) SetContentType

func (hdrs *MessageHeaders) SetContentType(contentType string, params map[string]string)

SetContentType sets the "Content-Type" header in hdrs to content_type, optionally with additional parameters specified in params.

The function takes the following parameters:

  • contentType: MIME type.
  • params (optional): additional parameters, or NULL.

func (*MessageHeaders) SetEncoding

func (hdrs *MessageHeaders) SetEncoding(encoding Encoding)

SetEncoding 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.

The function takes the following parameters:

  • encoding: Encoding.

func (*MessageHeaders) SetExpectations

func (hdrs *MessageHeaders) SetExpectations(expectations Expectation)

SetExpectations 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.

The function takes the following parameters:

  • expectations to set.

func (*MessageHeaders) SetRange

func (hdrs *MessageHeaders) SetRange(start int64, end int64)

SetRange sets hdrs's Range header to request the indicated range. start and end are interpreted as in a Range.

If you need to request multiple ranges, use soup_message_headers_set_ranges().

The function takes the following parameters:

  • start of the range to request.
  • end of the range to request.

func (*MessageHeaders) SetRanges

func (hdrs *MessageHeaders) SetRanges(ranges *Range, length int)

SetRanges sets hdrs's Range header to request the indicated ranges. (If you only want to request a single range, you can use soup_message_headers_set_range().).

The function takes the following parameters:

  • ranges: array of Range.
  • length of range.

type MessageHeadersForEachFunc

type MessageHeadersForEachFunc func(name, value string)

MessageHeadersForEachFunc: callback passed to soup_message_headers_foreach().

type MessageHeadersIter

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

MessageHeadersIter: opaque type used to iterate over a SoupMessageHeaders structure.

After intializing the iterator with soup_message_headers_iter_init(), call soup_message_headers_iter_next() to fetch data from it.

You may not modify the headers while iterating over them.

An instance of this type is always passed by reference.

func MessageHeadersIterInit

func MessageHeadersIterInit(hdrs *MessageHeaders) *MessageHeadersIter

MessageHeadersIterInit initializes iter for iterating hdrs.

The function takes the following parameters:

  • hdrs: SoupMessageHeaders.

The function returns the following values:

  • iter: pointer to a SoupMessageHeadersIter structure.

func (*MessageHeadersIter) Next

func (iter *MessageHeadersIter) Next() (name string, value string, ok bool)

Next yields the next name/value pair in the SoupMessageHeaders being iterated by iter. If iter has already yielded the last header, then soup_message_headers_iter_next() will return FALSE and name and value will be unchanged.

The function returns the following values:

  • name: pointer to a variable to return the header name in.
  • value: pointer to a variable to return the header value in.
  • ok: TRUE if another name and value were returned, FALSE if the end of the headers has been reached.

type MessageHeadersType

type MessageHeadersType C.gint

MessageHeadersType: value passed to soup_message_headers_new() to set certain default behaviors.

const (
	// MessageHeadersRequest: request headers.
	MessageHeadersRequest MessageHeadersType = iota
	// MessageHeadersResponse: response headers.
	MessageHeadersResponse
	// MessageHeadersMultipart: multipart body part headers.
	MessageHeadersMultipart
)

func (MessageHeadersType) String

func (m MessageHeadersType) String() string

String returns the name in string for MessageHeadersType.

type MessageOverrides

type MessageOverrides struct {
	Finished func()
	GotBody  func()
	// The function takes the following parameters:
	//
	GotChunk           func(chunk *Buffer)
	GotHeaders         func()
	GotInformational   func()
	Restarted          func()
	Starting           func()
	WroteBody          func()
	WroteChunk         func()
	WroteHeaders       func()
	WroteInformational func()
}

MessageOverrides contains methods that are overridable.

type MessagePriority

type MessagePriority C.gint

MessagePriority priorities that can be set on a Message to instruct the message queue to process it before any other message with lower priority.

const (
	// MessagePriorityVeryLow: lowest priority, the messages with this priority
	// will be the last ones to be attended.
	MessagePriorityVeryLow MessagePriority = iota
	// MessagePriorityLow: use this for low priority messages, a Message with
	// the default priority will be processed first.
	MessagePriorityLow
	// MessagePriorityNormal: default priotity, this is the priority assigned to
	// the Message by default.
	MessagePriorityNormal
	// MessagePriorityHigh: high priority, a Message with this priority will be
	// processed before the ones with the default priority.
	MessagePriorityHigh
	// MessagePriorityVeryHigh: highest priority, use this for very urgent
	// Message as they will be the first ones to be attended.
	MessagePriorityVeryHigh
)

func (MessagePriority) String

func (m MessagePriority) String() string

String returns the name in string for MessagePriority.

type Multipart

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

Multipart represents a multipart HTTP message body, parsed according to the syntax of RFC 2046. Of particular interest to HTTP are <literal>multipart/byte-ranges</literal> and <literal>multipart/form-data</literal>.

Although the headers of a Multipart 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 Multipart for handling real MIME multiparts.

An instance of this type is always passed by reference.

func NewMultipart

func NewMultipart(mimeType string) *Multipart

NewMultipart constructs a struct Multipart.

func NewMultipartFromMessage

func NewMultipartFromMessage(headers *MessageHeaders, body *MessageBody) *Multipart

NewMultipartFromMessage constructs a struct Multipart.

func (*Multipart) AppendFormFile

func (multipart *Multipart) AppendFormFile(controlName string, filename string, contentType string, body *Buffer)

AppendFormFile adds a new MIME part containing body to multipart, using "Content-Disposition: form-data", as per the HTML forms specification. See soup_form_request_new_from_multipart() for more details.

The function takes the following parameters:

  • controlName: name of the control associated with this file.
  • filename: name of the file, or NULL if not known.
  • contentType: MIME type of the file, or NULL if not known.
  • body: file data.

func (*Multipart) AppendFormString

func (multipart *Multipart) AppendFormString(controlName string, data string)

AppendFormString adds a new MIME part containing data to multipart, using "Content-Disposition: form-data", as per the HTML forms specification. See soup_form_request_new_from_multipart() for more details.

The function takes the following parameters:

  • controlName: name of the control associated with data.
  • data: body data.

func (*Multipart) AppendPart

func (multipart *Multipart) AppendPart(headers *MessageHeaders, body *Buffer)

AppendPart 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.).

The function takes the following parameters:

  • headers: MIME part headers.
  • body: MIME part body.

func (*Multipart) Length

func (multipart *Multipart) Length() int

Length gets the number of body parts in multipart.

The function returns the following values:

  • gint: number of body parts in multipart.

func (*Multipart) Part

func (multipart *Multipart) Part(part int) (*MessageHeaders, *Buffer, bool)

Part gets the indicated body part from multipart.

The function takes the following parameters:

  • part number to get (counting from 0).

The function returns the following values:

  • headers: return location for the MIME part headers.
  • body: return location for the MIME part body.
  • ok: TRUE on success, FALSE if part is out of range (in which case headers and body won't be set).

func (*Multipart) ToMessage

func (multipart *Multipart) ToMessage(destHeaders *MessageHeaders, destBody *MessageBody)

ToMessage serializes multipart to dest_headers and dest_body.

The function takes the following parameters:

  • destHeaders headers of the HTTP message to serialize multipart to.
  • destBody: body of the HTTP message to serialize multipart to.

type MultipartInputStream

type MultipartInputStream struct {
	gio.FilterInputStream

	*coreglib.Object
	gio.InputStream
	gio.PollableInputStream
	// contains filtered or unexported fields
}

func NewMultipartInputStream

func NewMultipartInputStream(msg *Message, baseStream gio.InputStreamer) *MultipartInputStream

NewMultipartInputStream creates a new MultipartInputStream that wraps the Stream obtained by sending the Request. Reads should not be done directly through this object, use the input streams returned by soup_multipart_input_stream_next_part() or its async counterpart instead.

The function takes the following parameters:

  • msg the response is related to.
  • baseStream returned by sending the request.

The function returns the following values:

  • multipartInputStream: new MultipartInputStream.

func (*MultipartInputStream) Headers

func (multipart *MultipartInputStream) Headers() *MessageHeaders

Headers obtains the headers for the part currently being processed. Note that the MessageHeaders that are returned are owned by the MultipartInputStream and will be replaced when a call is made to soup_multipart_input_stream_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 MessageHeaders will be returned.

The function returns the following values:

  • messageHeaders (optional) the headers for the part currently being processed or NULL if the headers failed to parse.

func (*MultipartInputStream) NextPart

func (multipart *MultipartInputStream) NextPart(ctx context.Context) (gio.InputStreamer, error)

NextPart obtains an input stream for the next part. When dealing with a multipart response the input stream needs to be wrapped in a MultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.

After calling this function, soup_multipart_input_stream_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.

The function takes the following parameters:

  • ctx (optional): #GCancellable.

The function returns the following values:

  • inputStream (optional): new Stream, or NULL if there are no more parts.

func (*MultipartInputStream) NextPartFinish

func (multipart *MultipartInputStream) NextPartFinish(result gio.AsyncResulter) (gio.InputStreamer, error)

NextPartFinish finishes an asynchronous request for the next part.

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • inputStream (optional): newly created Stream for reading the next part or NULL if there are no more parts.

type MultipartInputStreamClass

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

MultipartInputStreamClass: instance of this type is always passed by reference.

func (*MultipartInputStreamClass) ParentClass

func (m *MultipartInputStreamClass) ParentClass() *gio.FilterInputStreamClass

type MultipartInputStreamOverrides

type MultipartInputStreamOverrides struct {
}

MultipartInputStreamOverrides contains methods that are overridable.

type ProxyResolver

type ProxyResolver struct {
	SessionFeature
	// contains filtered or unexported fields
}

ProxyResolver wraps an interface. This means the user can get the underlying type by calling Cast().

func (*ProxyResolver) ProxyAsync

func (proxyResolver *ProxyResolver) ProxyAsync(ctx context.Context, msg *Message, asyncContext *glib.MainContext, callback ProxyResolverCallback)

ProxyAsync: deprecated: Use SoupProxyURIResolver.get_proxy_uri_async instead.

The function takes the following parameters:

  • ctx (optional)
  • msg
  • asyncContext
  • callback

func (*ProxyResolver) ProxySync

func (proxyResolver *ProxyResolver) ProxySync(ctx context.Context, msg *Message) (*Address, uint)

ProxySync: deprecated: Use SoupProxyURIResolver.get_proxy_uri_sync() instead.

The function takes the following parameters:

  • ctx (optional)
  • msg

The function returns the following values:

  • addr
  • guint

type ProxyResolverCallback

type ProxyResolverCallback func(proxyResolver ProxyResolverer, msg *Message, arg uint, addr *Address)

ProxyResolverCallback: deprecated: Use SoupProxyURIResolver instead.

type ProxyResolverDefault

type ProxyResolverDefault struct {
	*coreglib.Object

	ProxyURIResolver
	// contains filtered or unexported fields
}

type ProxyResolverDefaultClass

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

ProxyResolverDefaultClass: instance of this type is always passed by reference.

type ProxyResolverDefaultOverrides

type ProxyResolverDefaultOverrides struct {
}

ProxyResolverDefaultOverrides contains methods that are overridable.

type ProxyResolverInterface

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

ProxyResolverInterface: instance of this type is always passed by reference.

type ProxyResolverer

type ProxyResolverer interface {
	coreglib.Objector

	// ProxyAsync: deprecated: Use SoupProxyURIResolver.get_proxy_uri_async
	// instead.
	ProxyAsync(ctx context.Context, msg *Message, asyncContext *glib.MainContext, callback ProxyResolverCallback)
	// ProxySync: deprecated: Use SoupProxyURIResolver.get_proxy_uri_sync()
	// instead.
	ProxySync(ctx context.Context, msg *Message) (*Address, uint)
}

ProxyResolverer describes ProxyResolver's interface methods.

type ProxyURIResolver

type ProxyURIResolver struct {
	SessionFeature
	// contains filtered or unexported fields
}

ProxyURIResolver wraps an interface. This means the user can get the underlying type by calling Cast().

func (*ProxyURIResolver) ProxyUriAsync deprecated

func (proxyUriResolver *ProxyURIResolver) ProxyUriAsync(ctx context.Context, uri *URI, asyncContext *glib.MainContext, callback ProxyURIResolverCallback)

ProxyUriAsync: asynchronously determines a proxy URI to use for msg and calls callback.

Deprecated: ProxyURIResolver is deprecated in favor of Resolver.

The function takes the following parameters:

  • ctx (optional) or NULL.
  • uri you want a proxy for.
  • asyncContext (optional) to invoke callback in.
  • callback to invoke with the proxy address.

func (*ProxyURIResolver) ProxyUriSync deprecated

func (proxyUriResolver *ProxyURIResolver) ProxyUriSync(ctx context.Context, uri *URI) (*URI, uint)

ProxyUriSync: synchronously determines a proxy URI to use for uri. If uri should be sent via proxy, *proxy_uri will be set to the URI of the proxy, else it will be set to NULL.

Deprecated: ProxyURIResolver is deprecated in favor of Resolver.

The function takes the following parameters:

  • ctx (optional) or NULL.
  • uri you want a proxy for.

The function returns the following values:

  • proxyUri: on return, will contain the proxy URI.
  • guint: SOUP_STATUS_OK if successful, or a transport-level error.

type ProxyURIResolverCallback

type ProxyURIResolverCallback func(resolver ProxyURIResolverer, status uint, proxyUri *URI)

ProxyURIResolverCallback: callback for soup_proxy_uri_resolver_get_proxy_uri_async().

type ProxyURIResolverInterface

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

ProxyURIResolverInterface: instance of this type is always passed by reference.

type ProxyURIResolverer

type ProxyURIResolverer interface {
	coreglib.Objector

	// ProxyUriAsync: asynchronously determines a proxy URI to use for msg and
	// calls callback.
	ProxyUriAsync(ctx context.Context, uri *URI, asyncContext *glib.MainContext, callback ProxyURIResolverCallback)
	// ProxyUriSync: synchronously determines a proxy URI to use for uri.
	ProxyUriSync(ctx context.Context, uri *URI) (*URI, uint)
}

ProxyURIResolverer describes ProxyURIResolver's interface methods.

type Range

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

Range 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.)

An instance of this type is always passed by reference.

func NewRange

func NewRange(start, end int64) Range

NewRange creates a new Range instance from the given fields. Beware that this function allocates on the Go heap; be careful when using it!

func (*Range) End

func (r *Range) End() int64

End: end of the range.

func (*Range) SetEnd

func (r *Range) SetEnd(end int64)

End: end of the range.

func (*Range) SetStart

func (r *Range) SetStart(start int64)

Start: start of the range.

func (*Range) Start

func (r *Range) Start() int64

Start: start of the range.

type Request

type Request struct {
	*coreglib.Object

	gio.Initable
	// contains filtered or unexported fields
}

Request: request to retrieve a particular URI.

func (*Request) ContentLength

func (request *Request) ContentLength() int64

ContentLength gets the length of the data represented by request. For most request types, this will not be known until after you call soup_request_send() or soup_request_send_finish().

The function returns the following values:

  • gint64: length of the data represented by request, or -1 if not known.

func (*Request) ContentType

func (request *Request) ContentType() string

ContentType gets the type of the data represented by request. For most request types, this will not be known until after you call soup_request_send() or soup_request_send_finish().

As in the HTTP Content-Type header, this may include parameters after the MIME type.

The function returns the following values:

  • utf8 (optional): type of the data represented by request, or NULL if not known.

func (*Request) Send

func (request *Request) Send(ctx context.Context) (gio.InputStreamer, error)

Send: synchronously requests the URI pointed to by request, and returns a Stream that can be used to read its contents.

Note that you cannot use this method with Requests attached to a SessionAsync.

The function takes the following parameters:

  • ctx (optional) or NULL.

The function returns the following values:

  • inputStream that can be used to read from the URI pointed to by request.

func (*Request) SendFinish

func (request *Request) SendFinish(result gio.AsyncResulter) (gio.InputStreamer, error)

SendFinish gets the result of a soup_request_send_async().

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • inputStream that can be used to read from the URI pointed to by request.

func (*Request) Session

func (request *Request) Session() *Session

Session gets request's Session.

The function returns the following values:

  • session request's Session.

func (*Request) URI

func (request *Request) URI() *URI

URI gets request's URI.

The function returns the following values:

  • urI request's URI.

type RequestClass

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

RequestClass: instance of this type is always passed by reference.

type RequestData

type RequestData struct {
	Request
	// contains filtered or unexported fields
}

type RequestDataClass

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

RequestDataClass: instance of this type is always passed by reference.

func (*RequestDataClass) Parent

func (r *RequestDataClass) Parent() *RequestClass

type RequestDataOverrides

type RequestDataOverrides struct {
}

RequestDataOverrides contains methods that are overridable.

type RequestError

type RequestError C.gint

RequestError: Request error.

const (
	// RequestErrorBadURI: URI could not be parsed.
	RequestErrorBadURI RequestError = iota
	// RequestErrorUnsupportedURIScheme: URI scheme is not supported by this
	// Session.
	RequestErrorUnsupportedURIScheme
	// RequestErrorParsing server's response could not be parsed.
	RequestErrorParsing
	// RequestErrorEncoding server's response was in an unsupported format.
	RequestErrorEncoding
)

func (RequestError) String

func (r RequestError) String() string

String returns the name in string for RequestError.

type RequestFile

type RequestFile struct {
	Request
	// contains filtered or unexported fields
}

func (*RequestFile) File

func (file *RequestFile) File() *gio.File

File gets a #GFile corresponding to file's URI.

The function returns the following values:

  • ret corresponding to file.

type RequestFileClass

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

RequestFileClass: instance of this type is always passed by reference.

func (*RequestFileClass) Parent

func (r *RequestFileClass) Parent() *RequestClass

type RequestFileOverrides

type RequestFileOverrides struct {
}

RequestFileOverrides contains methods that are overridable.

type RequestHTTP

type RequestHTTP struct {
	Request
	// contains filtered or unexported fields
}

func (*RequestHTTP) Message

func (http *RequestHTTP) Message() *Message

Message gets a new reference to the Message associated to this SoupRequest.

The function returns the following values:

  • message: new reference to the Message.

type RequestHTTPClass

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

RequestHTTPClass: instance of this type is always passed by reference.

func (*RequestHTTPClass) Parent

func (r *RequestHTTPClass) Parent() *RequestClass

type RequestHTTPOverrides

type RequestHTTPOverrides struct {
}

RequestHTTPOverrides contains methods that are overridable.

type RequestOverrides

type RequestOverrides struct {
	// The function takes the following parameters:
	//
	CheckURI func(uri *URI) error
	// ContentLength gets the length of the data represented by request.
	// For most request types, this will not be known until after you call
	// soup_request_send() or soup_request_send_finish().
	//
	// The function returns the following values:
	//
	//   - gint64: length of the data represented by request, or -1 if not
	//     known.
	//
	ContentLength func() int64
	// ContentType gets the type of the data represented by request.
	// For most request types, this will not be known until after you call
	// soup_request_send() or soup_request_send_finish().
	//
	// As in the HTTP Content-Type header, this may include parameters after the
	// MIME type.
	//
	// The function returns the following values:
	//
	//   - utf8 (optional): type of the data represented by request, or NULL if
	//     not known.
	//
	ContentType func() string
	// Send: synchronously requests the URI pointed to by request, and returns a
	// Stream that can be used to read its contents.
	//
	// Note that you cannot use this method with Requests attached to a
	// SessionAsync.
	//
	// The function takes the following parameters:
	//
	//   - ctx (optional) or NULL.
	//
	// The function returns the following values:
	//
	//   - inputStream that can be used to read from the URI pointed to by
	//     request.
	//
	Send func(ctx context.Context) (gio.InputStreamer, error)
	// SendFinish gets the result of a soup_request_send_async().
	//
	// The function takes the following parameters:
	//
	//   - result: Result.
	//
	// The function returns the following values:
	//
	//   - inputStream that can be used to read from the URI pointed to by
	//     request.
	//
	SendFinish func(result gio.AsyncResulter) (gio.InputStreamer, error)
}

RequestOverrides contains methods that are overridable.

type RequesterError

type RequesterError C.gint
const (
	RequesterErrorBadURI RequesterError = iota
	RequesterErrorUnsupportedURIScheme
)

func (RequesterError) String

func (r RequesterError) String() string

String returns the name in string for RequesterError.

type SameSitePolicy

type SameSitePolicy C.gint
const (
	// SameSitePolicyNone: cookie is exposed with both cross-site and same-site
	// requests.
	SameSitePolicyNone SameSitePolicy = iota
	// SameSitePolicyLax: cookie is withheld on cross-site requests but exposed
	// on cross-site navigations.
	SameSitePolicyLax
	// SameSitePolicyStrict: cookie is only exposed for same-site requests.
	SameSitePolicyStrict
)

func (SameSitePolicy) String

func (s SameSitePolicy) String() string

String returns the name in string for SameSitePolicy.

type Server

type Server struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func (*Server) AcceptIostream

func (server *Server) AcceptIostream(stream gio.IOStreamer, localAddr, remoteAddr gio.SocketAddresser) error

AcceptIostream: add a new client stream to the server.

The function takes the following parameters:

  • stream: OStream.
  • localAddr (optional): local Address associated with the stream.
  • remoteAddr (optional): remote Address associated with the stream.

func (*Server) AddAuthDomain

func (server *Server) AddAuthDomain(authDomain AuthDomainer)

AddAuthDomain 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 "100-continue" Expectation, server will reject it before the request body is sent.

The function takes the following parameters:

  • authDomain: AuthDomain.

func (*Server) AddEarlyHandler

func (server *Server) AddEarlyHandler(path string, callback ServerCallback)

AddEarlyHandler adds an "early" handler to server for requests under 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 AuthDomain or a signal handler), callback will be invoked after receiving the request headers, but before receiving the request body; the message's Message:method and Message:request-headers fields will be filled in.

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 soup_message_body_set_accumulate() on the message's Message:request-body to turn off request-body accumulation, and connect to the message's Message::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 Message::got-body, or else you can register a non-early handler for path as well. As long as you have not set the Message:status-code by the time Message::got-body is emitted, the non-early handler will be run as well.

The function takes the following parameters:

  • path (optional): toplevel path for the handler.
  • callback to invoke for requests under path.

func (*Server) AddHandler

func (server *Server) AddHandler(path string, callback ServerCallback)

AddHandler adds a handler to server for requests under 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 AuthDomain, an early ServerHandler, or a signal handler), callback will be invoked after receiving the request body; the message's Message:method, Message:request-headers, and Message:request-body fields will be filled in.

After determining what to do with the request, the callback must at a minimum call soup_message_set_status() (or soup_message_set_status_full()) 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 soup_server_pause_message() to tell server to not send the response right away. When the response is ready, call soup_server_unpause_message() to cause it to be sent.

To send the response body a bit at a time using "chunked" encoding, first call soup_message_headers_set_encoding() to set SOUP_ENCODING_CHUNKED on the Message:response-headers. Then call soup_message_body_append() (or soup_message_body_append_buffer()) to append each chunk as it becomes ready, and soup_server_unpause_message() 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 soup_message_body_complete() to indicate that no more chunks are coming.

The function takes the following parameters:

  • path (optional): toplevel path for the handler.
  • callback to invoke for requests under path.

func (*Server) AddWebsocketExtension

func (server *Server) AddWebsocketExtension(extensionType coreglib.Type)

AddWebsocketExtension: add support for a WebSocket extension of the given extension_type. When a WebSocket client requests an extension of extension_type, a new WebsocketExtension of type extension_type will be created to handle the request.

You can also add support for a WebSocket extension to the server at construct time by using the SOUP_SERVER_ADD_WEBSOCKET_EXTENSION property. Note that WebsocketExtensionDeflate is supported by default, use soup_server_remove_websocket_extension() if you want to disable it.

The function takes the following parameters:

  • extensionType: #GType.

func (*Server) AddWebsocketHandler

func (server *Server) AddWebsocketHandler(path, origin string, protocols []string, callback ServerWebsocketCallback)

AddWebsocketHandler adds a WebSocket handler to server for requests under 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 (possibly calling soup_server_check_websocket_handshake() one or more times), and setting a failure status code if the handshake should be rejected.

The function takes the following parameters:

  • path (optional): toplevel path for the handler.
  • origin (optional) of the connection.
  • protocols (optional): protocols supported by this handler.
  • callback to invoke for successful WebSocket requests under path.

func (*Server) AsyncContext deprecated

func (server *Server) AsyncContext() *glib.MainContext

AsyncContext gets server's async_context, if you are using the old API. (With the new API, the server runs in the thread's thread-default Context, regardless of what this method returns.)

This does not add a ref to the context, so you will need to ref it yourself if you want it to outlive its server.

Deprecated: If you are using soup_server_listen(), etc, then the server listens on the thread-default Context, and this property is ignored.

The function returns the following values:

  • mainContext (optional) server's Context, which may be NULL.

func (*Server) ConnectRequestAborted

func (server *Server) ConnectRequestAborted(f func(message *Message, client *ClientContext)) coreglib.SignalHandle

ConnectRequestAborted is emitted when processing has failed for a message; this could mean either that it could not be read (if Server::request_read has not been emitted for it yet), or that the response could not be written back (if Server::request_read has been emitted but 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 Server::request_started.

func (*Server) ConnectRequestFinished

func (server *Server) ConnectRequestFinished(f func(message *Message, client *ClientContext)) coreglib.SignalHandle

ConnectRequestFinished is emitted when the server has finished writing a response to a request.

func (*Server) ConnectRequestRead

func (server *Server) ConnectRequestRead(f func(message *Message, client *ClientContext)) coreglib.SignalHandle

ConnectRequestRead is 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 (server *Server) ConnectRequestStarted(f func(message *Message, client *ClientContext)) coreglib.SignalHandle

ConnectRequestStarted is 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 Server::request_read signal. If a response is then sent, the request processing will end with a Server::request_finished signal. If a network error occurs, the processing will instead end with Server::request_aborted.

func (*Server) Disconnect

func (server *Server) Disconnect()

Disconnect closes and frees server's listening sockets. If you are using the old Server APIs, this also includes the effect of soup_server_quit().

Note that if there are currently requests in progress on server, that they will continue to be processed if server's Context is still running.

You can call soup_server_listen(), etc, after calling this function if you want to start listening again.

func (*Server) IsHTTPS

func (server *Server) IsHTTPS() bool

IsHTTPS checks whether server is capable of https.

In order for a server to run https, you must call soup_server_set_ssl_cert_file(), or set the 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 Server serves https exclusively. If you are using soup_server_listen(), etc, then a TRUE return value merely indicates that the server is <emphasis>able</emphasis> to do https, regardless of whether it actually currently is or not. Use soup_server_get_uris() to see if it currently has any https listeners.

The function returns the following values:

  • ok: TRUE if server is configured to serve https.

func (*Server) Listen

func (server *Server) Listen(address gio.SocketAddresser, options ServerListenOptions) error

Listen: this 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 Context is run.

Note that Server never makes use of dual IPv4/IPv6 sockets; if address is an IPv6 address, it will only accept IPv6 connections. You must configure IPv4 listening separately.

The function takes the following parameters:

  • address of the interface to listen on.
  • options: listening options for this server.

func (*Server) ListenAll

func (server *Server) ListenAll(port uint, options ServerListenOptions) error

ListenAll: this attempts to set up server to listen for connections on all interfaces on the system. (That is, it listens on the addresses <literal>0.0.0.0</literal> and/or <literal>::</literal>, 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 soup_server_get_uris() to find out what port it ended up choosing.)

See soup_server_listen() for more details.

The function takes the following parameters:

  • port to listen on, or 0.
  • options: listening options for this server.

func (*Server) ListenFd

func (server *Server) ListenFd(fd int, options ServerListenOptions) error

ListenFd: this attempts to set up server to listen for connections on fd.

See soup_server_listen() for more details.

Note that server will close fd when you free it or call soup_server_disconnect().

The function takes the following parameters:

  • fd: file descriptor of a listening socket.
  • options: listening options for this server.

func (*Server) ListenLocal

func (server *Server) ListenLocal(port uint, options ServerListenOptions) error

ListenLocal: this attempts to set up server to listen for connections on "localhost" (that is, <literal>127.0.0.1</literal> and/or <literal>::1</literal>, 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 soup_server_get_uris() to find out what port it ended up choosing.)

See soup_server_listen() for more details.

The function takes the following parameters:

  • port to listen on, or 0.
  • options: listening options for this server.

func (*Server) ListenSocket

func (server *Server) ListenSocket(socket *gio.Socket, options ServerListenOptions) error

ListenSocket: this attempts to set up server to listen for connections on socket.

See soup_server_listen() for more details.

The function takes the following parameters:

  • socket: listening #GSocket.
  • options: listening options for this server.

func (*Server) Listener deprecated

func (server *Server) Listener() *Socket

Listener gets server's listening socket, if you are using the old API.

You should treat this socket as read-only; writing to it or modifiying it may cause server to malfunction.

Deprecated: If you are using soup_server_listen(), etc, then use soup_server_get_listeners() to get a list of all listening sockets, but note that that function returns #GSockets, not Sockets.

The function returns the following values:

  • socket: listening socket.

func (*Server) Listeners

func (server *Server) Listeners() []*gio.Socket

Listeners 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.

(Beware that in contrast to the old soup_server_get_listener(), this function returns #GSockets, not Sockets.).

The function returns the following values:

  • sList: a list of listening sockets.

func (*Server) PauseMessage

func (server *Server) PauseMessage(msg *Message)

PauseMessage 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 soup_server_unpause_message() to resume I/O.

This must only be called on Messages which were created by the Server and are currently doing I/O, such as those passed into a ServerCallback or emitted in a Server::request-read signal.

The function takes the following parameters:

  • msg associated with server.

func (*Server) Port deprecated

func (server *Server) Port() uint

Port gets the TCP port that server is listening on, if you are using the old API.

Deprecated: If you are using soup_server_listen(), etc, then use soup_server_get_uris() to get a list of all listening addresses.

The function returns the following values:

  • guint: port server is listening on.

func (*Server) Quit deprecated

func (server *Server) Quit()

Quit stops processing for server, if you are using the old API. Call this to clean up after soup_server_run_async(), or to terminate a call to soup_server_run().

Note that messages currently in progress will continue to be handled, if the main loop associated with the server is resumed or kept running.

server is still in a working state after this call; you can start and stop a server as many times as you want.

Deprecated: When using soup_server_listen(), etc, the server will always listen for connections, and will process them whenever the thread-default Context is running.

func (*Server) RemoveAuthDomain

func (server *Server) RemoveAuthDomain(authDomain AuthDomainer)

RemoveAuthDomain removes auth_domain from server.

The function takes the following parameters:

  • authDomain: AuthDomain.

func (*Server) RemoveHandler

func (server *Server) RemoveHandler(path string)

RemoveHandler removes all handlers (early and normal) registered at path.

The function takes the following parameters:

  • path: toplevel path for the handler.

func (*Server) RemoveWebsocketExtension

func (server *Server) RemoveWebsocketExtension(extensionType coreglib.Type)

RemoveWebsocketExtension removes support for WebSocket extension of type extension_type (or any subclass of extension_type) from server. You can also remove extensions enabled by default from the server at construct time by using the SOUP_SERVER_REMOVE_WEBSOCKET_EXTENSION property.

The function takes the following parameters:

  • extensionType: #GType.

func (*Server) Run deprecated

func (server *Server) Run()

Run starts server, if you are using the old API, causing it to listen for and process incoming connections. Unlike soup_server_run_async(), this creates a Loop and runs it, and it will not return until someone calls soup_server_quit() to stop the server.

Deprecated: When using soup_server_listen(), etc, the server will always listen for connections, and will process them whenever the thread-default Context is running.

func (*Server) RunAsync deprecated

func (server *Server) RunAsync()

RunAsync starts server, if you are using the old API, causing it to listen for and process incoming connections.

The server runs in server's Context. It will not actually perform any processing unless the appropriate main loop is running. In the simple case where you did not set the server's SOUP_SERVER_ASYNC_CONTEXT property, this means the server will run whenever the glib main loop is running.

Deprecated: When using soup_server_listen(), etc, the server will always listen for connections, and will process them whenever the thread-default Context is running.

func (*Server) SetSSLCertFile

func (server *Server) SetSSLCertFile(sslCertFile, sslKeyFile string) error

SetSSLCertFile sets server up to do https, using the SSL/TLS certificate specified by ssl_cert_file and ssl_key_file (which may point to the same file).

Alternatively, you can set the Server:tls-certificate property at construction time, if you already have a Certificate.

The function takes the following parameters:

  • sslCertFile: path to a file containing a PEM-encoded SSL/TLS certificate.
  • sslKeyFile: path to a file containing a PEM-encoded private key.

func (*Server) URIs

func (server *Server) URIs() []*URI

URIs 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 soup_server_listen_all(), the returned URIs will use the addresses <literal>0.0.0.0</literal> and <literal>::</literal>, rather than actually returning separate URIs for each interface on the system.

The function returns the following values:

  • sList: list of URIs, which you must free when you are done with it.

func (*Server) UnpauseMessage

func (server *Server) UnpauseMessage(msg *Message)

UnpauseMessage resumes I/O on msg. Use this to resume after calling soup_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 Messages which were created by the Server and are currently doing I/O, such as those passed into a ServerCallback or emitted in a Server::request-read signal.

The function takes the following parameters:

  • msg associated with server.

type ServerCallback

type ServerCallback func(server *Server, msg *Message, path string, query map[string]string, client *ClientContext)

ServerCallback: callback used to handle requests to a Server.

path and query contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, 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 SOUP_SERVER_RAW_PATHS property when creating the Server, and it will leave those characters undecoded. (You may want to call soup_uri_normalize() to decode any percent-encoded characters that you aren't handling specially.)

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 soup_message_get_uri() and parse the URI's query field yourself.

See soup_server_add_handler() and soup_server_add_early_handler() for details of what handlers can/should do.

type ServerClass

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

ServerClass: instance of this type is always passed by reference.

type ServerListenOptions

type ServerListenOptions C.guint

ServerListenOptions options to pass to soup_server_listen(), etc.

SOUP_SERVER_LISTEN_IPV4_ONLY and SOUP_SERVER_LISTEN_IPV6_ONLY only make sense with soup_server_listen_all() and soup_server_listen_local(), not plain soup_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 (
	// ServerListenHTTPS: listen for https connections rather than plain http.
	ServerListenHTTPS ServerListenOptions = 0b1
	// ServerListenIPv4Only: only listen on IPv4 interfaces.
	ServerListenIPv4Only ServerListenOptions = 0b10
	// ServerListenIPv6Only: only listen on IPv6 interfaces.
	ServerListenIPv6Only ServerListenOptions = 0b100
)

func (ServerListenOptions) Has

Has returns true if s contains other.

func (ServerListenOptions) String

func (s ServerListenOptions) String() string

String returns the names in string for ServerListenOptions.

type ServerOverrides

type ServerOverrides struct {
	// The function takes the following parameters:
	//
	//   - msg
	//   - client
	//
	RequestAborted func(msg *Message, client *ClientContext)
	// The function takes the following parameters:
	//
	//   - msg
	//   - client
	//
	RequestFinished func(msg *Message, client *ClientContext)
	// The function takes the following parameters:
	//
	//   - msg
	//   - client
	//
	RequestRead func(msg *Message, client *ClientContext)
	// The function takes the following parameters:
	//
	//   - msg
	//   - client
	//
	RequestStarted func(msg *Message, client *ClientContext)
}

ServerOverrides contains methods that are overridable.

type ServerWebsocketCallback

type ServerWebsocketCallback func(server *Server, connection *WebsocketConnection, path string, client *ClientContext)

ServerWebsocketCallback: callback used to handle WebSocket requests to a Server. 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 ServerCallback (qv).

type Session

type Session struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewSession

func NewSession() *Session

NewSession creates a Session with the default options.

The function returns the following values:

  • session: new session.

func (*Session) Abort

func (session *Session) Abort()

Abort cancels all pending requests in session and closes all idle persistent connections.

The message cancellation has the same semantics as with soup_session_cancel_message(); asynchronous requests on a SessionAsync will have their callback called before soup_session_abort() returns. Requests on a plain Session will not.

func (*Session) AddFeature

func (session *Session) AddFeature(feature SessionFeaturer)

AddFeature adds feature's functionality to session. You can also add a feature to the session at construct time by using the SOUP_SESSION_ADD_FEATURE property.

See the main Session documentation for information on what features are present in sessions by default.

The function takes the following parameters:

  • feature: object that implements SessionFeature.

func (*Session) AddFeatureByType

func (session *Session) AddFeatureByType(featureType coreglib.Type)

AddFeatureByType: if feature_type is the type of a class that implements SessionFeature, this creates a new feature of that type and adds it to session as with soup_session_add_feature(). You can use this when you don't need to customize the new feature in any way.

If feature_type is not a 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 Auth or Request types, for instance.

You can also add a feature to the session at construct time by using the SOUP_SESSION_ADD_FEATURE_BY_TYPE property.

See the main Session documentation for information on what features are present in sessions by default.

The function takes the following parameters:

  • featureType: #GType.

func (*Session) AsyncContext

func (session *Session) AsyncContext() *glib.MainContext

AsyncContext gets session's Session:async-context. This does not add a ref to the context, so you will need to ref it yourself if you want it to outlive its session.

For a modern Session, this will always just return the thread-default Context, and so is not especially useful.

The function returns the following values:

  • mainContext (optional) session's Context, which may be NULL.

func (*Session) CancelMessage

func (session *Session) CancelMessage(msg *Message, statusCode uint)

CancelMessage causes session to immediately finish processing msg (regardless of its current state) with a final status_code of status_code. You may call this at any time after handing msg off to session; if session has started sending the request but has not yet received the complete response, then it will close the request's connection. Note that with requests that have side effects (eg, <literal>POST</literal>, <literal>PUT</literal>, <literal>DELETE</literal>) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If the message is cancelled while its response body is being read, then the response body in msg will be left partially-filled-in. The response headers, on the other hand, will always be either empty or complete.

Beware that with the deprecated SessionAsync, messages queued with soup_session_queue_message() will have their callbacks invoked before soup_session_cancel_message() returns. The plain Session does not have this behavior; cancelling an asynchronous message will merely queue its callback to be run after returning to the main loop.

The function takes the following parameters:

  • msg: message to cancel.
  • statusCode status code to set on msg (generally SOUP_STATUS_CANCELLED).

func (*Session) ConnectAuthenticate

func (session *Session) ConnectAuthenticate(f func(msg *Message, auth Auther, retrying bool)) coreglib.SignalHandle

ConnectAuthenticate is emitted when the session requires authentication. If credentials are available call soup_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 soup_auth_authenticate() on auth.

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

If you call soup_session_pause_message() on msg before returning, then you can authenticate auth asynchronously (as long as you g_object_ref() it to make sure it doesn't get destroyed), and then unpause msg when you are ready for it to continue.

func (*Session) ConnectConnectionCreated

func (session *Session) ConnectConnectionCreated(f func(connection *coreglib.Object)) coreglib.SignalHandle

ConnectConnectionCreated is emitted when a new connection is created. This is an internal signal intended only to be used for debugging purposes, and may go away in the future.

func (*Session) ConnectFinish

func (session *Session) ConnectFinish(result gio.AsyncResulter) (gio.IOStreamer, error)

ConnectFinish gets the OStream created for the connection to communicate with the server.

The function takes the following parameters:

  • result passed to your callback.

The function returns the following values:

  • ioStream: new OStream, or NULL on error.

func (*Session) ConnectRequestQueued

func (session *Session) ConnectRequestQueued(f func(msg *Message)) coreglib.SignalHandle

ConnectRequestQueued is emitted when a request is queued on session. (Note that "queued" doesn't just mean soup_session_queue_message(); soup_session_send_message() implicitly queues the message as well.)

When sending a request, first Session::request_queued is emitted, indicating that the session has become aware of the request.

Once a connection is available to send the request on, the session emits Session::request_started. Then, various Message signals are emitted as the message is processed. If the message is requeued, it will emit Message::restarted, which will then be followed by another Session::request_started and another set of Message signals when the message is re-sent.

Eventually, the message will emit 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 (or equivalently, from the soup_session_queue_message() callback). In that case, the process will loop back to Session::request_started.

Eventually, a message will reach "finished" and not be requeued. At that point, the session will emit Session::request_unqueued to indicate that it is done with the message.

To sum up: Session::request_queued and Session::request_unqueued are guaranteed to be emitted exactly once, but Session::request_started and Message::finished (and all of the other Message signals) may be invoked multiple times for a given message.

func (*Session) ConnectRequestStarted

func (session *Session) ConnectRequestStarted(f func(msg *Message, socket *Socket)) coreglib.SignalHandle

ConnectRequestStarted is emitted just before a request is sent. See Session::request_queued for a detailed description of the message lifecycle within a session.

func (*Session) ConnectRequestUnqueued

func (session *Session) ConnectRequestUnqueued(f func(msg *Message)) coreglib.SignalHandle

ConnectRequestUnqueued is emitted when a request is removed from session's queue, indicating that session is done with it. See Session::request_queued for a detailed description of the message lifecycle within a session.

func (*Session) ConnectTunneling

func (session *Session) ConnectTunneling(f func(connection *coreglib.Object)) coreglib.SignalHandle

ConnectTunneling is emitted when an SSL tunnel is being created on a proxy connection. This is an internal signal intended only to be used for debugging purposes, and may go away in the future.

func (*Session) Feature

func (session *Session) Feature(featureType coreglib.Type) *SessionFeature

Feature gets the first feature in session of type feature_type. For features where there may be more than one feature of a given type, use soup_session_get_features().

The function takes the following parameters:

  • featureType of the feature to get.

The function returns the following values:

  • sessionFeature (optional) or NULL. The feature is owned by session.

func (*Session) FeatureForMessage

func (session *Session) FeatureForMessage(featureType coreglib.Type, msg *Message) *SessionFeature

FeatureForMessage gets the first feature in session of type feature_type, provided that it is not disabled for msg. As with soup_session_get_feature(), this should only be used for features where feature_type is only expected to match a single feature. In particular, if there are two matching features, and the first is disabled on msg, and the second is not, then this will return NULL, not the second feature.

The function takes the following parameters:

  • featureType of the feature to get.
  • msg: Message.

The function returns the following values:

  • sessionFeature (optional) or NULL. The feature is owned by session.

func (*Session) Features

func (session *Session) Features(featureType coreglib.Type) []*SessionFeature

Features generates a list of session's features of type feature_type. (If you want to see all features, you can pass SOUP_TYPE_SESSION_FEATURE for feature_type.).

The function takes the following parameters:

  • featureType of the class of features to get.

The function returns the following values:

  • sList: a list of features. You must free the list, but not its contents.

func (*Session) HasFeature

func (session *Session) HasFeature(featureType coreglib.Type) bool

HasFeature tests if session has at a feature of type feature_type (which can be the type of either a SessionFeature, or else a subtype of some class managed by another feature, such as Auth or Request).

The function takes the following parameters:

  • featureType of the class of features to check for.

The function returns the following values:

  • ok: TRUE or FALSE.

func (*Session) PauseMessage

func (session *Session) PauseMessage(msg *Message)

PauseMessage pauses HTTP I/O on msg. Call soup_session_unpause_message() to resume I/O.

This may only be called for asynchronous messages (those sent on a SessionAsync or using soup_session_queue_message()).

The function takes the following parameters:

  • msg currently running on session.

func (*Session) PrefetchDns

func (session *Session) PrefetchDns(ctx context.Context, hostname string, callback AddressCallback)

PrefetchDns tells session that an URI from the given hostname may be requested shortly, and so the session can try to prepare by resolving the domain name in advance, in order to work more quickly once the URI is actually requested.

If cancellable is non-NULL, it can be used to cancel the resolution. callback will still be invoked in this case, with a status of SOUP_STATUS_CANCELLED.

The function takes the following parameters:

  • ctx (optional) object, or NULL.
  • hostname to be resolved.
  • callback (optional) to call with the result, or NULL.

func (*Session) PrepareForURI deprecated

func (session *Session) PrepareForURI(uri *URI)

PrepareForURI tells session that uri may be requested shortly, and so the session can try to prepare (resolving the domain name, obtaining proxy address, etc.) in order to work more quickly once the URI is actually requested.

Deprecated: use soup_session_prefetch_dns() instead.

The function takes the following parameters:

  • uri which may be required.

func (*Session) QueueMessage

func (session *Session) QueueMessage(msg *Message, callback SessionCallback)

QueueMessage queues the message msg for asynchronously sending the request and receiving a response in the current thread-default Context. If msg has been processed before, any resources related to the time it was last sent are freed.

Upon message completion, the callback specified in callback will be invoked. If after returning from this callback the message has not been requeued, msg will be unreffed.

(The behavior above applies to a plain Session; if you are using SessionAsync or SessionSync, then the Context that is used depends on the settings of Session:async-context and Session:use-thread-context, and for SessionSync, the message will actually be sent and processed in another thread, with only the final callback occurring in the indicated Context.)

Contrast this method with soup_session_send_async(), which also asynchronously sends a message, but returns before reading the response body, and allows you to read the response via a Stream.

The function takes the following parameters:

  • msg: message to queue.
  • callback (optional) which will be called after the message completes or when an unrecoverable error occurs.

func (*Session) RedirectMessage

func (session *Session) RedirectMessage(msg *Message) bool

RedirectMessage updates msg's URI according to its status code and "Location" header, and requeues it on session. Use this when you have set SOUP_MESSAGE_NO_REDIRECT on a message, but have decided to allow a particular redirection to occur, or if you want to allow a redirection that Session will not perform automatically (eg, redirecting a non-safe method such as DELETE).

If msg's status code indicates that it should be retried as a GET request, then msg will be modified accordingly.

If msg has already been redirected too many times, this will cause it to fail with SOUP_STATUS_TOO_MANY_REDIRECTS.

The function takes the following parameters:

  • msg that has received a 3xx response.

The function returns the following values:

  • ok: TRUE if a redirection was applied, FALSE if not (eg, because there was no Location header, or it could not be parsed).

func (*Session) RemoveFeature

func (session *Session) RemoveFeature(feature SessionFeaturer)

RemoveFeature removes feature's functionality from session.

The function takes the following parameters:

  • feature that has previously been added to session.

func (*Session) RemoveFeatureByType

func (session *Session) RemoveFeatureByType(featureType coreglib.Type)

RemoveFeatureByType removes all features of type feature_type (or any subclass of feature_type) from session. You can also remove standard features from the session at construct time by using the SOUP_SESSION_REMOVE_FEATURE_BY_TYPE property.

The function takes the following parameters:

  • featureType: #GType.

func (*Session) Request

func (session *Session) Request(uriString string) (*Request, error)

Request creates a Request for retrieving uri_string.

The function takes the following parameters:

  • uriString: URI, in string form.

The function returns the following values:

  • request: new Request, or NULL on error.

func (*Session) RequestHTTP

func (session *Session) RequestHTTP(method, uriString string) (*RequestHTTP, error)

RequestHTTP creates a Request for retrieving uri_string, which must be an "http" or "https" URI (or another protocol listed in session's Session:http-aliases or Session:https-aliases).

The function takes the following parameters:

  • method: HTTP method.
  • uriString: URI, in string form.

The function returns the following values:

  • requestHTTP: new RequestHTTP, or NULL on error.

func (*Session) RequestHTTPURI

func (session *Session) RequestHTTPURI(method string, uri *URI) (*RequestHTTP, error)

RequestHTTPURI creates a Request for retrieving uri, which must be an "http" or "https" URI (or another protocol listed in session's Session:http-aliases or Session:https-aliases).

The function takes the following parameters:

  • method: HTTP method.
  • uri representing the URI to retrieve.

The function returns the following values:

  • requestHTTP: new RequestHTTP, or NULL on error.

func (*Session) RequestURI

func (session *Session) RequestURI(uri *URI) (*Request, error)

RequestURI creates a Request for retrieving uri.

The function takes the following parameters:

  • uri representing the URI to retrieve.

The function returns the following values:

  • request: new Request, or NULL on error.

func (*Session) RequeueMessage

func (session *Session) RequeueMessage(msg *Message)

RequeueMessage: this causes msg to be placed back on the queue to be attempted again.

The function takes the following parameters:

  • msg: message to requeue.

func (*Session) Send

func (session *Session) Send(ctx context.Context, msg *Message) (gio.InputStreamer, error)

Send: synchronously sends msg and waits for the beginning of a response. On success, a Stream 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; soup_session_send() will return a G_IO_ERROR_CANCELLED error. Note that with requests that have side effects (eg, <literal>POST</literal>, <literal>PUT</literal>, <literal>DELETE</literal>) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If msg is requeued due to a redirect or authentication, the initial (3xx/401/407) response body will be suppressed, and soup_session_send() will only return once a final response has been received.

Contrast this method with soup_session_send_message(), which also synchronously sends a Message, but doesn't return until the response has been completely read.

(Note that this method cannot be called on the deprecated SessionAsync subclass.).

The function takes the following parameters:

  • ctx (optional): #GCancellable.
  • msg: Message.

The function returns the following values:

  • inputStream for reading the response body, or NULL on error.

func (*Session) SendFinish

func (session *Session) SendFinish(result gio.AsyncResulter) (gio.InputStreamer, error)

SendFinish gets the response to a soup_session_send_async() call and (if successful), returns a Stream that can be used to read the response body.

The function takes the following parameters:

  • result passed to your callback.

The function returns the following values:

  • inputStream for reading the response body, or NULL on error.

func (*Session) SendMessage

func (session *Session) SendMessage(msg *Message) uint

SendMessage: synchronously send msg. This call will not return until the transfer is finished successfully or there is an unrecoverable error.

Unlike with soup_session_queue_message(), msg is not freed upon return.

(Note that if you call this method on a SessionAsync, it will still use asynchronous I/O internally, running the glib main loop to process the message, which may also cause other events to be processed.)

Contrast this method with soup_session_send(), which also synchronously sends a message, but returns before reading the response body, and allows you to read the response via a Stream.

The function takes the following parameters:

  • msg: message to send.

The function returns the following values:

  • guint: HTTP status code of the response.

func (*Session) StealConnection

func (session *Session) StealConnection(msg *Message) gio.IOStreamer

StealConnection: "Steals" the HTTP connection associated with msg from session. This happens immediately, regardless of the current state of the connection, and msg's callback will not be called. You can steal the connection from a Message signal handler if you need to wait for part or all of the response to be received first.

Calling this function may cause msg to be freed if you are not holding any other reference to it.

The function takes the following parameters:

  • msg: message whose connection is to be stolen.

The function returns the following values:

  • ioStream formerly associated with msg (or NULL if msg was no longer associated with a connection). No guarantees are made about what kind of OStream is returned.

func (*Session) UnpauseMessage

func (session *Session) UnpauseMessage(msg *Message)

UnpauseMessage resumes HTTP I/O on msg. Use this to resume after calling soup_session_pause_message().

If msg is being sent via blocking I/O, this will resume reading or writing immediately. If msg is using non-blocking I/O, then reading or writing won't resume until you return to the main loop.

This may only be called for asynchronous messages (those sent on a SessionAsync or using soup_session_queue_message()).

The function takes the following parameters:

  • msg currently running on session.

func (*Session) WebsocketConnectFinish

func (session *Session) WebsocketConnectFinish(result gio.AsyncResulter) (*WebsocketConnection, error)

WebsocketConnectFinish gets the WebsocketConnection response to a soup_session_websocket_connect_async() call and (if successful), returns a WebsocketConnection that can be used to communicate with the server.

The function takes the following parameters:

  • result passed to your callback.

The function returns the following values:

  • websocketConnection: new WebsocketConnection, or NULL on error.

func (*Session) WouldRedirect

func (session *Session) WouldRedirect(msg *Message) bool

WouldRedirect checks if msg contains a response that would cause session to redirect it to a new URL (ignoring msg's SOUP_MESSAGE_NO_REDIRECT flag, and the number of times it has already been redirected).

The function takes the following parameters:

  • msg that has response headers.

The function returns the following values:

  • ok: whether msg would be redirected.

type SessionAsync

type SessionAsync struct {
	Session
	// contains filtered or unexported fields
}

func NewSessionAsync deprecated

func NewSessionAsync() *SessionAsync

NewSessionAsync creates an asynchronous Session with the default options.

Deprecated: SessionAsync is deprecated; use a plain Session, created with soup_session_new(). See the <link linkend="libsoup-session-porting">porting guide</link>.

The function returns the following values:

  • sessionAsync: new session.

type SessionAsyncClass

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

SessionAsyncClass: instance of this type is always passed by reference.

func (*SessionAsyncClass) ParentClass

func (s *SessionAsyncClass) ParentClass() *SessionClass

type SessionAsyncOverrides

type SessionAsyncOverrides struct {
}

SessionAsyncOverrides contains methods that are overridable.

type SessionCallback

type SessionCallback func(session *Session, msg *Message)

SessionCallback: prototype for the callback passed to soup_session_queue_message(), qv.

type SessionClass

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

SessionClass: instance of this type is always passed by reference.

type SessionConnectProgressCallback

type SessionConnectProgressCallback func(session *Session, event gio.SocketClientEvent, connection gio.IOStreamer)

SessionConnectProgressCallback: prototype for the progress callback passed to soup_session_connect_async().

type SessionFeature

type SessionFeature struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

SessionFeature: object that implement some sort of optional feature for Session.

SessionFeature wraps an interface. This means the user can get the underlying type by calling Cast().

func (*SessionFeature) AddFeature

func (feature *SessionFeature) AddFeature(typ coreglib.Type) bool

AddFeature adds a "sub-feature" of type type to the base feature feature. This is used for features that can be extended with multiple different types. Eg, the authentication manager can be extended with subtypes of Auth.

The function takes the following parameters:

  • typ of a "sub-feature".

The function returns the following values:

  • ok: TRUE if feature accepted type as a subfeature.

func (*SessionFeature) Attach

func (feature *SessionFeature) Attach(session *Session)

The function takes the following parameters:

func (*SessionFeature) Detach

func (feature *SessionFeature) Detach(session *Session)

The function takes the following parameters:

func (*SessionFeature) HasFeature

func (feature *SessionFeature) HasFeature(typ coreglib.Type) bool

HasFeature tests if feature has a "sub-feature" of type type. See soup_session_feature_add_feature().

The function takes the following parameters:

  • typ of a "sub-feature".

The function returns the following values:

  • ok: TRUE if feature has a subfeature of type type.

func (*SessionFeature) RemoveFeature

func (feature *SessionFeature) RemoveFeature(typ coreglib.Type) bool

RemoveFeature removes the "sub-feature" of type type from the base feature feature. See soup_session_feature_add_feature().

The function takes the following parameters:

  • typ of a "sub-feature".

The function returns the following values:

  • ok: TRUE if type was removed from feature.

type SessionFeatureInterface

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

SessionFeatureInterface: interface implemented by SessionFeature<!-- -->s.

An instance of this type is always passed by reference.

type SessionFeaturer

type SessionFeaturer interface {
	coreglib.Objector

	// AddFeature adds a "sub-feature" of type type to the base feature feature.
	AddFeature(typ coreglib.Type) bool
	Attach(session *Session)
	Detach(session *Session)
	// HasFeature tests if feature has a "sub-feature" of type type.
	HasFeature(typ coreglib.Type) bool
	// RemoveFeature removes the "sub-feature" of type type from the base
	// feature feature.
	RemoveFeature(typ coreglib.Type) bool
}

SessionFeaturer describes SessionFeature's interface methods.

type SessionOverrides

type SessionOverrides struct {
	// The function takes the following parameters:
	//
	//   - msg
	//   - auth
	//   - retrying
	//
	AuthRequired func(msg *Message, auth Auther, retrying bool)
	// The function takes the following parameters:
	//
	//   - msg
	//   - auth
	//   - retrying
	//
	Authenticate func(msg *Message, auth Auther, retrying bool)
	// CancelMessage causes session to immediately finish processing
	// msg (regardless of its current state) with a final status_code
	// of status_code. You may call this at any time after handing msg
	// off to session; if session has started sending the request but
	// has not yet received the complete response, then it will close
	// the request's connection. Note that with requests that have side
	// effects (eg, <literal>POST</literal>, <literal>PUT</literal>,
	// <literal>DELETE</literal>) it is possible that you might cancel the
	// request after the server acts on it, but before it returns a response,
	// leaving the remote resource in an unknown state.
	//
	// If the message is cancelled while its response body is being read, then
	// the response body in msg will be left partially-filled-in. The response
	// headers, on the other hand, will always be either empty or complete.
	//
	// Beware that with the deprecated SessionAsync, messages queued with
	// soup_session_queue_message() will have their callbacks invoked before
	// soup_session_cancel_message() returns. The plain Session does not have
	// this behavior; cancelling an asynchronous message will merely queue its
	// callback to be run after returning to the main loop.
	//
	// The function takes the following parameters:
	//
	//   - msg: message to cancel.
	//   - statusCode status code to set on msg (generally
	//     SOUP_STATUS_CANCELLED).
	//
	CancelMessage func(msg *Message, statusCode uint)
	FlushQueue    func()
	Kick          func()
	// The function takes the following parameters:
	//
	//   - msg
	//   - socket
	//
	RequestStarted func(msg *Message, socket *Socket)
	// RequeueMessage: this causes msg to be placed back on the queue to be
	// attempted again.
	//
	// The function takes the following parameters:
	//
	//   - msg: message to requeue.
	//
	RequeueMessage func(msg *Message)
	// SendMessage: synchronously send msg. This call will not return until the
	// transfer is finished successfully or there is an unrecoverable error.
	//
	// Unlike with soup_session_queue_message(), msg is not freed upon return.
	//
	// (Note that if you call this method on a SessionAsync, it will still use
	// asynchronous I/O internally, running the glib main loop to process the
	// message, which may also cause other events to be processed.)
	//
	// Contrast this method with soup_session_send(), which also synchronously
	// sends a message, but returns before reading the response body, and allows
	// you to read the response via a Stream.
	//
	// The function takes the following parameters:
	//
	//   - msg: message to send.
	//
	// The function returns the following values:
	//
	//   - guint: HTTP status code of the response.
	//
	SendMessage func(msg *Message) uint
}

SessionOverrides contains methods that are overridable.

type SessionSync

type SessionSync struct {
	Session
	// contains filtered or unexported fields
}

func NewSessionSync deprecated

func NewSessionSync() *SessionSync

NewSessionSync creates an synchronous Session with the default options.

Deprecated: SessionSync is deprecated; use a plain Session, created with soup_session_new(). See the <link linkend="libsoup-session-porting">porting guide</link>.

The function returns the following values:

  • sessionSync: new session.

type SessionSyncClass

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

SessionSyncClass: instance of this type is always passed by reference.

func (*SessionSyncClass) ParentClass

func (s *SessionSyncClass) ParentClass() *SessionClass

type SessionSyncOverrides

type SessionSyncOverrides struct {
}

SessionSyncOverrides contains methods that are overridable.

type Socket

type Socket struct {
	*coreglib.Object

	gio.Initable
	// contains filtered or unexported fields
}

func (*Socket) ConnectAsync

func (sock *Socket) ConnectAsync(ctx context.Context, callback SocketCallback)

ConnectAsync begins asynchronously connecting to sock's remote address. The socket will call callback when it succeeds or fails (but not before returning from this function).

If cancellable is non-NULL, it can be used to cancel the connection. callback will still be invoked in this case, with a status of SOUP_STATUS_CANCELLED.

The function takes the following parameters:

  • ctx (optional) or NULL.
  • callback to call after connecting.

func (*Socket) ConnectDisconnected

func (sock *Socket) ConnectDisconnected(f func()) coreglib.SignalHandle

ConnectDisconnected is emitted when the socket is disconnected, for whatever reason.

func (*Socket) ConnectEvent

func (sock *Socket) ConnectEvent(f func(event gio.SocketClientEvent, connection gio.IOStreamer)) coreglib.SignalHandle

ConnectEvent is emitted when a network-related event occurs. See Client::event for more details.

func (*Socket) ConnectNewConnection

func (sock *Socket) ConnectNewConnection(f func(new *Socket)) coreglib.SignalHandle

ConnectNewConnection is emitted when a listening socket (set up with soup_socket_listen()) receives a new connection.

You must ref the new if you want to keep it; otherwise it will be destroyed after the signal is emitted.

func (*Socket) ConnectReadable

func (sock *Socket) ConnectReadable(f func()) coreglib.SignalHandle

ConnectReadable is emitted when an async socket is readable. See soup_socket_read(), soup_socket_read_until() and Socket:non-blocking.

func (*Socket) ConnectSync

func (sock *Socket) ConnectSync(ctx context.Context) uint

ConnectSync: attempt to synchronously connect sock to its remote address.

If cancellable is non-NULL, it can be used to cancel the connection, in which case soup_socket_connect_sync() will return SOUP_STATUS_CANCELLED.

The function takes the following parameters:

  • ctx (optional) or NULL.

The function returns the following values:

  • guint success or failure code.

func (*Socket) ConnectWritable

func (sock *Socket) ConnectWritable(f func()) coreglib.SignalHandle

ConnectWritable is emitted when an async socket is writable. See soup_socket_write() and Socket:non-blocking.

func (*Socket) Disconnect

func (sock *Socket) Disconnect()

Disconnect disconnects sock. Any further read or write attempts on it will fail.

func (*Socket) Fd

func (sock *Socket) Fd() int

Fd gets sock's underlying file descriptor.

Note that fiddling with the file descriptor may break the Socket.

The function returns the following values:

  • gint sock's file descriptor.

func (*Socket) IsConnected

func (sock *Socket) IsConnected() bool

IsConnected tests if sock is connected to another host.

The function returns the following values:

  • ok: TRUE or FALSE.

func (*Socket) IsSSL

func (sock *Socket) IsSSL() bool

IsSSL tests if sock is doing (or has attempted to do) SSL.

The function returns the following values:

  • ok: TRUE if sock has SSL credentials set.

func (*Socket) Listen

func (sock *Socket) Listen() bool

Listen makes sock start listening on its local address. When connections come in, sock will emit Socket::new_connection.

The function returns the following values:

  • ok: whether or not sock is now listening.

func (*Socket) LocalAddress

func (sock *Socket) LocalAddress() *Address

LocalAddress returns the Address corresponding to the local end of sock.

Calling this method on an unconnected socket is considered to be an error, and produces undefined results.

The function returns the following values:

  • address: Address.

func (*Socket) Read

func (sock *Socket) Read(ctx context.Context, buffer []byte) (uint, SocketIOStatus, error)

Read attempts to read up to len bytes from sock into buffer. If some data is successfully read, soup_socket_read() will return SOUP_SOCKET_OK, and *nread will contain the number of bytes actually read (which may be less than len).

If sock is non-blocking, and no data is available, the return value will be SOUP_SOCKET_WOULD_BLOCK. In this case, the caller can connect to the Socket::readable signal to know when there is more data to read. (NB: You MUST read all available data off the socket first. Socket::readable is only emitted after soup_socket_read() returns SOUP_SOCKET_WOULD_BLOCK, and it is only emitted once. See the documentation for Socket:non-blocking.).

The function takes the following parameters:

  • ctx (optional) or NULL.
  • buffer to read into.

The function returns the following values:

  • nread: on return, the number of bytes read into buffer.
  • socketIOStatus as described above (or SOUP_SOCKET_EOF if the socket is no longer connected, or SOUP_SOCKET_ERROR on any other error, in which case error will also be set).

func (*Socket) ReadUntil

func (sock *Socket) ReadUntil(ctx context.Context, buffer []byte, boundary unsafe.Pointer, boundaryLen uint) (uint, bool, SocketIOStatus, error)

ReadUntil: like soup_socket_read(), but reads no further than the first occurrence of boundary. (If the boundary is found, it will be included in the returned data, and *got_boundary will be set to TRUE.) Any data after the boundary will returned in future reads.

soup_socket_read_until() will almost always return fewer than len bytes: if the boundary is found, then it will only return the bytes up until the end of the boundary, and if the boundary is not found, then it will leave the last <literal>(boundary_len - 1)</literal> bytes in its internal buffer, in case they form the start of the boundary string. Thus, len normally needs to be at least 1 byte longer than boundary_len if you want to make any progress at all.

The function takes the following parameters:

  • ctx (optional) or NULL.
  • buffer to read into.
  • boundary (optional) to read until.
  • boundaryLen: length of boundary in bytes.

The function returns the following values:

  • nread: on return, the number of bytes read into buffer.
  • gotBoundary: on return, whether or not the data in buffer ends with the boundary string.
  • socketIOStatus as for soup_socket_read().

func (*Socket) RemoteAddress

func (sock *Socket) RemoteAddress() *Address

RemoteAddress returns the Address corresponding to the remote end of sock.

Calling this method on an unconnected socket is considered to be an error, and produces undefined results.

The function returns the following values:

  • address: Address.

func (*Socket) StartProxySsl

func (sock *Socket) StartProxySsl(ctx context.Context, sslHost string) bool

StartProxySsl starts using SSL on socket, expecting to find a host named ssl_host.

The function takes the following parameters:

  • ctx (optional): #GCancellable.
  • sslHost: hostname of the SSL server.

The function returns the following values:

  • ok success or failure.

func (*Socket) StartSSL

func (sock *Socket) StartSSL(ctx context.Context) bool

StartSSL starts using SSL on socket.

The function takes the following parameters:

  • ctx (optional): #GCancellable.

The function returns the following values:

  • ok success or failure.

func (*Socket) Write

func (sock *Socket) Write(ctx context.Context, buffer []byte) (uint, SocketIOStatus, error)

Write attempts to write len bytes from buffer to sock. If some data is successfully written, the return status will be SOUP_SOCKET_OK, and *nwrote will contain the number of bytes actually written (which may be less than len).

If sock is non-blocking, and no data could be written right away, the return value will be SOUP_SOCKET_WOULD_BLOCK. In this case, the caller can connect to the Socket::writable signal to know when more data can be written. (NB: Socket::writable is only emitted after soup_socket_write() returns SOUP_SOCKET_WOULD_BLOCK, and it is only emitted once. See the documentation for Socket:non-blocking.).

The function takes the following parameters:

  • ctx (optional) or NULL.
  • buffer: data to write.

The function returns the following values:

  • nwrote: on return, number of bytes written.
  • socketIOStatus as described above (or SOUP_SOCKET_EOF or SOUP_SOCKET_ERROR. error will be set if the return value is SOUP_SOCKET_ERROR.).

type SocketCallback

type SocketCallback func(sock *Socket, status uint)

SocketCallback: callback function passed to soup_socket_connect_async().

type SocketClass

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

SocketClass: instance of this type is always passed by reference.

type SocketIOStatus

type SocketIOStatus C.gint

SocketIOStatus: return value from the Socket IO methods.

const (
	// SocketOK: success.
	SocketOK SocketIOStatus = iota
	// SocketWouldBlock: cannot read/write any more at this time.
	SocketWouldBlock
	// SocketEOF: end of file.
	SocketEOF
	// SocketError: other error.
	SocketError
)

func (SocketIOStatus) String

func (s SocketIOStatus) String() string

String returns the name in string for SocketIOStatus.

type SocketOverrides

type SocketOverrides struct {
	Disconnected func()
	// The function takes the following parameters:
	//
	NewConnection func(newSock *Socket)
	Readable      func()
	Writable      func()
}

SocketOverrides contains methods that are overridable.

type Status

type Status C.gint

Status: 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.

Prior to 2.44 this type was called <literal>SoupKnownStatusCode</literal>, but the individual values have always had the names they have now.

const (
	// StatusNone: no status available. (Eg, the message has not been sent yet).
	StatusNone Status = 0
	// StatusCancelled: message was cancelled locally.
	StatusCancelled Status = 1
	// StatusCantResolve: unable to resolve destination host name.
	StatusCantResolve Status = 2
	// StatusCantResolveProxy: unable to resolve proxy host name.
	StatusCantResolveProxy Status = 3
	// StatusCantConnect: unable to connect to remote host.
	StatusCantConnect Status = 4
	// StatusCantConnectProxy: unable to connect to proxy.
	StatusCantConnectProxy Status = 5
	// StatusSSLFailed: SSL/TLS negotiation failed.
	StatusSSLFailed Status = 6
	// StatusIOError: network error occurred, or the other end closed the
	// connection unexpectedly.
	StatusIOError Status = 7
	// StatusMalformed: malformed data (usually a programmer error).
	StatusMalformed Status = 8
	// StatusTryAgain: used internally.
	StatusTryAgain Status = 9
	// StatusTooManyRedirects: there were too many redirections.
	StatusTooManyRedirects Status = 10
	// StatusTLSFailed: used internally.
	StatusTLSFailed Status = 11
	// StatusContinue: 100 Continue (HTTP).
	StatusContinue Status = 100
	// StatusSwitchingProtocols: 101 Switching Protocols (HTTP).
	StatusSwitchingProtocols Status = 101
	// StatusProcessing: 102 Processing (WebDAV).
	StatusProcessing Status = 102
	// StatusOK: 200 Success (HTTP). Also used by many lower-level soup routines
	// to indicate success.
	StatusOK Status = 200
	// StatusCreated: 201 Created (HTTP).
	StatusCreated Status = 201
	// StatusAccepted: 202 Accepted (HTTP).
	StatusAccepted Status = 202
	// StatusNonAuthoritative: 203 Non-Authoritative Information (HTTP).
	StatusNonAuthoritative Status = 203
	// StatusNoContent: 204 No Content (HTTP).
	StatusNoContent Status = 204
	// StatusResetContent: 205 Reset Content (HTTP).
	StatusResetContent Status = 205
	// StatusPartialContent: 206 Partial Content (HTTP).
	StatusPartialContent Status = 206
	// StatusMultiStatus: 207 Multi-Status (WebDAV).
	StatusMultiStatus Status = 207
	// StatusMultipleChoices: 300 Multiple Choices (HTTP).
	StatusMultipleChoices Status = 300
	// StatusMovedPermanently: 301 Moved Permanently (HTTP).
	StatusMovedPermanently Status = 301
	// StatusFound: 302 Found (HTTP).
	StatusFound Status = 302
	// StatusMovedTemporarily: 302 Moved Temporarily (old name, RFC 2068).
	StatusMovedTemporarily Status = 302
	// StatusSeeOther: 303 See Other (HTTP).
	StatusSeeOther Status = 303
	// StatusNotModified: 304 Not Modified (HTTP).
	StatusNotModified Status = 304
	// StatusUseProxy: 305 Use Proxy (HTTP).
	StatusUseProxy Status = 305
	// StatusNotAppearingInThisProtocol: 306 [Unused] (HTTP).
	StatusNotAppearingInThisProtocol Status = 306
	// StatusTemporaryRedirect: 307 Temporary Redirect (HTTP).
	StatusTemporaryRedirect Status = 307
	StatusPermanentRedirect Status = 308
	// StatusBadRequest: 400 Bad Request (HTTP).
	StatusBadRequest Status = 400
	// StatusUnauthorized: 401 Unauthorized (HTTP).
	StatusUnauthorized Status = 401
	// StatusPaymentRequired: 402 Payment Required (HTTP).
	StatusPaymentRequired Status = 402
	// StatusForbidden: 403 Forbidden (HTTP).
	StatusForbidden Status = 403
	// StatusNotFound: 404 Not Found (HTTP).
	StatusNotFound Status = 404
	// StatusMethodNotAllowed: 405 Method Not Allowed (HTTP).
	StatusMethodNotAllowed Status = 405
	// StatusNotAcceptable: 406 Not Acceptable (HTTP).
	StatusNotAcceptable Status = 406
	// StatusProxyAuthenticationRequired: 407 Proxy Authentication Required
	// (HTTP).
	StatusProxyAuthenticationRequired Status = 407
	// StatusProxyUnauthorized: shorter alias for
	// SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED.
	StatusProxyUnauthorized Status = 407
	// StatusRequestTimeout: 408 Request Timeout (HTTP).
	StatusRequestTimeout Status = 408
	// StatusConflict: 409 Conflict (HTTP).
	StatusConflict Status = 409
	// StatusGone: 410 Gone (HTTP).
	StatusGone Status = 410
	// StatusLengthRequired: 411 Length Required (HTTP).
	StatusLengthRequired Status = 411
	// StatusPreconditionFailed: 412 Precondition Failed (HTTP).
	StatusPreconditionFailed Status = 412
	// StatusRequestEntityTooLarge: 413 Request Entity Too Large (HTTP).
	StatusRequestEntityTooLarge Status = 413
	// StatusRequestURITooLong: 414 Request-URI Too Long (HTTP).
	StatusRequestURITooLong Status = 414
	// StatusUnsupportedMediaType: 415 Unsupported Media Type (HTTP).
	StatusUnsupportedMediaType Status = 415
	// StatusRequestedRangeNotSatisfiable: 416 Requested Range Not Satisfiable
	// (HTTP).
	StatusRequestedRangeNotSatisfiable Status = 416
	// StatusInvalidRange: shorter alias for
	// SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE.
	StatusInvalidRange Status = 416
	// StatusExpectationFailed: 417 Expectation Failed (HTTP).
	StatusExpectationFailed Status = 417
	// StatusUnprocessableEntity: 422 Unprocessable Entity (WebDAV).
	StatusUnprocessableEntity Status = 422
	// StatusLocked: 423 Locked (WebDAV).
	StatusLocked Status = 423
	// StatusFailedDependency: 424 Failed Dependency (WebDAV).
	StatusFailedDependency Status = 424
	// StatusInternalServerError: 500 Internal Server Error (HTTP).
	StatusInternalServerError Status = 500
	// StatusNotImplemented: 501 Not Implemented (HTTP).
	StatusNotImplemented Status = 501
	// StatusBadGateway: 502 Bad Gateway (HTTP).
	StatusBadGateway Status = 502
	// StatusServiceUnavailable: 503 Service Unavailable (HTTP).
	StatusServiceUnavailable Status = 503
	// StatusGatewayTimeout: 504 Gateway Timeout (HTTP).
	StatusGatewayTimeout Status = 504
	// StatusHTTPVersionNotSupported: 505 HTTP Version Not Supported (HTTP).
	StatusHTTPVersionNotSupported Status = 505
	// StatusInsufficientStorage: 507 Insufficient Storage (WebDAV).
	StatusInsufficientStorage Status = 507
	// StatusNotExtended: 510 Not Extended (RFC 2774).
	StatusNotExtended Status = 510
)

func (Status) String

func (s Status) String() string

String returns the name in string for Status.

type TLDError

type TLDError C.gint

TLDError: error codes for SOUP_TLD_ERROR.

const (
	// TldErrorInvalidHostname: hostname was syntactically invalid.
	TldErrorInvalidHostname TLDError = iota
	// TldErrorIsIPAddress: passed-in "hostname" was actually an IP address (and
	// thus has no base domain or public suffix).
	TldErrorIsIPAddress
	// TldErrorNotEnoughDomains: passed-in hostname did not have
	// enough components. Eg, calling soup_tld_get_base_domain() on
	// <literal>"co.uk"</literal>.
	TldErrorNotEnoughDomains
	// TldErrorNoBaseDomain: passed-in hostname has no recognized public suffix.
	TldErrorNoBaseDomain
	TldErrorNoPslData
)

func (TLDError) String

func (t TLDError) String() string

String returns the name in string for TLDError.

type URI

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

URI represents a (parsed) URI. URI supports RFC 3986 (URI Generic Syntax), and can parse any valid URI. However, libsoup only uses "http" and "https" URIs internally; You can use SOUP_URI_VALID_FOR_HTTP() to test if a URI is a valid HTTP URI.

scheme will always be set in any URI. It is an interned string and is always all lowercase. (If you parse a URI with a non-lowercase scheme, it will be converted to lowercase.) The macros SOUP_URI_SCHEME_HTTP and SOUP_URI_SCHEME_HTTPS provide the interned values for "http" and "https" and can be compared against URI scheme values.

user and password are parsed as defined in the older URI specs (ie, separated by a colon; RFC 3986 only talks about a single "userinfo" field). Note that password is not included in the output of soup_uri_to_string(). libsoup does not normally use these fields; authentication is handled via Session signals.

host contains the hostname, and port the port specified in the URI. If the URI doesn't contain a hostname, host will be NULL, and if it doesn't specify a port, port may be 0. However, for "http" and "https" URIs, host is guaranteed to be non-NULL (trying to parse an http URI with no host will return NULL), and port will always be non-0 (because libsoup knows the default value to use when it is not specified in the URI).

path is always non-NULL. For http/https URIs, path will never be an empty string either; if the input URI has no path, the parsed URI will have a path of "/".

query and fragment are optional for all URI types. soup_form_decode() may be useful for parsing query.

Note that path, query, and fragment may contain %<!-- -->-encoded characters. soup_uri_new() calls soup_uri_normalize() on them, but not soup_uri_decode(). This is necessary to ensure that soup_uri_to_string() will generate a URI that has exactly the same meaning as the original. (In theory, URI should leave user, password, and host partially-encoded as well, but this would be more annoying than useful.)

An instance of this type is always passed by reference.

func NewURI

func NewURI(uriString string) *URI

NewURI constructs a struct URI.

func NewURIWithBase

func NewURIWithBase(base *URI, uriString string) *URI

NewURIWithBase constructs a struct URI.

func (*URI) Copy

func (uri *URI) Copy() *URI

Copy copies uri.

The function returns the following values:

  • urI: copy of uri, which must be freed with soup_uri_free().

func (*URI) CopyHost

func (uri *URI) CopyHost() *URI

CopyHost makes a copy of uri, considering only the protocol, host, and port.

The function returns the following values:

  • urI: new URI.

func (*URI) Equal

func (uri1 *URI) Equal(uri2 *URI) bool

Equal tests whether or not uri1 and uri2 are equal in all parts.

The function takes the following parameters:

  • uri2: another URI.

The function returns the following values:

  • ok: TRUE or FALSE.

func (*URI) Fragment

func (uri *URI) Fragment() string

Fragment gets uri's fragment.

The function returns the following values:

  • utf8 uri's fragment.

func (*URI) Host

func (uri *URI) Host() string

Host gets uri's host.

The function returns the following values:

  • utf8 uri's host.

func (*URI) HostEqual

func (v1 *URI) HostEqual(v2 *URI) bool

HostEqual compares v1 and v2, considering only the scheme, host, and port.

The function takes the following parameters:

  • v2 with a non-NULL host member.

The function returns the following values:

  • ok: whether or not the URIs are equal in scheme, host, and port.

func (*URI) HostHash

func (key *URI) HostHash() uint

HostHash hashes key, considering only the scheme, host, and port.

The function returns the following values:

  • guint: hash.

func (*URI) Password

func (uri *URI) Password() string

Password gets uri's password.

The function returns the following values:

  • utf8 uri's password.

func (*URI) Path

func (uri *URI) Path() string

Path gets uri's path.

The function returns the following values:

  • utf8 uri's path.

func (*URI) Port

func (uri *URI) Port() uint

Port gets uri's port.

The function returns the following values:

  • guint uri's port.

func (*URI) Query

func (uri *URI) Query() string

Query gets uri's query.

The function returns the following values:

  • utf8 uri's query.

func (*URI) Scheme

func (uri *URI) Scheme() string

Scheme gets uri's scheme.

The function returns the following values:

  • utf8 uri's scheme.

func (*URI) SetFragment

func (uri *URI) SetFragment(fragment string)

SetFragment sets uri's fragment to fragment.

The function takes the following parameters:

  • fragment (optional): fragment.

func (*URI) SetHost

func (uri *URI) SetHost(host string)

SetHost sets uri's host to host.

If host is an IPv6 IP address, it should not include the brackets required by the URI syntax; they will be added automatically when converting uri to a string.

http and https URIs should not have a NULL host.

The function takes the following parameters:

  • host (optional): hostname or IP address, or NULL.

func (*URI) SetPassword

func (uri *URI) SetPassword(password string)

SetPassword sets uri's password to password.

The function takes the following parameters:

  • password (optional): password, or NULL.

func (*URI) SetPath

func (uri *URI) SetPath(path string)

SetPath sets uri's path to path.

The function takes the following parameters:

  • path: non-NULL path.

func (*URI) SetPort

func (uri *URI) SetPort(port uint)

SetPort sets uri's port to port. If port is 0, uri will not have an explicitly-specified port.

The function takes the following parameters:

  • port: port, or 0.

func (*URI) SetQuery

func (uri *URI) SetQuery(query string)

SetQuery sets uri's query to query.

The function takes the following parameters:

  • query (optional): query.

func (*URI) SetQueryFromForm

func (uri *URI) SetQueryFromForm(form map[string]string)

SetQueryFromForm sets uri's query to the result of encoding form according to the HTML form rules. See soup_form_encode_hash() for more information.

The function takes the following parameters:

  • form containing HTML form information.

func (*URI) SetScheme

func (uri *URI) SetScheme(scheme string)

SetScheme sets uri's scheme to scheme. This will also set uri's port to the default port for scheme, if known.

The function takes the following parameters:

  • scheme: URI scheme.

func (*URI) SetUser

func (uri *URI) SetUser(user string)

SetUser sets uri's user to user.

The function takes the following parameters:

  • user (optional): username, or NULL.

func (*URI) String

func (uri *URI) String(justPathAndQuery bool) string

String returns a string representing uri.

If just_path_and_query is TRUE, this concatenates the path and query together. That is, it constructs the string that would be needed in the Request-Line of an HTTP request for uri.

Note that the output will never contain a password, even if uri does.

The function takes the following parameters:

  • justPathAndQuery: if TRUE, output just the path and query portions.

The function returns the following values:

  • utf8: string representing uri, which the caller must free.

func (*URI) User

func (uri *URI) User() string

User gets uri's user.

The function returns the following values:

  • utf8 uri's user.

func (*URI) UsesDefaultPort

func (uri *URI) UsesDefaultPort() bool

UsesDefaultPort tests if uri uses the default port for its scheme. (Eg, 80 for http.) (This only works for http, https and ftp; libsoup does not know the default ports of other protocols.).

The function returns the following values:

  • ok: TRUE or FALSE.

type WebsocketCloseCode

type WebsocketCloseCode C.gint

WebsocketCloseCode: pre-defined close codes that can be passed to soup_websocket_connection_close() or received from soup_websocket_connection_get_close_code(). (However, other codes are also allowed.).

const (
	// WebsocketCloseNormal: normal, non-error close.
	WebsocketCloseNormal WebsocketCloseCode = 1000
	// WebsocketCloseGoingAway: client/server is going away.
	WebsocketCloseGoingAway WebsocketCloseCode = 1001
	// WebsocketCloseProtocolError: protocol error occurred.
	WebsocketCloseProtocolError WebsocketCloseCode = 1002
	// WebsocketCloseUnsupportedData: endpoint received data of a type that it
	// does not support.
	WebsocketCloseUnsupportedData WebsocketCloseCode = 1003
	// WebsocketCloseNoStatus: reserved value indicating that no close code was
	// present; must not be sent.
	WebsocketCloseNoStatus WebsocketCloseCode = 1005
	// WebsocketCloseAbnormal: reserved value indicating that the connection was
	// closed abnormally; must not be sent.
	WebsocketCloseAbnormal WebsocketCloseCode = 1006
	// WebsocketCloseBadData: endpoint received data that was invalid (eg,
	// non-UTF-8 data in a text message).
	WebsocketCloseBadData WebsocketCloseCode = 1007
	// WebsocketClosePolicyViolation: generic error code indicating some sort of
	// policy violation.
	WebsocketClosePolicyViolation WebsocketCloseCode = 1008
	// WebsocketCloseTooBig: endpoint received a message that is too big to
	// process.
	WebsocketCloseTooBig WebsocketCloseCode = 1009
	// WebsocketCloseNoExtension: client is closing the connection because the
	// server failed to negotiate a required extension.
	WebsocketCloseNoExtension WebsocketCloseCode = 1010
	// WebsocketCloseServerError: server is closing the connection because it
	// was unable to fulfill the request.
	WebsocketCloseServerError WebsocketCloseCode = 1011
	// WebsocketCloseTLSHandshake: reserved value indicating that the TLS
	// handshake failed; must not be sent.
	WebsocketCloseTLSHandshake WebsocketCloseCode = 1015
)

func (WebsocketCloseCode) String

func (w WebsocketCloseCode) String() string

String returns the name in string for WebsocketCloseCode.

type WebsocketConnection

type WebsocketConnection struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

WebsocketConnection class representing a WebSocket connection.

func NewWebsocketConnection

func NewWebsocketConnection(stream gio.IOStreamer, uri *URI, typ WebsocketConnectionType, origin, protocol string) *WebsocketConnection

NewWebsocketConnection creates a WebsocketConnection on stream. This should be called after completing the handshake to begin using the WebSocket protocol.

The function takes the following parameters:

  • stream connected to the WebSocket server.
  • uri: URI of the connection.
  • typ: type of connection (client/side).
  • origin (optional): origin of the client.
  • protocol (optional) in use.

The function returns the following values:

  • websocketConnection: new WebsocketConnection.

func NewWebsocketConnectionWithExtensions

func NewWebsocketConnectionWithExtensions(stream gio.IOStreamer, uri *URI, typ WebsocketConnectionType, origin, protocol string, extensions []WebsocketExtensioner) *WebsocketConnection

NewWebsocketConnectionWithExtensions creates a WebsocketConnection on stream with the given active extensions. This should be called after completing the handshake to begin using the WebSocket protocol.

The function takes the following parameters:

  • stream connected to the WebSocket server.
  • uri: URI of the connection.
  • typ: type of connection (client/side).
  • origin (optional): origin of the client.
  • protocol (optional) in use.
  • extensions of WebsocketExtension objects.

The function returns the following values:

  • websocketConnection: new WebsocketConnection.

func (*WebsocketConnection) Close

func (self *WebsocketConnection) Close(code uint16, data string)

Close the connection in an orderly fashion.

Note that until the WebsocketConnection::closed signal fires, the connection is not yet completely closed. The close message is not even sent until the main loop runs.

The code and data are sent to the peer along with the close request. If code is SOUP_WEBSOCKET_CLOSE_NO_STATUS a close message with no body (without code and data) is sent. Note that the data must be UTF-8 valid.

The function takes the following parameters:

  • code: close code.
  • data (optional): close data.

func (*WebsocketConnection) CloseCode

func (self *WebsocketConnection) CloseCode() uint16

CloseCode: 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 WebsocketCloseCode enumeration, but may also be an application defined close code.

The function returns the following values:

  • gushort: close code or zero.

func (*WebsocketConnection) CloseData

func (self *WebsocketConnection) CloseData() string

CloseData: get the close data received from the WebSocket peer.

This only becomes valid once the WebSocket is in the SOUP_WEBSOCKET_STATE_CLOSED state. The data may be freed once the main loop is run, so copy it if you need to keep it around.

The function returns the following values:

  • utf8: close data or NULL.

func (*WebsocketConnection) ConnectClosed

func (self *WebsocketConnection) ConnectClosed(f func()) coreglib.SignalHandle

ConnectClosed is emitted when the connection has completely closed, either due to an orderly close from the peer, one initiated via soup_websocket_connection_close() or a fatal error condition that caused a close.

This signal will be emitted once.

func (*WebsocketConnection) ConnectClosing

func (self *WebsocketConnection) ConnectClosing(f func()) coreglib.SignalHandle

ConnectClosing: this signal will be emitted during an orderly close.

func (*WebsocketConnection) ConnectError

func (self *WebsocketConnection) ConnectError(f func(err error)) coreglib.SignalHandle

ConnectError is emitted when an error occurred on the WebSocket. This may be fired multiple times. Fatal errors will be followed by the WebsocketConnection::closed signal being emitted.

func (*WebsocketConnection) ConnectMessage

func (self *WebsocketConnection) ConnectMessage(f func(typ int, message *glib.Bytes)) coreglib.SignalHandle

ConnectMessage is emitted when we receive a message from the peer.

As a convenience, the message data will always be NUL-terminated, but the NUL byte will not be included in the length count.

func (*WebsocketConnection) ConnectPong

func (self *WebsocketConnection) ConnectPong(f func(message *glib.Bytes)) coreglib.SignalHandle

ConnectPong is emitted when we receive a Pong frame (solicited or unsolicited) from the peer.

As a convenience, the message data will always be NUL-terminated, but the NUL byte will not be included in the length count.

func (*WebsocketConnection) ConnectionType

func (self *WebsocketConnection) ConnectionType() WebsocketConnectionType

ConnectionType: get the connection type (client/server) of the connection.

The function returns the following values:

  • websocketConnectionType: connection type.

func (*WebsocketConnection) Extensions

func (self *WebsocketConnection) Extensions() []WebsocketExtensioner

Extensions: get the extensions chosen via negotiation with the peer.

The function returns the following values:

  • list of WebsocketExtension objects.

func (*WebsocketConnection) IOStream

func (self *WebsocketConnection) IOStream() gio.IOStreamer

IOStream: get the I/O stream the WebSocket is communicating over.

The function returns the following values:

  • ioStream webSocket's I/O stream.

func (*WebsocketConnection) KeepaliveInterval

func (self *WebsocketConnection) KeepaliveInterval() uint

KeepaliveInterval gets the keepalive interval in seconds or 0 if disabled.

The function returns the following values:

  • guint: keepalive interval.

func (*WebsocketConnection) MaxIncomingPayloadSize

func (self *WebsocketConnection) MaxIncomingPayloadSize() uint64

MaxIncomingPayloadSize gets the maximum payload size allowed for incoming packets.

The function returns the following values:

  • guint64: maximum payload size.

func (*WebsocketConnection) Origin

func (self *WebsocketConnection) Origin() string

Origin: get the origin of the WebSocket.

The function returns the following values:

  • utf8 (optional): origin, or NULL.

func (*WebsocketConnection) Protocol

func (self *WebsocketConnection) Protocol() string

Protocol: get the protocol chosen via negotiation with the peer.

The function returns the following values:

  • utf8 (optional): chosen protocol, or NULL.

func (*WebsocketConnection) SendBinary

func (self *WebsocketConnection) SendBinary(data []byte)

SendBinary: send a binary message to the peer. If length is 0, data may be NULL.

The message is queued to be sent and will be sent when the main loop is run.

The function takes the following parameters:

  • data (optional): message contents.

func (*WebsocketConnection) SendMessage

func (self *WebsocketConnection) SendMessage(typ WebsocketDataType, message *glib.Bytes)

SendMessage: send a message of the given type to the peer. Note that this method, allows to send text messages containing NULL characters.

The message is queued to be sent and will be sent when the main loop is run.

The function takes the following parameters:

  • typ: type of message contents.
  • message data as #GBytes.

func (*WebsocketConnection) SendText

func (self *WebsocketConnection) SendText(text string)

SendText: send a NULL-terminated text (UTF-8) message to the peer. If you need to send text messages containing NULL characters use soup_websocket_connection_send_message() instead.

The message is queued to be sent and will be sent when the main loop is run.

The function takes the following parameters:

  • text: message contents.

func (*WebsocketConnection) SetKeepaliveInterval

func (self *WebsocketConnection) SetKeepaliveInterval(interval uint)

SetKeepaliveInterval sets the interval in seconds on when to send a ping message which will serve as a keepalive message. If set to 0 the keepalive message is disabled.

The function takes the following parameters:

  • interval to send a ping message or 0 to disable it.

func (*WebsocketConnection) SetMaxIncomingPayloadSize

func (self *WebsocketConnection) SetMaxIncomingPayloadSize(maxIncomingPayloadSize uint64)

SetMaxIncomingPayloadSize sets the maximum payload size allowed for incoming packets. It does not limit the outgoing packet size.

The function takes the following parameters:

  • maxIncomingPayloadSize: maximum payload size.

func (*WebsocketConnection) State

func (self *WebsocketConnection) State() WebsocketState

State: get the current state of the WebSocket.

The function returns the following values:

  • websocketState: state.

func (*WebsocketConnection) URI

func (self *WebsocketConnection) URI() *URI

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.

The function returns the following values:

  • urI: URI.

type WebsocketConnectionClass

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

WebsocketConnectionClass: abstract base class for WebsocketConnection

An instance of this type is always passed by reference.

type WebsocketConnectionOverrides

type WebsocketConnectionOverrides struct {
	Closed  func()
	Closing func()
	// The function takes the following parameters:
	//
	Error func(err error)
	// The function takes the following parameters:
	//
	//   - typ
	//   - message
	//
	Message func(typ WebsocketDataType, message *glib.Bytes)
	// The function takes the following parameters:
	//
	Pong func(message *glib.Bytes)
}

WebsocketConnectionOverrides contains methods that are overridable.

type WebsocketConnectionType

type WebsocketConnectionType C.gint

WebsocketConnectionType: type of a WebsocketConnection.

const (
	// WebsocketConnectionUnknown: unknown/invalid connection.
	WebsocketConnectionUnknown WebsocketConnectionType = iota
	// WebsocketConnectionClient: client-side connection.
	WebsocketConnectionClient
	// WebsocketConnectionServer: server-side connection.
	WebsocketConnectionServer
)

func (WebsocketConnectionType) String

func (w WebsocketConnectionType) String() string

String returns the name in string for WebsocketConnectionType.

type WebsocketDataType

type WebsocketDataType C.gint

WebsocketDataType: type of data contained in a WebsocketConnection::message signal.

const (
	// WebsocketDataText: UTF-8 text.
	WebsocketDataText WebsocketDataType = 1
	// WebsocketDataBinary: binary data.
	WebsocketDataBinary WebsocketDataType = 2
)

func (WebsocketDataType) String

func (w WebsocketDataType) String() string

String returns the name in string for WebsocketDataType.

type WebsocketError

type WebsocketError C.gint

WebsocketError: webSocket-related errors.

const (
	// WebsocketErrorFailed: generic error.
	WebsocketErrorFailed WebsocketError = iota
	// WebsocketErrorNotWebsocket: attempted to handshake with a server that
	// does not appear to understand WebSockets.
	WebsocketErrorNotWebsocket
	// WebsocketErrorBadHandshake: webSocket handshake failed because some
	// detail was invalid (eg, incorrect accept key).
	WebsocketErrorBadHandshake
	// WebsocketErrorBadOrigin: webSocket handshake failed because the "Origin"
	// header was not an allowed value.
	WebsocketErrorBadOrigin
)

func (WebsocketError) String

func (w WebsocketError) String() string

String returns the name in string for WebsocketError.

type WebsocketExtension

type WebsocketExtension struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func BaseWebsocketExtension

func BaseWebsocketExtension(obj WebsocketExtensioner) *WebsocketExtension

BaseWebsocketExtension returns the underlying base object.

func (*WebsocketExtension) Configure

func (extension *WebsocketExtension) Configure(connectionType WebsocketConnectionType, params map[unsafe.Pointer]unsafe.Pointer) error

Configure configures extension with the given params.

The function takes the following parameters:

  • connectionType: either SOUP_WEBSOCKET_CONNECTION_CLIENT or SOUP_WEBSOCKET_CONNECTION_SERVER.
  • params (optional): parameters, or NULL.

func (*WebsocketExtension) RequestParams

func (extension *WebsocketExtension) RequestParams() string

RequestParams: 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.

The function returns the following values:

  • utf8 (optional): new allocated string with the parameters.

func (*WebsocketExtension) ResponseParams

func (extension *WebsocketExtension) ResponseParams() string

ResponseParams: 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.

The function returns the following values:

  • utf8 (optional): new allocated string with the parameters.

type WebsocketExtensionClass

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

WebsocketExtensionClass class structure for the SoupWebsocketExtension.

An instance of this type is always passed by reference.

func (*WebsocketExtensionClass) Name

func (w *WebsocketExtensionClass) Name() string

type WebsocketExtensionDeflate

type WebsocketExtensionDeflate struct {
	WebsocketExtension
	// contains filtered or unexported fields
}

type WebsocketExtensionDeflateClass

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

WebsocketExtensionDeflateClass: instance of this type is always passed by reference.

func (*WebsocketExtensionDeflateClass) ParentClass

type WebsocketExtensionDeflateOverrides

type WebsocketExtensionDeflateOverrides struct {
}

WebsocketExtensionDeflateOverrides contains methods that are overridable.

type WebsocketExtensionManager

type WebsocketExtensionManager struct {
	*coreglib.Object

	SessionFeature
	// contains filtered or unexported fields
}

type WebsocketExtensionManagerClass

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

WebsocketExtensionManagerClass: instance of this type is always passed by reference.

type WebsocketExtensionManagerOverrides

type WebsocketExtensionManagerOverrides struct {
}

WebsocketExtensionManagerOverrides contains methods that are overridable.

type WebsocketExtensionOverrides

type WebsocketExtensionOverrides struct {
	// Configure configures extension with the given params.
	//
	// The function takes the following parameters:
	//
	//   - connectionType: either SOUP_WEBSOCKET_CONNECTION_CLIENT or
	//     SOUP_WEBSOCKET_CONNECTION_SERVER.
	//   - params (optional): parameters, or NULL.
	//
	Configure func(connectionType WebsocketConnectionType, params map[unsafe.Pointer]unsafe.Pointer) error
	// RequestParams: 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.
	//
	// The function returns the following values:
	//
	//   - utf8 (optional): new allocated string with the parameters.
	//
	RequestParams func() string
	// ResponseParams: 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.
	//
	// The function returns the following values:
	//
	//   - utf8 (optional): new allocated string with the parameters.
	//
	ResponseParams func() string
}

WebsocketExtensionOverrides contains methods that are overridable.

type WebsocketExtensioner

type WebsocketExtensioner interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

WebsocketExtensioner describes types inherited from class WebsocketExtension.

To get the original type, the caller must assert this to an interface or another type.

type WebsocketState

type WebsocketState C.gint

WebsocketState: state of the WebSocket connection.

const (
	// WebsocketStateOpen: connection is ready to send messages.
	WebsocketStateOpen WebsocketState = 1
	// WebsocketStateClosing: connection is in the process of closing down;
	// messages may be received, but not sent.
	WebsocketStateClosing WebsocketState = 2
	// WebsocketStateClosed: connection is completely closed down.
	WebsocketStateClosed WebsocketState = 3
)

func (WebsocketState) String

func (w WebsocketState) String() string

String returns the name in string for WebsocketState.

type XMLRPCError

type XMLRPCError C.gint
const (
	XmlrpcErrorArguments XMLRPCError = iota
	XmlrpcErrorRetval
)

func (XMLRPCError) String

func (x XMLRPCError) String() string

String returns the name in string for XMLRPCError.

type XMLRPCFault

type XMLRPCFault C.gint

XMLRPCFault: pre-defined XML-RPC fault codes from <ulink url="http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php">http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php</ulink>. These are an extension, not part of the XML-RPC spec; you can't assume servers will use them.

const (
	// XmlrpcFaultParseErrorNotWellFormed: request was not well-formed.
	XmlrpcFaultParseErrorNotWellFormed XMLRPCFault = -32700
	// XmlrpcFaultParseErrorUnsupportedEncoding: request was in an unsupported
	// encoding.
	XmlrpcFaultParseErrorUnsupportedEncoding XMLRPCFault = -32701
	// XmlrpcFaultParseErrorInvalidCharacterForEncoding: request contained an
	// invalid character.
	XmlrpcFaultParseErrorInvalidCharacterForEncoding XMLRPCFault = -32702
	// XmlrpcFaultServerErrorInvalidXMLRpc: request was not valid XML-RPC.
	XmlrpcFaultServerErrorInvalidXMLRpc XMLRPCFault = -32600
	// XmlrpcFaultServerErrorRequestedMethodNotFound: method not found.
	XmlrpcFaultServerErrorRequestedMethodNotFound XMLRPCFault = -32601
	// XmlrpcFaultServerErrorInvalidMethodParameters: invalid parameters.
	XmlrpcFaultServerErrorInvalidMethodParameters XMLRPCFault = -32602
	// XmlrpcFaultServerErrorInternalXMLRpcError: internal error.
	XmlrpcFaultServerErrorInternalXMLRpcError XMLRPCFault = -32603
	// XmlrpcFaultApplicationError: start of reserved range for application
	// error codes.
	XmlrpcFaultApplicationError XMLRPCFault = -32500
	// XmlrpcFaultSystemError: start of reserved range for system error codes.
	XmlrpcFaultSystemError XMLRPCFault = -32400
	// XmlrpcFaultTransportError: start of reserved range for transport error
	// codes.
	XmlrpcFaultTransportError XMLRPCFault = -32300
)

func (XMLRPCFault) String

func (x XMLRPCFault) String() string

String returns the name in string for XMLRPCFault.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL