((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/hpack" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "hpack" (toc) (section 3 "Description" (p "A HTTP/2 header compression library for Chicken.")) (section 3 "Current status" (p "In its current form, the library correctly encodes and decodes HTTP2 headers. It implements Huffman encoding/decoding, indexed and literal header representations, header-tables etc. However, performance and error-handling need to be improved before production use.")) (section 3 "Author" (p "Omar Shorbaji")) (section 3 "Requirements" (p "defstruct")) (section 3 "API " (def (sig (procedure " (make-hpack-decoder) " (id make-hpack-decoder))) (p "returns a function that accepts a string and returns a list of headers decoded.")) (def (sig (procedure "(make-hpack-encoder)" (id make-hpack-encoder))) (p "returns a function that accepts a list of headers and returns an HPACK string. The function takes an optional argument telling it whether to index headers when possible or not. Note that a header is a pair of a symbol and a string")) (def (sig (procedure " (make-header-table #!optional (size: 4096) " (id #f))) (p "creates a header table for an encoder/decoder")) (def (sig (procedure " (hpack-encode header-table headers #!optional (index-headers? #t))" (id hpack-encode)) (procedure " (hpack-decode header-table code)" (id hpack-decode))) (p "Encode decode procedures using a header-table"))) (section 3 "Examples" (highlight scheme "(define encode (make-hpack-encoder))\n\n(define headers \n '((:authority . \"127.0.0.1\")\n   (:method . \"GET\")\n   (:scheme . \"http\")\n   (:path . \"/\")\n   (foo . \"bar\")))\n   \n\n(encode headers)\n;=> \"A�\\b�\\\\\\v�p����@���\\x03bar\"\n\n(encode headers index: #f)\n;.=> \"\\x11�\\b�\\\\\\v�p����\\x10���\\x03bar\"\n\n(define (decode (make-hpack-decoder)))\n\n(decode (encode headers))\n\n;=> ((:authority . \"127.0.0.1\")\n;   (:method . \"GET\")\n;   (:scheme . \"http\")\n;   (:path . \"/\")\n;   (foo . \"bar\"))")) (section 3 "Repository" (p (link "https://github.com/shorbaji/hpack"))) (section 3 "License" (pre ";; Copyright (c) 2014, Omar Shorbaji\n;; All rights reserved.\n;; \n;; Redistribution and use in source and binary forms, with or without\n;; modification, are permitted provided that the following conditions are met:\n;; \n;; Redistributions of source code must retain the above copyright notice, this\n;; list of conditions and the following disclaimer. \n;; Redistributions in binary form must reproduce the above copyright notice,\n;; this list of conditions and the following disclaimer in the documentation\n;; and/or other materials provided with the distribution.  \n;; Neither the name of the author nor the names of its contributors may be\n;; used to endorse or promote products derived from this software without\n;; specific prior written permission.  \n;; \n;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\n;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFcl\n;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n;; POSSIBILITY OF SUCH DAMAGE.\n")) (section 3 "Version History" (p "0.1  alpha release 0.2  updated api to include hpack-encode, hpack-decode and make-header-table"))))