Gjsify LogoGjsify Logo

Class implementing an HTTP server.

Hierarchy

Index

Constructors

Properties

gTypeInstance: TypeInstance
parentInstance: GObject.Object
rawPaths: boolean
serverHeader: string

If non-%NULL, the value to use for the "Server" header on #SoupServerMessages processed by this server.

The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes.

As with #SoupSession:user_agent, if you set a #SoupServer:server_header property that has trailing whitespace, #SoupServer will append its own product token (eg, "libsoup/2.3.2") to the end of the header for you.

A #GTlsAuthenticationMode for SSL/TLS client authentication

tlsCertificate: TlsCertificate

A #GTlsCertificate that has a #GTlsCertificate:private-key set. If this is set, then the server will be able to speak https in addition to (or instead of) plain http.

tlsDatabase: TlsDatabase

A #GTlsDatabase to use for validating SSL/TLS client certificates.

$gtype: GType<Soup.Server>
name: string

Methods

  • Add a new client stream to the server.

    Parameters

    • stream: IOStream

      a #GIOStream

    • localAddr: SocketAddress

      the local #GSocketAddress associated with the stream

    • remoteAddr: SocketAddress

      the remote #GSocketAddress associated with the stream

    Returns boolean

  • Adds an authentication domain to server. Each auth domain will have the chance to require authentication for each request that comes in; normally auth domains will require authentication for requests on certain paths that they have been set up to watch, or that meet other criteria set by the caller. If an auth domain determines that a request requires authentication (and the request doesn't contain authentication), server will automatically reject the request with an appropriate status (401 Unauthorized or 407 Proxy Authentication Required). If the request used the SoupServer:100-continue Expectation, server will reject it before the request body is sent.

    Parameters

    Returns void

  • Adds an "early" handler to server for requests prefixed by path. Note that "normal" and "early" handlers are matched up together, so if you add a normal handler for "/foo" and an early handler for "/foo/bar", then a request to "/foo/bar" (or any path below it) will run only the early handler. (But if you add both handlers at the same path, then both will get run.)

    For requests under path (that have not already been assigned a status code by a #SoupAuthDomain or a signal handler), callback will be invoked after receiving the request headers, but before receiving the request body; the message's method and request-headers properties will be set.

    Early handlers are generally used for processing requests with request bodies in a streaming fashion. If you determine that the request will contain a message body, normally you would call soup_message_body_set_accumulate() on the message's request-body to turn off request-body accumulation, and connect to the message's #SoupServerMessage::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 #SoupServerMessage::got-body, or else you can register a non-early handler for path as well. As long as you have not set the status-code by the time #SoupServerMessage::got-body is emitted, the non-early handler will be run as well.

    Parameters

    • path: string

      the toplevel path for the handler

    • callback: Soup.ServerCallback

      callback to invoke for requests under path

    Returns void

  • Adds a handler to server for requests prefixed by path. If path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler. (Note though that if you want to handle requests to the special "" URI, you must explicitly register a handler for ""; the default handler will not be used for that case.)

    For requests under path (that have not already been assigned a status code by a #SoupAuthDomain, an early server handler, or a signal handler), callback will be invoked after receiving the request body; the #SoupServerMessage's method, request-headers, and request-body properties will be set.

    After determining what to do with the request, the callback must at a minimum call soup_server_message_set_status() on the message to set the response status code. Additionally, it may set response headers and/or fill in the response body.

    If the callback cannot fully fill in the response before returning (eg, if it needs to wait for information from a database, or another network server), it should call 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 response-headers. Then call soup_message_body_append() (or soup_message_body_append_bytes)) 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.

    Parameters

    • path: string

      the toplevel path for the handler

    • callback: Soup.ServerCallback

      callback to invoke for requests under path

    Returns void

  • addWebsocketExtension(extensionType: GType<unknown>): void
  • Add support for a WebSocket extension of the given extension_type. When a WebSocket client requests an extension of extension_type, a new #SoupWebsocketExtension of type extension_type will be created to handle the request.

    Note that #SoupWebsocketExtensionDeflate is supported by default, use soup_server_remove_websocket_extension() if you want to disable it.

    Parameters

    • extensionType: GType<unknown>

      a #GType

    Returns void

  • Adds a WebSocket handler to server for requests prefixed by path. (If path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler.)

    When a path has a WebSocket handler registered, server will check incoming requests for WebSocket handshakes after all other handlers have run (unless some earlier handler has already set a status code on the message), and update the request's status, response headers, and response body accordingly.

    If origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. More complicated requirements can be handled by adding a normal handler to path, and having it perform whatever checks are needed and setting a failure status code if the handshake should be rejected.

    Parameters

    • path: string

      the toplevel path for the handler

    • origin: string

      the origin of the connection

    • protocols: string[]

      the protocols supported by this handler

    • callback: Soup.ServerWebsocketCallback

      callback to invoke for successful WebSocket requests under path

    Returns void

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned #GBinding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A #GObject can have multiple bindings.

    Parameters

    • sourceProperty: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • targetProperty: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.

    Parameters

    • sourceProperty: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • targetProperty: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transformTo: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transformFrom: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • connect(sigName: "request-aborted", callback: Soup.Server_RequestAbortedSignalCallback): number
  • connect(sigName: "request-finished", callback: Soup.Server_RequestFinishedSignalCallback): number
  • connect(sigName: "request-read", callback: Soup.Server_RequestReadSignalCallback): number
  • connect(sigName: "request-started", callback: Soup.Server_RequestStartedSignalCallback): number
  • connect(sigName: "notify::raw-paths", callback: ((...args: any[]) => void)): number
  • connect(sigName: "notify::server-header", callback: ((...args: any[]) => void)): number
  • connect(sigName: "notify::tls-auth-mode", callback: ((...args: any[]) => void)): number
  • connect(sigName: "notify::tls-certificate", callback: ((...args: any[]) => void)): number
  • connect(sigName: "notify::tls-database", callback: ((...args: any[]) => void)): number
  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • disconnect(): void
  • Closes and frees server's listening sockets.

    Note that if there are currently requests in progress on server, that they will continue to be processed if server's #GMainContext is still running.

    You can call soup_server_listen(), etc, after calling this function if you want to start listening again.

    Returns void

  • emit(sigName: "request-aborted", ...args: any[]): void
  • emit(sigName: "request-finished", ...args: any[]): void
  • emit(sigName: "request-read", ...args: any[]): void
  • emit(sigName: "request-started", ...args: any[]): void
  • emit(sigName: "notify::raw-paths", ...args: any[]): void
  • emit(sigName: "notify::server-header", ...args: any[]): void
  • emit(sigName: "notify::tls-auth-mode", ...args: any[]): void
  • emit(sigName: "notify::tls-certificate", ...args: any[]): void
  • emit(sigName: "notify::tls-database", ...args: any[]): void
  • emit(sigName: string, ...args: any[]): void
  • Parameters

    • sigName: "request-aborted"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "request-finished"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "request-read"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "request-started"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "notify::raw-paths"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "notify::server-header"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "notify::tls-auth-mode"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "notify::tls-certificate"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: "notify::tls-database"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • sigName: string
    • Rest ...args: any[]

    Returns void

  • forceFloating(): void
  • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • freezeNotify(): void
  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • getData(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

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

    Returns Gio.Socket[]

  • getProperty(propertyName?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional propertyName: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • getQdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • 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 0.0.0.0 and ::, rather than actually returning separate URIs for each interface on the system.

    Returns GLib.Uri[]

  • getv(names: string[], values: any[]): void
  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • isFloating(): boolean
  • isHttps(): boolean
  • 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 #SoupServer:tls-certificate property, to provide it with a certificate to use.

    If you are using the deprecated single-listener APIs, then a return value of %TRUE indicates that the #SoupServer serves https exclusively. If you are using soup_server_listen(), etc, then a %TRUE return value merely indicates that the server is able to do https, regardless of whether it actually currently is or not. Use soup_server_get_uris() to see if it currently has any https listeners.

    Returns boolean

  • 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 #GMainContext is run.

    Note that #SoupServer 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.

    Parameters

    Returns boolean

  • This attempts to set up server to listen for connections on all interfaces on the system. (That is, it listens on the addresses 0.0.0.0 and/or ::, depending on whether options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither.) If port is specified, server will listen on that port. If it is 0, server will find an unused port to listen on. (In that case, you can use soup_server_get_uris() to find out what port it ended up choosing.)

    See soup_server_listen() for more details.

    Parameters

    Returns boolean

  • This attempts to set up server to listen for connections on "localhost" (that is, 127.0.0.1 and/or ::1, depending on whether options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither). If port is specified, server will listen on that port. If it is 0, server will find an unused port to listen on. (In that case, you can use soup_server_get_uris() to find out what port it ended up choosing.)

    See soup_server_listen() for more details.

    Parameters

    Returns boolean

  • This attempts to set up server to listen for connections on socket.

    See soup_server_listen() for more details.

    Parameters

    Returns boolean

  • notify(propertyName: string): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • propertyName: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • off(sigName: "request-aborted", callback: Soup.Server_RequestAbortedSignalCallback): EventEmitter
  • off(sigName: "request-finished", callback: Soup.Server_RequestFinishedSignalCallback): EventEmitter
  • off(sigName: "request-read", callback: Soup.Server_RequestReadSignalCallback): EventEmitter
  • off(sigName: "request-started", callback: Soup.Server_RequestStartedSignalCallback): EventEmitter
  • off(sigName: "notify::raw-paths", callback: ((...args: any[]) => void)): EventEmitter
  • off(sigName: "notify::server-header", callback: ((...args: any[]) => void)): EventEmitter
  • off(sigName: "notify::tls-auth-mode", callback: ((...args: any[]) => void)): EventEmitter
  • off(sigName: "notify::tls-certificate", callback: ((...args: any[]) => void)): EventEmitter
  • off(sigName: "notify::tls-database", callback: ((...args: any[]) => void)): EventEmitter
  • off(sigName: string, callback: ((...args: any[]) => void)): EventEmitter
  • on(sigName: "request-aborted", callback: Soup.Server_RequestAbortedSignalCallback, after?: boolean): EventEmitter
  • on(sigName: "request-finished", callback: Soup.Server_RequestFinishedSignalCallback, after?: boolean): EventEmitter
  • on(sigName: "request-read", callback: Soup.Server_RequestReadSignalCallback, after?: boolean): EventEmitter
  • on(sigName: "request-started", callback: Soup.Server_RequestStartedSignalCallback, after?: boolean): EventEmitter
  • on(sigName: "notify::raw-paths", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • on(sigName: "notify::server-header", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • on(sigName: "notify::tls-auth-mode", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • on(sigName: "notify::tls-certificate", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • on(sigName: "notify::tls-database", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • on(sigName: string, callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    • sigName: "notify::raw-paths"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::server-header"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-auth-mode"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-certificate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-database"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • once(sigName: "request-aborted", callback: Soup.Server_RequestAbortedSignalCallback, after?: boolean): EventEmitter
  • once(sigName: "request-finished", callback: Soup.Server_RequestFinishedSignalCallback, after?: boolean): EventEmitter
  • once(sigName: "request-read", callback: Soup.Server_RequestReadSignalCallback, after?: boolean): EventEmitter
  • once(sigName: "request-started", callback: Soup.Server_RequestStartedSignalCallback, after?: boolean): EventEmitter
  • once(sigName: "notify::raw-paths", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • once(sigName: "notify::server-header", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • once(sigName: "notify::tls-auth-mode", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • once(sigName: "notify::tls-certificate", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • once(sigName: "notify::tls-database", callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • once(sigName: string, callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Parameters

    • sigName: "notify::raw-paths"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::server-header"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-auth-mode"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-certificate"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: "notify::tls-database"
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • 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 a #SoupServerMessage which was created by the #SoupServer and are currently doing I/O, such as those passed into a #SoupServerCallback or emitted in a #SoupServer::request-read signal.

    Parameters

    Returns void

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

  • removeHandler(path: string): void
  • Removes all handlers (early and normal) registered at path.

    Parameters

    • path: string

      the toplevel path for the handler

    Returns void

  • removeWebsocketExtension(extensionType: GType<unknown>): void
  • Removes support for WebSocket extension of type extension_type (or any subclass of extension_type) from server.

    Parameters

    • extensionType: GType<unknown>

      a #GType

    Returns void

  • runDispose(): void
  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    Returns void

  • setData(key: string, data?: object): void
  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a #GQuark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • setProperty(propertyName: string, value?: any): void
  • Sets a property on an object.

    Parameters

    • propertyName: string

      the name of the property to set

    • Optional value: any

      the value

    Returns void

  • Sets server up to do https, using the given SSL/TLS certificate.

    Parameters

    Returns void

  • Sets server's #GTlsDatabase to use for validating SSL/TLS client certificates

    Parameters

    Returns void

  • stealData(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • stealQdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • thawNotify(): void
  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • 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 a #SoupServerMessage which was created by the #SoupServer and are currently doing I/O, such as those passed into a #SoupServerCallback or emitted in a #SoupServer::request-read signal.

    Parameters

    Returns void

  • unref(): void
  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.

    Returns void

  • watchClosure(closure: TClosure<any, any>): void
  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • compatControl(what: number, data: object): number
  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • propertyName: string

      name of a property to look up.

    Returns ParamSpec

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of #GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • objectType: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method