|
@@ -23,10 +23,28 @@ type Decoder struct {
|
|
|
dt dynamicTable
|
|
dt dynamicTable
|
|
|
refSet struct{} // TODO
|
|
refSet struct{} // TODO
|
|
|
Emit func(f HeaderField, sensitive bool)
|
|
Emit func(f HeaderField, sensitive bool)
|
|
|
|
|
+
|
|
|
|
|
+ // TODO: max table size http://http2.github.io/http2-spec/compression.html#maximum.table.size
|
|
|
|
|
+ //
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type dynamicTable []HeaderField
|
|
type dynamicTable []HeaderField
|
|
|
|
|
|
|
|
|
|
+// TODO: change dynamicTable to be a struct with a slice and a size int field,
|
|
|
|
|
+// per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1:
|
|
|
|
|
+//
|
|
|
|
|
+// "The size of the dynamic table is the sum of the size of its
|
|
|
|
|
+// entries. The size of an entry is the sum of its name's length in
|
|
|
|
|
+// octets (as defined in Section 5.2), its value's length in octets
|
|
|
|
|
+// (see Section 5.2), plus 32. The size of an entry is calculated
|
|
|
|
|
+// using the length of the name and value without any Huffman encoding
|
|
|
|
|
+// applied. "
|
|
|
|
|
+//
|
|
|
|
|
+// Then make add increment the size. maybe the max size should move from Decoder to
|
|
|
|
|
+// dynamicTable and add should return an ok bool if there was enough space.
|
|
|
|
|
+//
|
|
|
|
|
+// Later we'll need a remove operation on dynamicTable.
|
|
|
|
|
+
|
|
|
func (s *dynamicTable) add(f HeaderField) {
|
|
func (s *dynamicTable) add(f HeaderField) {
|
|
|
*s = append(*s, f)
|
|
*s = append(*s, f)
|
|
|
}
|
|
}
|
|
@@ -45,3 +63,6 @@ func (s *dynamicTable) at(i int) HeaderField {
|
|
|
}
|
|
}
|
|
|
return staticTable[i-len(dt)-1]
|
|
return staticTable[i-len(dt)-1]
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// TODO: new methods on dynamicTable for changing table max table size & eviction:
|
|
|
|
|
+// http://http2.github.io/http2-spec/compression.html#rfc.section.4.2
|