http-link-header: HTTP Link header parser/writer

[ library, public-domain, web ] [ Propose Tags ] [ Report a vulnerability ]

Library for the HTTP Link header as specified in RFC 5988 "Web Linking"


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0, 0.2.0, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.3.1, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3
Dependencies attoparsec, base (>=4.3 && <5), bytestring, errors, http-api-data, network-uri, text (<2.1.2) [details]
License LicenseRef-PublicDomain
Copyright 2014-2025 Val Packett <val@packett.cool>
Author Val Packett
Maintainer val@packett.cool
Revised Revision 1 made by AndreasAbel at 2025-04-12T19:31:00Z
Category Web
Home page https://codeberg.org/valpackett/http-link-header
Bug tracker https://codeberg.org/valpackett/http-link-header/issues
Source repo head: git clone https://codeberg.org/valpackett/http-link-header.git
Uploaded by valpackett at 2025-03-28T05:22:48Z
Distributions Debian:1.0.3.1, LTSHaskell:1.2.3, NixOS:1.2.1, Stackage:1.2.3
Reverse Dependencies 8 direct, 12 indirect [details]
Downloads 10025 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-03-28 [all 1 reports]

Readme for http-link-header-1.2.2

[back to package description]

Hackage unlicense Support me on Patreon

http-link-header

A Haskell library than implements a parser and a writer for the HTTP Link header as specified in RFC 5988 "Web Linking".

Usage

import Network.HTTP.Link
import Network.URI
import Data.Maybe

----- Writing
writeLinkHeader [ Link (fromJust $ parseURI "https://example.com/hello%20world") [(Rel, "next"), (Title, "hello world")]
                , Link (fromJust $ parseURI "https://yolo.tld") [(Rel, "license")] ]
-- "<https://example.com/hello%20world>; rel=\"next\"; title=\"hello world\", <https://yolo.tld>; rel=\"license\""

----- Parsing
parseLinkHeader "<https://example.com/2>; rel=\"next\", <https://example.com/0>; rel=prev"
-- Just [ Link https://example.com/2 [(Rel, "next")]
--      , Link https://example.com/0 [(Rel, "prev")] ]

Development

Use stack to build.
Use ghci to run tests quickly with :test (see the .ghci file).

$ stack build

$ stack test && rm tests.tix

$ stack bench

$ stack ghci --ghc-options="-fno-hpc"

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.