~/bend-docscommunity

src/hpack.bend checks

raw source on the hub · import bend-kube-runtime@0.10.0.0/src/hpack.bend as Hpack

2 imports
import Base
import ./http.bend as H

Types

type HCode source · line 30 · raw

Data

type HLen source · line 33 · raw

Data

type HBits source · line 1242 · raw

Data

type HHuf source · line 1310 · raw

Data

type HTab source · line 1401 · raw

Data

type HK source · line 1492 · raw

Data

What an integer is for, once whole. KIdx: an indexed header field KName: a literal's name index (0: the name follows); ix adds the header to the table KSize: a dynamic table size update KLen: a string's length; name is None for the name string, else the name the value goes with

type HSt source · line 1504 · raw

Data

Where the decoder is. HOp: before a field's first byte HInt: inside an integer, acc so far, m the next 7 bits' shift HLit: before a string's first byte (its H bit and length) HStr: left bytes of a string to go, acc reversed HBad: a block the decoder refuses; it stays here

type HDec source · line 1515 · raw

Data

A decoder: the dynamic table and its size and maximum; limit, the most the encoder may raise the maximum to (our SETTINGS_HEADER_TABLE_SIZE); cap, the header list's limit; and the block so far: its list size, its headers reversed, and whether a header has come.

type HBlock source · line 1519 · raw

Data

type HEnc source · line 1717 · raw

Data

An encoder: its table, the table's size and maximum, the smallest maximum since the last block if the peer changed it, and whether to Huffman-code strings.

type HEBlock source · line 1720 · raw

Data

type HSeq source · line 1802 · raw

Data

Definitions

def Hp.statics source · line 42 · raw

List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

The static table (Appendix A), index 1 first.

def Hp.code source · line 106 · raw

@s:U32 -> HCode

Each symbol's Huffman code and its length in bits (Appendix B).

def Hp.sym source · line 624 · raw

@i:U32 -> U32

The symbols in canonical order: by code length, then by symbol.

def Hp.len source · line 1143 · raw

@l:U32 -> HLen

For each code length: its first code, how many codes have it, and the first's place in Hp.sym's order.

def Hp.bytes source · line 1193 · raw

@s:String -> List<&2, U32>

def Hp.text source · line 1200 · raw

@bs:List<&2, U32> -> String

def Hp.slen source · line 1207 · raw

@s:String -> U32

def Hp.esize source · line 1211 · raw

@h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> U32

A header's size in a table or a header list: name, value and 32.

def Hp.int.rest source · line 1219 · raw

@fuel:Nat -> @+v:U32 -> @last:Bool -> List<&2, U32>

def Hp.int.go source · line 1228 · raw

@+flags:U32 -> @+full:U32 -> @+v:U32 -> @small:Bool -> List<&2, U32>

def Hp.int source · line 1236 · raw

@+flags:U32 -> @+full:U32 -> @+v:U32 -> List<&2, U32>

v with an N-bit prefix, full = 2^N - 1, after the bits in flags.

def Hp.put1.go source · line 1245 · raw

@+acc:U32 -> @+n:U32 -> @out:List<&2, U32> -> @full:Bool -> HBits

def Hp.put1 source · line 1252 · raw

@st:HBits -> @+bit:U32 -> HBits

def Hp.push source · line 1258 · raw

@+i:Nat -> @+code:U32 -> @st:HBits -> HBits

The low i bits of code, high first.

def Hp.huff.one source · line 1265 · raw

@c:HCode -> @st:HBits -> HBits

def Hp.huff.go source · line 1270 · raw

@bs:List<&2, U32> -> @st:HBits -> HBits

def Hp.huff.pad source · line 1277 · raw

@+acc:U32 -> @+n:U32 -> @out:List<&2, U32> -> @whole:Bool -> List<&2, U32>

def Hp.huff.fin source · line 1285 · raw

@st:HBits -> List<&2, U32>

def Hp.huff source · line 1291 · raw

@bs:List<&2, U32> -> List<&2, U32>

Huffman-codes bytes, the last padded with the top bits of EOS (all 1s).

def Hp.code_len source · line 1294 · raw

@c:HCode -> U32

def Hp.huff_bits source · line 1299 · raw

@bs:List<&2, U32> -> U32

def Hp.huff_len source · line 1307 · raw

@bs:List<&2, U32> -> U32

How many bytes Hp.huff makes of bs.

def Hp.unhuff.sym source · line 1314 · raw

@+sym:U32 -> @out:String -> @eos:Bool -> HHuf

def Hp.unhuff.hit source · line 1321 · raw

@+c:U32 -> @+l:U32 -> @out:String -> @+sym:U32 -> @hit:Bool -> @long:Bool -> HHuf

