The Snap team is excited to announce the release of version 0.6 of the Snap Framework. This is a big release with a lot of new functionality. Here is a list of the major changes since 0.5.5:
New features / improvements
The most significant new feature in 0.6 is the snaplet API. It is a ground-up rewrite of our previous extensions system. Snaplets are self-contained portions of websites that can be easily composed to create larger sites. The snaplet infrastructure makes it simple to distribute snaplets for others to use, and provides a clear pathway for contributing to the community. State management, built-in config file infrastructure, and automatic snaplet resource installation are some of the notable things the snaplet infrastructure does for you. For more information on getting started with snaplets, check out the snaplet tutorial. Also be sure to take a look at the API documentation. It is written as prose and should function as a more comprehensive, api-oriented tutorial.
Added a session management interface and a built-in snaplet back end based on HTTP cookies.
Added a snaplet interface for user authentication. Out of the box, Snap 0.6 comes with a simple sample implementation of this user authentication interface that stores user information on the filesystem as an example. We expect, however, that users choose a more sophisticated implementation of this interface corresponding to their choice of data store. Jurriën Stutterheim will be releasing an implementation based on HDBC within a few days.
Added a new testing API to snap-core to make it easier to test Snap applications. See the
Snap.Testmodule.The
Cookiedata structure got two new fields for flagging secure or HTTP-only cookies.Added a new convenience function
expireCookie.Made logging more flexible by allowing you to specify an arbitrary IO action.
heist: addedgetTemplateFilePathandaddTemplatePathPrefixfunctions.heist:markdownSpliceno longer requires the template directory as a parameter. It uses the directory of the template currently being processed.heist: added thetemplateNamesandspliceNamesfunctions to allow the user to see what templates and splices are being used by Heist.
API Changes
Headersfromsnap-corehas been changed to an opaque data type, and the implementation has changed fromData.Mapto the more efficientData.HashMapfromunordered-containers. This will break code that expectsHeadersto be a type alias forMap.The
Snap.Typesmodule has been renamed to the more appropriateSnap.Core.Snap.Typeshas been deprecated and made an alias, but will be going away with the next few major versions.heist: renamedTemplateMonadto the more appropriateHeistT. Again,TemplateMonadis still there, but deprecated and will be removed in a future release.heist: deprecated theText.Templating.Heist.Splices.Staticmodule. TheCachemodule now binds both a <cache> and <static> tag.Removed previously deprecated fileServe functions.
Deprecated the
getRequestBodyfunction fromSnap.Core; it read request bodies into memory without specifying a maximum size, meaning that an attacker could DoS a server using this function by uploading an arbitrarily large request. The function has been replaced byreadRequestBody, which forces you to choose a maximum length.Removed the deprecated
addCookiefunction.Added a mime type for JSON.
Dependency changes
- Increased the lower version bound on the case-insensitive package from 0.2 to 0.3.