Skip to content

v0.2.0

Compare
Choose a tag to compare
@arteymix arteymix released this 24 Aug 18:52
· 746 commits to master since this release

This is the first stable release of Valum and we are proud to announce that we have finally reached API stability. All subsequent releases will strictly follow semantic versioning.

You can verify the release against the following SHA1 checksum:

2fc3424edf560f65c52e86f51e07dcd45ad9e05e

Changeset

  • new lookup, sign and verify functions for cookies
  • move cookies-related utilities back in VSGI
  • set charset to UTF-8 in the default Content-Type header
  • write the error message in the response body if it's not used for a specific header
  • fix warnings for SCGI and handle IOError properly
  • fix owned references on callbacks
  • methods and all return the created Route objects
  • basic filters for Request and Response
  • next pass the Request and Response object for the next handler
  • documentation update and improvement
  • standalone examples for JSON, Lua, and Memcached

The sources have been restructured to follow GLib conventions and look much cleaner.

The cookies-related utilities have their place in VSGI as they provide compatible features that were usually found in libsoup-2.4, but not compatible with the Request and Response objects.

It is now possible to sign and verify cookies using HMAC signatures.

var signature = Cookies.sign (cookie, ChecksumType.SHA512, "secret".data);

It can later be verified and extracted with VSGI.Cookies.verify:

if (Cookies.verify (cookie, ChecksumType.SHA512, "secret".data, out @value) {
    // cookie is verified and the value is extracted in @value
}

Code, documentation and examples have been updated to use write_all instead of write, which will write until an error occur instead of writing as much as possible.

Instances of VSGI.Server will now require an application identifier used for DBus registration. This breaking change is required as it will make many things possible:

  • monitoring
  • worker discovery
  • GSettings integration

The identifier is the first argument of Server:

new Server ("org.valum.App", (req, res) => {
    res.body.write_all ("Hello world!".data, null);
});

Filters

A filter is a decorator pattern used to modify the regular behavior of Request and Response objects. They can be used to perform various transformations such as stream compression, stream redirection, buffering and immutability.

FilteredRequest and FilteredResponse provide basis to build pretty much any possible filters. It is planned to provide a good set of filters in a future minor release (see issue #117 for more details).

The NextCallback has been redesigned to pass the filtered Request and Response objects in order to integrate nicely with the available filters.

app.get ("", (req, res) => {
    next (req, new BufferedResponse (res, 1024));
}).then ((req, res) => {
    res.body.write_all ("Hello world!".data, null);
});