SoupServer

SoupServer — HTTP server

Synopsis




struct      SoupServer;
            SoupServerContext;
void        (*SoupServerCallbackFn)         (SoupServerContext *context,
                                             SoupMessage *msg,
                                             gpointer user_data);
void        (*SoupServerUnregisterFn)       (SoupServer *server,
                                             SoupServerHandler *handler,
                                             gpointer user_data);
SoupServer* soup_server_new                 (const char *optname1,
                                             ...);
SoupProtocol soup_server_get_protocol       (SoupServer *serv);
guint       soup_server_get_port            (SoupServer *serv);
SoupSocket* soup_server_get_listener        (SoupServer *serv);
void        soup_server_run                 (SoupServer *serv);
void        soup_server_run_async           (SoupServer *serv);
void        soup_server_quit                (SoupServer *serv);

typedef     SoupServerHandler;
void        soup_server_add_handler         (SoupServer *serv,
                                             const char *path,
                                             SoupServerAuthContext *auth_ctx,
                                             SoupServerCallbackFn callback,
                                             SoupServerUnregisterFn unreg,
                                             gpointer data);
void        soup_server_remove_handler      (SoupServer *serv,
                                             const char *path);
SoupServerHandler* soup_server_get_handler  (SoupServer *serv,
                                             const char *path);
GSList*     soup_server_list_handlers       (SoupServer *serv);
SoupAddress* soup_server_context_get_client_address
                                            (SoupServerContext *ctx);
const char* soup_server_context_get_client_host
                                            (SoupServerContext *ctx);

#define     SOUP_SERVER_PORT
#define     SOUP_SERVER_INTERFACE
#define     SOUP_SERVER_SSL_CERT_FILE
#define     SOUP_SERVER_SSL_KEY_FILE
#define     SOUP_SERVER_ASYNC_CONTEXT


Object Hierarchy


  GObject
   +----SoupServer

Properties


  "async-context"        gpointer              : Read / Write / Construct Only
  "interface"            SoupAddress           : Read / Write / Construct Only
  "port"                 guint                 : Read / Write / Construct Only
  "ssl-cert-file"        gchararray            : Read / Write / Construct Only
  "ssl-key-file"         gchararray            : Read / Write / Construct Only

Description

SoupServer implements a simple HTTP server.

This API is less stable than the soup client API, and will most likely change in the next release.

Details

struct SoupServer

struct SoupServer;


SoupServerContext

typedef struct {
	SoupMessage       *msg;
	char              *path;
	SoupMethodId       method_id;
	SoupServerAuth    *auth;
	SoupServer        *server;
	SoupServerHandler *handler;
	SoupSocket        *sock;
} SoupServerContext;


SoupServerCallbackFn ()

void        (*SoupServerCallbackFn)         (SoupServerContext *context,
                                             SoupMessage *msg,
                                             gpointer user_data);

context :
msg :
user_data :

SoupServerUnregisterFn ()

void        (*SoupServerUnregisterFn)       (SoupServer *server,
                                             SoupServerHandler *handler,
                                             gpointer user_data);

server :
handler :
user_data :

soup_server_new ()

SoupServer* soup_server_new                 (const char *optname1,
                                             ...);

optname1 :
... :
Returns :

soup_server_get_protocol ()

SoupProtocol soup_server_get_protocol       (SoupServer *serv);

serv :
Returns :

soup_server_get_port ()

guint       soup_server_get_port            (SoupServer *serv);

serv :
Returns :

soup_server_get_listener ()

SoupSocket* soup_server_get_listener        (SoupServer *serv);

serv :
Returns :

soup_server_run ()

void        soup_server_run                 (SoupServer *serv);

serv :

soup_server_run_async ()

void        soup_server_run_async           (SoupServer *serv);

serv :

soup_server_quit ()

void        soup_server_quit                (SoupServer *serv);

serv :

SoupServerHandler

typedef struct SoupServerHandler SoupServerHandler;


soup_server_add_handler ()

void        soup_server_add_handler         (SoupServer *serv,
                                             const char *path,
                                             SoupServerAuthContext *auth_ctx,
                                             SoupServerCallbackFn callback,
                                             SoupServerUnregisterFn unreg,
                                             gpointer data);

serv :
path :
auth_ctx :
callback :
unreg :
data :

soup_server_remove_handler ()

void        soup_server_remove_handler      (SoupServer *serv,
                                             const char *path);

serv :
path :

soup_server_get_handler ()

SoupServerHandler* soup_server_get_handler  (SoupServer *serv,
                                             const char *path);

serv :
path :
Returns :

soup_server_list_handlers ()

GSList*     soup_server_list_handlers       (SoupServer *serv);

serv :
Returns :

soup_server_context_get_client_address ()

SoupAddress* soup_server_context_get_client_address
                                            (SoupServerContext *ctx);

ctx :
Returns :

soup_server_context_get_client_host ()

const char* soup_server_context_get_client_host
                                            (SoupServerContext *ctx);

ctx :
Returns :

SOUP_SERVER_PORT

#define SOUP_SERVER_PORT          "port"

An alias for the "port" property.


SOUP_SERVER_INTERFACE

#define SOUP_SERVER_INTERFACE     "interface"

An alias for the "interface" property.


SOUP_SERVER_SSL_CERT_FILE

#define SOUP_SERVER_SSL_CERT_FILE "ssl-cert-file"

An alias for the "ssl-cert-file" property.


SOUP_SERVER_SSL_KEY_FILE

#define SOUP_SERVER_SSL_KEY_FILE  "ssl-key-file"

An alias for the "ssl-key-file" property.


SOUP_SERVER_ASYNC_CONTEXT

#define SOUP_SERVER_ASYNC_CONTEXT "async-context"

An alias for the "async-context" property.

Properties

The "async-context" property

  "async-context"        gpointer              : Read / Write / Construct Only

The GMainContext to dispatch async I/O in.


The "interface" property

  "interface"            SoupAddress           : Read / Write / Construct Only

Address of interface to listen on.


The "port" property

  "port"                 guint                 : Read / Write / Construct Only

Port to listen on.

Allowed values: <= 65536

Default value: 0


The "ssl-cert-file" property

  "ssl-cert-file"        gchararray            : Read / Write / Construct Only

File containing server SSL certificate.

Default value: NULL


The "ssl-key-file" property

  "ssl-key-file"         gchararray            : Read / Write / Construct Only

File containing server SSL key.

Default value: NULL