header-utils
A Clojure library for handling gross things in HTTP headers. Specifically, it can encode and parse Content-Disposition headers UTF-8 content (RFC 6266), and exposes clean APIs for working with RFC 5987 encodings generally.
Usage
Content-Disposition
user=> (use 'header-utils.content-disposition)
user=> (def s (encode "attachment" "Y͢o҉u f̴ee̡l̡ ̶fée͝bl̢e.͡.pdf"))
user=> s
"attachment;filename*=UTF-8''Y%CD%A2o%D2%89u%20f%CC%B4ee%CC%A1l%CC%A1%20%CC%B6f%C3%A9e%CD%9Dbl%CC%A2e.%CD%A1.pdf"
user=> (parse-type s)
"attachment"
user=> (parse-filename s)
"Y͢o҉u f̴ee̡l̡ ̶fée͝bl̢e.͡.pdf"You can also specify language and additional parameters.
Other tools
My goal in writing this library was the handle Content-Disposition, but I took some pains to make the proximate tools as useful as possible. Specifically:
header-utils.parameters- encode and parse RFC 5987 parametersheader-utils.encoding- common tools for reading/writing header valuesheader-utils.parser- internal tool useful in extending the library (e.g. adding direct support for additional headers)
Todo
This library contains all the utilities required for adding explicit support for other headers, and actually doing so should be relatively easy. I'll add that support if/when I need them or you send me a PR.
License
Copyright © 2015 Zensight
Distributed under the MIT License. See LICENSE for more info.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
