chez-libs

Update of "(network soup)"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: bbd93158c2988d83bbbde5ef14d8b118c5294f3c
Page Name:(network soup)
Date: 2016-05-26 15:05:13
Original User: murphy
Parent: 54b158eecf1ca2df31c75eb5919194d076913637 (diff)
Content

libsoup Bindings

Synopsis

(import (network soup))

Basic bindings to the libsoup HTTP library.

Client Operations

procedure: ((soup-client) method uri proc-response)

procedure: ((soup-client) method uri proc-request proc-response)

Creates a new client request procedure. When called, a new soup message is set up using the request procedure, if any. The message is then dispatched asynchronously and the response can be processed in the second callback procedure. Either callback may be #f.

Both callbacks are applied to the method and URI within a dynamic environment that allows access to the request or response body and headers.

Server Operations

procedure: (soup-server proc)

procedure: (soup-server proc port)

procedure: (soup-server proc host port)

Creates a new server object. The given procedure will be invoked with the request method and URI of each request. If no host is specified, the server will listen only to local requests. If no port is specified, the server will listen on a random port.

The server is started asynchronously and will run in the GLib main loop.

procedure: (soup-server-port srv)

Retrieves the listening port of the given server.

procedure: (soup-server-close srv)

Disconnects the server from the network.

Request Environment

parameter: current-soup-client

Holds the host address of the client that issued the current request.

parameter: current-soup-message

Holds a reference to the SoupMessage object for the current request.

procedure: (request-header name)

procedure: (request-header name value)

Retrieves the request header with the given name or adds a new header with that name.

procedure: (response-header name)

procedure: (response-header name value)

Retrieves the response header with the given name or adds a new header with that name.

procedure: (open-request-body-output-port)

procedure: (open-request-body-output-port transcoder)

Opens an output port to write to the request body. If no transcoder or #f is given, the result is a binary output port. If a transcoder or #t is passed, the result is a textual output port. If the transcoder argument is #t, the codec for the port is guessed from the charset parameter in the request's Content-Type header.

procedure: (open-response-body-output-port)

procedure: (open-response-body-output-port transcoder)

Opens an output port to write to the response body. If no transcoder or #f is given, the result is a binary output port. If a transcoder or #t is passed, the result is a textual output port. If the transcoder argument is #t, the codec for the port is guessed from the charset parameter in the response's Content-Type header.

procedure: (open-request-body-input-port)

procedure: (open-request-body-input-port transcoder)

Opens an input port to read from the request body. If no transcoder or #f is given, the result is a binary input port. If a transcoder or #t is passed, the result is a textual input port. If the transcoder argument is #t, the codec for the port is guessed from the charset parameter in the request's Content-Type header.

procedure: (open-response-body-input-port)

procedure: (open-response-body-input-port transcoder)

Opens an input port to read from the response body. If no transcoder or #f is given, the result is a binary input port. If a transcoder or #t is passed, the result is a textual input port. If the transcoder argument is #t, the codec for the port is guessed from the charset parameter in the response's Content-Type header.