def Hp.unhuff.at source · line 1330 · raw

@+c:U32 -> @+l:U32 -> @out:String -> @hl:HLen -> HHuf

def Hp.unhuff.bit source · line 1338 · raw

@st:HHuf -> @+bit:U32 -> HHuf

One bit into the canonical decoder: a code of length l is the symbol when it falls among that length's codes.

def Hp.unhuff.byte source · line 1345 · raw

@st:HHuf -> @+b:U32 -> HHuf

def Hp.unhuff.go source · line 1355 · raw

@bs:List<&2, U32> -> @st:HHuf -> HHuf

def Hp.unhuff.end source · line 1362 · raw

@out:String -> @ok:Bool -> Result<&2, &2, String, String>

def Hp.unhuff.fin source · line 1369 · raw

@st:HHuf -> Result<&2, &2, String, String>

def Hp.unhuff source · line 1377 · raw

@bs:List<&2, U32> -> Result<&2, &2, String, String>

Decodes a Huffman string: padding must be under 8 bits, all 1s.

def Hp.str.go source · line 1383 · raw

@raw:List<&2, U32> -> @huff:Bool -> List<&2, U32>

def Hp.str source · line 1394 · raw

@huff:Bool -> @s:String -> List<&2, U32>

A string literal: Huffman-coded when huff is on and that is no longer (RFC 7541 C.6 Huffman-codes "307", 3 bytes either way).

def Hp.trim.go source · line 1404 · raw

@+h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @rest:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @fits:Bool -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Hp.trim source · line 1412 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+budget:U32 -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

The newest entries that fit in budget: eviction drops the oldest.

def Hp.tsize source · line 1419 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> U32

def Hp.tab source · line 1426 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> HTab

def Hp.add source · line 1431 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @+max:U32 -> HTab

Adds h, evicting to fit max; an entry larger than max empties the table.

def Hp.at.go source · line 1436 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+i:U32 -> @dynamic:Bool -> Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

The entry at index i: the static table's 1 to 61, then the dynamic table's, newest first.

def Hp.at source · line 1443 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+i:U32 -> Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Hp.same source · line 1446 · raw

@+n:String -> @+v:String -> @+name:String -> @+value:String -> @exact:Bool -> Bool

def Hp.find.go source · line 1453 · raw

@+i:U32 -> @rest:U32 -> @hit:Bool -> U32

def Hp.find source · line 1462 · raw

@xs:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+name:String -> @+value:String -> @+i:U32 -> @+exact:Bool -> U32

The index of the first entry of xs, numbered from i, that matches the header (exact) or its name; 0 when none does.

def Hp.either.go source · line 1469 · raw

@+a:U32 -> @+b:U32 -> @none:Bool -> U32

def Hp.either source · line 1476 · raw

@+a:U32 -> @+b:U32 -> U32

def Hp.lookup source · line 1479 · raw

@t:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+name:String -> @+value:String -> @+exact:Bool -> U32

def Hp.dec_new source · line 1524 · raw

@+limit:U32 -> @+cap:U32 -> HDec

A decoder whose table holds up to limit bytes, refusing a header list past cap.

def Hp.set source · line 1527 · raw

@d:HDec -> @st:HSt -> HDec

def Hp.bad source · line 1532 · raw

@d:HDec -> @why:String -> HDec

def Hp.with_tab source · line 1535 · raw

@t:HTab -> @d:HDec -> HDec

def Hp.emit.go source · line 1540 · raw

@d:HDec -> @+h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @ix:Bool -> @+used:U32 -> @over:Bool -> HDec

def Hp.emit source · line 1550 · raw

@d:HDec -> @+h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @ix:Bool -> HDec

A header is whole: into the list, and into the table if ix.

def Hp.indexed source · line 1556 · raw

@d:HDec -> @m:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+i:U32 -> HDec

def Hp.named source · line 1563 · raw

@d:HDec -> @ix:Bool -> @lit:Bool -> @m:Maybe<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @+i:U32 -> HDec

def Hp.resize.go source · line 1572 · raw

@began:Bool -> @over:Bool -> @d:HDec -> @+v:U32 -> HDec

def Hp.resize source · line 1583 · raw

@d:HDec -> @+v:U32 -> HDec

def Hp.got source · line 1588 · raw

@d:HDec -> @ix:Bool -> @name:Maybe<&2, String> -> @r:Result<&2, &2, String, String> -> HDec

def Hp.string source · line 1598 · raw

@d:HDec -> @ix:Bool -> @name:Maybe<&2, String> -> @huff:Bool -> @bs:List<&2, U32> -> HDec

A string is whole: the name, or the value that finishes a header.

def Hp.strlen source · line 1605 · raw

