zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

README.md (2854B)


      1 # HPAX
      2 
      3 ![CI](https://github.com/elixir-mint/hpax/actions/workflows/main.yml/badge.svg)
      4 [![Docs](https://img.shields.io/badge/api-docs-green.svg?style=flat)](https://hexdocs.pm/hpax)
      5 [![Hex.pm Version](http://img.shields.io/hexpm/v/hpax.svg?style=flat)](https://hex.pm/packages/hpax)
      6 [![Coverage Status](https://coveralls.io/repos/github/elixir-mint/hpax/badge.svg?branch=main)](https://coveralls.io/github/elixir-mint/hpax?branch=main)
      7 
      8 HPAX is an Elixir implementation of the HPACK header compression algorithm as used in HTTP/2 and
      9 defined in RFC 7541. HPAX is used by several Elixir projects, including the
     10 [Mint](https://github.com/elixir-mint/mint) HTTP client and
     11 [bandit](https://github.com/mtrudel/bandit) HTTP server projects.
     12 
     13 ## Installation
     14 
     15 To install HPAX, add it to your `mix.exs` file.
     16 
     17 ```elixir
     18 defp deps do
     19   [
     20     {:hpax, "~> 0.1.0"}
     21   ]
     22 end
     23 ```
     24 
     25 Then, run `$ mix deps.get`.
     26 
     27 ## Usage
     28 
     29 HPAX is designed to be used in both encoding and decoding scenarios. In both cases, a context is
     30 used to maintain state internal to the HPACK algorithm. In the common use case of using HPAX
     31 within HTTP/2, this context is called a **table** and must be shared between any
     32 subsequent encoding/decoding calls within
     33 an endpoint. Note that the contexts used for encoding and decoding within HTTP/2 are completely
     34 distinct from one another, even though they are structurally identical.
     35 
     36 To encode a set of headers into a binary with HPAX:
     37 
     38 ```elixir
     39 context = HPAX.new(4096)
     40 headers = [{:store, ":status", "201"}, {:store, "location", "http://example.com"}]
     41 {encoded_headers, context} = HPAX.encode(headers, context)
     42 #=> {iodata, updated_context}
     43 ```
     44 
     45 To decode a binary into a set of headers with HPAX:
     46 
     47 ```elixir
     48 context = HPAX.new(4096)
     49 encoded_headers = <<...>>
     50 {:ok, headers, context} = HPAX.decode(encoded_headers, context)
     51 #=> {:ok, [{:store, ":status", "201"}, {:store, "location", "http://example.com"}], updated_context}
     52 ```
     53 
     54 For complete usage information, please see the HPAX [documentation](https://hex.pm/packages/hpax).
     55 
     56 ## Contributing
     57 
     58 If you wish to contribute check out the [issue list](https://github.com/elixir-mint/hpax/issues) and let us know what you want to work on so we can discuss it and reduce duplicate work.
     59 
     60 ## License
     61 
     62 Copyright 2021 Eric Meadows-Jönsson and Andrea Leopardi
     63 
     64   Licensed under the Apache License, Version 2.0 (the "License");
     65   you may not use this file except in compliance with the License.
     66   You may obtain a copy of the License at
     67 
     68       http://www.apache.org/licenses/LICENSE-2.0
     69 
     70   Unless required by applicable law or agreed to in writing, software
     71   distributed under the License is distributed on an "AS IS" BASIS,
     72   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     73   See the License for the specific language governing permissions and
     74   limitations under the License.