Changelog for spacecookie-1.0.0.2

Revision history for spacecookie

1.0.0.2

2022-10-03

1.0.0.1

2021-11-29

This release fixes compilation with aeson >= 2.0.

1.0.0.0

2021-03-16

TL;DR:

Server and Library Users

Gophermap parsing

There have been quite a few, partly breaking changes to gophermap parsing in the library in an effort to fully support the format used in pygopherd and bucktooth. Instances where spacecookie's parsing deviated from the established format have been resolved and we now ship a test suite which checks compliance against sample files from bucktooth and pygopherd.

We now support relative paths correctly: If a selector in a gophermap doesn't start with / or URL: it is interpreted as a relative path and prefixed with the directory the gophermap is located in. This should make writing gophermaps much more convenient, as it isn't necessary to enter absolute selectors anymore. However, absolute selectors not starting with / are broken by this.

To facilitate these changes, the API of Network.Gopher.Util.Gophermap changed in the following way:

See also #22 and #23.

Menu lines which only contain a file type and name are now required to be terminated by a tab before the newline. This also reflects the behavior of bucktooth and pygopherd (although the latter's documentation on this is a bit misleading). Although this breaks entries like 0/file, info lines which start with a valid file type character like 1. foo bar baz no longer get mistaken for normal menu entries. See #34.

The remaining, less significant changes are:

Changes to Connection Handling

Server Users

Configuration

Config parsing should be backwards compatible. Please open a bug report if you experience any problems with that or any constellation of the new settings.

Other changes

Library Users

New Representation of Request and Response

The following changes are the most significant to the library as they break virtually all downstream usage of spacecookie as a library.

The gopher request handler for the runGopher-variants now receives a GopherRequest record representing the request instead of the selector as a String. The upsides of this are as follows:

If you want to reuse old handlers with minimal adjustments you can use a snippet like the following. Note though that you might have to make additional adjustments due to the changes to responses.

wrapLegacyHandler :: (String -> GopherResponse)
                  -> (GopherRequest -> GopherResponse)
wrapLegacyHandler f = f . uDecode . requestSelectorRaw

Corresponding to the switch to ByteString in GopherRequest the whole API now uses ByteString to represent paths and selectors. This prompts the following additional, breaking changes:

See also #38 and #26.

Logging

The built-in logging support has been removed in favor of a log handler the user can specify in GopherConfig. This is a breaking change in two ways:

The motivation for this was to enable the library user to influence the log output more. More specifically the following abilities were to be made possible for the bundled server daemon:

The best solution to guarantee these properties (and virtually any you could want) is to let the library user implement logging. This allows any target output, any kind of logging, any kind of clock interaction to generate timestamps (or not) etc. This is why the spacecookie library no longer implements logging. Instead it lets you configure a GopherLogHandler which may also be used by the user application (it is a simple IO action). This additionally scales well: In the simplest case this could be a trivial wrapper around putStrLn.

The second part to the solution is GopherLogStr which is the string type given to the handler. Internally this is currently implemented as a Seq containing chunks of Builders which are coupled with meta data. This should allow decent performance in building and rendering of GopherLogStrs. The latter of which is relatively convenient using FromGopherLogStr.

The tagged chunks are used to allow a clean implementation of hiding sensitive data: makeSensitive can be used to tag all chunks of a GopherLogStr which will then be picked up by hideSensitive which replaces all those chunks with [redacted]. This way sensitive information can be contained inline in strings and users can choose at any given point whether it should remain there or be hidden.

The new logging mechanism was implemented in #29.

Previously it was attempted to make built-in logging more configurable (see #13 and #19), but this was overly complicated and not as flexible as the new solution. Therefore it was scrapped in favor of the new system.

Other Changes

0.2.1.2 Bump fast-logger

2020-05-23

0.2.1.1 Fixed Privilege Dropping

2019-12-10

0.2.1.0 Systemd Support

2019-10-20

0.2.0.1 Hackage release

2019-05-23

Fixed a problem hindering the hackage release.

0.2.0.0 initial release

2019-05-23