[Haskell-cafe] Snap 0.4 Released!

Gregory Collins greg at gregorycollins.net
Sun Feb 6 18:00:58 CET 2011


The Snap team is proud to announce the release of Snap 0.4,
containing a whole bunch of nifty new features. Here is what we've
been up to:

New Features
------------

-   Heist now uses the brand new xmlhtml HTML5 parser for parsing
    and rendering templates. This eliminates our dependency on XML and
    makes it possible to include inline javascript/css in templates.
    Check out Chris Smith's blog post for more information about
    xmlhtml.

-   Along with the change to xmlhtml, we decided to convert Heist
    to use Text instead of ByteString. This is a backwards-incompatible
    change which breaks old code, but which we feel is the right thing
    to do.

-   Snap now has support for file uploads (!) and the
    multipart/form-data content type. Snap's file upload support uses
    iteratees to stream uploaded data and comes with a convenience
    function to writeuploaded files to a temporary directory. We put
    significant effort into preventing denial of service attacks and
    providing policy controls for things like maximum allowable file
    size, upload timeouts, minimum upload speed, etc.

-   The web server now uses blaze-builder in the output response
    body Enumerator. Besides being significantly faster for most
    workloads than ByteString enumeration, this allowed us to save
    several copies within the server code, giving us a moderate
    performance improvement. However, this will break any existing code
    making direct use of the output enumerator rather than using
    convenience functions like writeBS. We encourage users who are
    building up large responses out of lots of little bytestring chunks
    to consider switching their code to using Builder and writeBuilder
    to get a speed boost.

-   The "development mode" of projects built using our snap project
    starter is now quite a bit smarter. The 0.3 version used hint to
    interpret web handlers on-the-fly, but it re-interpreted the code
    on each request, making keeping in-memory state between requests
    impossible. The development mode now only rebuilds the project when
    files actually change. State will now be preserved across requests
    as long as the project files are not changed on disk.

-   Our file serving code has been substantially
    improved/rewritten. The new code can automatically generate
    stylable/themable directory indexes, provides configurable lists of
    index files, and allows the user to plug in dynamic handlers. These
    handlers can be used to perform arbitrary transformations based on
    file type or file content on the fly. The new code also correctly
    handles trailing slashes for relative path resolution.

-   It is now possible for user handlers to modify socket timeouts,
    using the setTimeout function. This (finally) makes it possible to
    have long-running request handlers.


Bugfixes/Improvements
---------------------

-   Debugging support in snap-core is now turned off by default, as
    it involves too much of a performance impact. Turning on debug
    support results in a ~25% performance penalty. To turn debugging
    output back on, pass the -f debug flag when installing snap-core.

-   Bugfix: we no longer log spurious "thread killed" messages in
    the simple backend under HTTP/1.0.

-   Added catchFinishWith function.

-   Changed cookie interface to expose cookies in the response as a
    map for easier manipulation.

As always, please let us know if you find any issues with the release.

Thanks!
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list