### Function

# Soup ServerCallback

#### Declaration

    void
    (* SoupServerCallback) (
      SoupServer* server,
      SoupServerMessage* msg,
      const char* path,
      GHashTable* query,
      gpointer user_data
    )

#### Description [src]

A callback used to handle requests to a `SoupServer`.

`path` and `query` contain the likewise-named components of the Request-URI, subject to certain assumptions. By default, `SoupServer` 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 `SoupServer:raw-paths` property when creating the `SoupServer`, and it will leave those characters undecoded.

`query` contains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignore `query`, and call `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.

#### Parameters

`server`

  Type: `SoupServer`

  The `SoupServer`.

  The data is owned by the caller of the function.

`msg`

  Type: `SoupServerMessage`

  The message being processed.

  The data is owned by the caller of the function.

`path`

  Type: `const char*`

  The path component of `msg`‘s Request-URI.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`query`

  Type: `GHashTable`

  The parsed query component of `msg`‘s Request-URI.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`user_data`

  Type: `gpointer`

  The data passed to `soup_server_add_handler()` or `soup_server_add_early_handler()`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.