HPACK (RFC 7541) implementation in Swift.
Encoding a set of headerslet headers: [Header] = [ (":method", "GET"), (":path", "/"), ("Accept", "application/json"), ] let encoder = hpack.Encoder() let bytes = try encoder.encode(headers) print(bytes)
You may also pass a secure parameter when encoding a header, which allows you to prevent the header from being added to the header table.
let bytes = try encoder.encode([ ("secret", "secret-key", true), ]) print(bytes)Decoding a set of headers
let bytes: [UInt8] = [130] let decoder = hpack.Decoder() let headers = try decoder.decode(bytes) for header in headers { print(header.name) print(header.value) }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4