Skip to content

zellerin/http2

Repository files navigation

HTTP/2 in Common Lisp

https://github.com/zellerin/http2/actions/workflows/test.yml/badge.svg

This is an implementation of HTTP/2 protocol as described in RFC9113 (and RFC7540 before) and RFC7541 (HPACK). It provides both high-level interface as well as ways to fine tune its behaviour for better performance or specific use cases.

For quick start, quickload “http2” and run

(http2/client:retrieve-url "https://example.com")

to fetch a HTTP/2 resource, or check tutorials that show in more detail how to use the client or the server.

Status

In quicklisp.

Tested primarily on sbcl, occasionally on ecl. Clisp should work for the client, for server there are obvious limitations due to lack of threads

Almost all parts of the listed standards implemented, not necessary documented or declared stable

The current major version, 2.x.x., had a major internal rewrite can be considered stable with regard to the interface - that means, interface as documented in tutorials should not change in backward incompatible ways. The non-documented internal parts may. The documentation of some other API parts is being planned.

Missing pieces

  • No handling of priorities is implemented. This is more or lessOK, as these are only suggestions, and they are more or less dropped in RFC9113 anyway. But nothing from RFC9218 is implemented neither (except for the setting).
  • Push promises are not implemented in the client. This is OK, they are disabled by default (settings)
  • Option to encode headers to Literal Header Field Never Indexed format is not implemented. This is simple to do, but interface would need to be though out.
  • The algorithm to split data being sent out to windows and frames can be confused sometimes
  • The MAX-HEADER-LIST-SIZE limit is not enforced, but it is declared as an advisory setting anyway.
  • Some checks on behaviour of the peer are not enforced
  • The ping and setting frames are not automatically prioritized (they are replied as soon as processed, but nothing prevent finishing long response before that)

Dependencies

The core library used trivial-gray-streams to implement streams over data frames.

Client and server - or at least some server versions - require usocket and cl+ssl to talk over TLS, and bordeaux-threads for concurrency.

Client and server use puri to manipulate URLs.

Server also uses cffi directly to check and confirm alpn

Documentation is done with mgl-pax.

Additionally, fiasco is used for testing (and Javascript for browser-side testing).

Speed & scaling

The code was not written with speed as primary concern. Measurements depend on many tunable factor both on the client and the server (including platform).

Anyway, run or modify the speed test code for your results.

sbcl --script scaffolding/speed-test.lisp

License

Licensed by MIT license.

Some comments are taken over from the RFCs above and copyrighted by RFC contributors. I read the copyright licenses for RFC that this is allowed.

Related software

There is an Akamai code on https://github.com/akamai/cl-http2-protocol that supported bigger parts of the drafted HTTP/2 protocol in 2014; apparently hard if not impossible to run now. It used NPN instead of ALPN.

About

HTTP/2 implementation in Common Lisp

Topics

Resources

License

Stars

Watchers

Forks