@+d:HDec -> @ix:Bool -> @name:Maybe<&2, String> -> @huff:Bool -> @+v:U32 -> @empty:Bool -> @long:Bool -> HDec

def Hp.cap source · line 1614 · raw

@d:HDec -> U32

def Hp.table source · line 1619 · raw

@d:HDec -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Hp.done source · line 1625 · raw

@+d:HDec -> @k:HK -> @+v:U32 -> HDec

An integer is whole.

def Hp.int1 source · line 1636 · raw

@d:HDec -> @k:HK -> @+v:U32 -> @more:Bool -> HDec

def Hp.cont source · line 1643 · raw

@d:HDec -> @k:HK -> @+acc:U32 -> @+m:U32 -> @big:Bool -> @last:Bool -> HDec

def Hp.op source · line 1652 · raw

@d:HDec -> @+b:U32 -> @a:Bool -> @c:Bool -> @e:Bool -> HDec

def Hp.chars source · line 1663 · raw

@d:HDec -> @ix:Bool -> @name:Maybe<&2, String> -> @huff:Bool -> @+left:U32 -> @acc:List<&2, U32> -> @last:Bool -> HDec

def Hp.step.st source · line 1670 · raw

@st:HSt -> @+b:U32 -> @d:HDec -> HDec

def Hp.step source · line 1685 · raw

@d:HDec -> @+b:U32 -> HDec

One byte into the decoder.

def Hp.feed source · line 1690 · raw

@bs:List<&2, U32> -> @d:HDec -> HDec

def Hp.decode.fin source · line 1697 · raw

@d:HDec -> Result<&2, &2, String, HBlock>

def Hp.decode source · line 1708 · raw

@d:HDec -> @bs:List<&2, U32> -> Result<&2, &2, String, HBlock>

Decodes a whole header block (HEADERS and its CONTINUATIONs, joined): the decoder for the next block, and the headers in order.

def Hp.enc_new source · line 1723 · raw

@+max:U32 -> @huff:Bool -> HEnc

def Hp.enc_low source · line 1726 · raw

@m:Maybe<&2, U32> -> @+n:U32 -> U32

def Hp.enc_tab source · line 1735 · raw

@t:HTab -> @+max:U32 -> @low:Maybe<&2, U32> -> @huff:Bool -> HEnc

The peer's SETTINGS_HEADER_TABLE_SIZE is now n: the table shrinks to it at once, and the next block says so.

def Hp.enc_resize source · line 1740 · raw

@e:HEnc -> @+n:U32 -> HEnc

def Hp.enc_lit source · line 1745 · raw

@+huff:Bool -> @+name:String -> @+value:String -> @+ni:U32 -> @lit:Bool -> List<&2, U32>

def Hp.enc_table source · line 1752 · raw

@e:HEnc -> List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>

def Hp.enc_one.go source · line 1757 · raw

@e:HEnc -> @h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @out:List<&2, U32> -> @+x:U32 -> @found:Bool -> HEBlock

def Hp.enc_one source · line 1766 · raw

@+e:HEnc -> @+h:0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header -> @out:List<&2, U32> -> HEBlock

def Hp.encode.go source · line 1772 · raw

@hs:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> @ev:HEBlock -> HEBlock

def Hp.encode.sizes source · line 1779 · raw

@+l:U32 -> @+max:U32 -> @same:Bool -> List<&2, U32>

def Hp.encode.start source · line 1786 · raw

@e:HEnc -> HEBlock

def Hp.encode source · line 1796 · raw

@e:HEnc -> @hs:List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header> -> HEBlock

Encodes a header block: the encoder for the next block, and the bytes.

def Hp.decode_seq.go source · line 1805 · raw

@bss:List<&2, List<&2, U32>> -> @r:Result<&2, &2, String, HBlock> -> @acc:List<&2, List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>> -> Result<&2, &2, String, HSeq>

def Hp.decode_seq.drop source · line 1817 · raw

@r:Result<&2, &2, String, HSeq> -> Result<&2, &2, String, HSeq>

Decodes blocks one after another, as one connection's would be. (The first result is an empty block, dropped.)

def Hp.decode_seq source · line 1824 · raw

@d:HDec -> @bss:List<&2, List<&2, U32>> -> Result<&2, &2, String, HSeq>

def Hp.encode_seq.go source · line 1827 · raw

@hss:List<&2, List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>> -> @b:HEBlock -> @acc:List<&2, List<&2, U32>> -> List<&2, List<&2, U32>>

def Hp.encode_seq source · line 1835 · raw

@e:HEnc -> @hss:List<&2, List<&2, 0xc8d18670ba37041507e7f53cc7972ec6/src/http.Header>> -> List<&2, List<&2, U32>>