pkg.go.dev
Open in
urlscan Pro
2600:1901:0:f535::
Public Scan
Submitted URL: http://golang.org/x/net/http2/hpack
Effective URL: https://pkg.go.dev/golang.org/x/net/http2/hpack
Submission: On May 30 via api from US — Scanned from DE
Effective URL: https://pkg.go.dev/golang.org/x/net/http2/hpack
Submission: On May 30 via api from US — Scanned from DE
Form analysis
3 forms found in the DOM/search
<form class="go-InputGroup go-ShortcutKey go-SearchForm-form" action="/search" data-shortcut="/" data-shortcut-alt="search" data-gtmc="search form" aria-label="Search for a package" role="search">
<input name="q" class="go-Input js-searchFocus" aria-label="Search for a package" type="search" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" placeholder="Search packages or symbols" value="">
<input name="m" value="" hidden="">
<button class="go-Button go-Button--inverted" aria-label="Submit search">
<img class="go-Icon" height="24" width="24" src="/static/shared/icon/search_gm_grey_24dp.svg" alt="">
</button>
</form>
DIALOG
<form method="dialog" data-gmtc="jump to form" aria-label="Jump to Identifier">
<div class="Dialog-title go-Modal-header">
<h2>Jump to</h2>
<button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
<img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
</button>
</div>
<div class="JumpDialog-filter">
<input class="JumpDialog-input go-Input" autocomplete="off" type="text">
</div>
<div class="JumpDialog-body go-Modal-body">
<div class="JumpDialog-list"></div>
</div>
<div class="go-Modal-actions">
<button class="go-Button" data-test-id="close-dialog">Close</button>
</div>
</form>
DIALOG
<form method="dialog">
<div class="go-Modal-header">
<h2>Keyboard shortcuts</h2>
<button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
<img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
</button>
</div>
<div class="go-Modal-body">
<table>
<tbody>
<tr>
<td class="ShortcutsDialog-key">
<strong>?</strong>
</td>
<td> : This menu</td>
</tr>
<tr>
<td class="ShortcutsDialog-key">
<strong>/</strong>
</td>
<td> : Search site</td>
</tr>
<tr>
<td class="ShortcutsDialog-key">
<strong>f</strong> or <strong>F</strong>
</td>
<td> : Jump to</td>
</tr>
<tr>
<td class="ShortcutsDialog-key"><strong>y</strong> or <strong>Y</strong></td>
<td> : Canonical URL</td>
</tr>
</tbody>
</table>
</div>
<div class="go-Modal-actions">
<button class="go-Button" data-test-id="close-dialog">Close</button>
</div>
</form>
Text Content
Skip to Main Content * Why Go * Case Studies Common problems companies solve with Go * Use Cases Stories about how and why companies use Go * Security Policy How Go can help keep you secure by default * Learn * Docs * Effective Go Tips for writing clear, performant, and idiomatic Go code * Go User Manual A complete introduction to building software with Go * Standard library Reference documentation for Go's standard library * Release Notes Learn what's new in each Go release * Packages * Community * Recorded Talks Videos from prior events * Meetups Meet other local Go developers * Conferences Learn and network with Go developers from around the world * Go blog The Go project's official blog. * Go project Get help and stay informed from Go * Get connected * Why Go Why Go * Case Studies * Use Cases * Security Policy * Learn * Docs Docs * Effective Go * Go User Manual * Standard library * Release Notes * Packages * Community Community * Recorded Talks * Meetups * Conferences * Go blog * Go project * Get connected 1. Discover Packages 2. golang.org/x/net 3. http2 4. hpack HPACK package Version: v0.25.0 Opens a new window with list of versions in this module. Latest Latest This package is not in the latest version of its module. Go to latest Published: May 6, 2024 License: BSD-3-Clause Opens a new window with license information. Imports: 5 Opens a new window with list of imports. Imported by: 1,425 Opens a new window with list of known importers. Main Versions Licenses Imports Imported By DETAILS * Valid go.mod file The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go. * Redistributable license Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed. * Tagged version Modules with tagged versions give importers more predictable builds. * Stable version When a project reaches major version v1 it is considered stable. * Learn more about best practices REPOSITORY cs.opensource.google/go/x/net LINKS * Report a Vulnerability * Open Source Insights Jump to ... * Documentation * Overview * Index * Constants * Variables * Functions * AppendHuffmanString(dst, s) * HuffmanDecode(w, v) * HuffmanDecodeToString(v) * HuffmanEncodeLength(s) * Types * type Decoder * NewDecoder(maxDynamicTableSize, emitFunc) * (d) Close() * (d) DecodeFull(p) * (d) EmitEnabled() * (d) SetAllowedMaxDynamicTableSize(v) * (d) SetEmitEnabled(v) * (d) SetEmitFunc(emitFunc) * (d) SetMaxDynamicTableSize(v) * (d) SetMaxStringLength(n) * (d) Write(p) * type DecodingError * (de) Error() * type Encoder * NewEncoder(w) * (e) MaxDynamicTableSize() * (e) SetMaxDynamicTableSize(v) * (e) SetMaxDynamicTableSizeLimit(v) * (e) WriteField(f) * type HeaderField * (hf) IsPseudo() * (hf) Size() * (hf) String() * type InvalidIndexError * (e) Error() * Source Files DocumentationSource FilesOverviewIndexConstantsVariablesFunctionsTypesAppendHuffmanString(dst, s)HuffmanDecode(w, v)HuffmanDecodeToString(v)HuffmanEncodeLength(s)type Decodertype DecodingErrortype Encodertype HeaderFieldtype InvalidIndexErrorNewDecoder(maxDynamicTableSize, emitFunc)(d) Close()(d) DecodeFull(p)(d) EmitEnabled()(d) SetAllowedMaxDynamicTableSize(v)(d) SetEmitEnabled(v)(d) SetEmitFunc(emitFunc)(d) SetMaxDynamicTableSize(v)(d) SetMaxStringLength(n)(d) Write(p)(de) Error()NewEncoder(w)(e) MaxDynamicTableSize()(e) SetMaxDynamicTableSize(v)(e) SetMaxDynamicTableSizeLimit(v)(e) WriteField(f)(hf) IsPseudo()(hf) Size()(hf) String()(e) Error() DOCUMENTATION ¶ OVERVIEW ¶ Package hpack implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2. See http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09 INDEX ¶ * Variables * func AppendHuffmanString(dst []byte, s string) []byte * func HuffmanDecode(w io.Writer, v []byte) (int, error) * func HuffmanDecodeToString(v []byte) (string, error) * func HuffmanEncodeLength(s string) uint64 * type Decoder * * func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder * * func (d *Decoder) Close() error * func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) * func (d *Decoder) EmitEnabled() bool * func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) * func (d *Decoder) SetEmitEnabled(v bool) * func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) * func (d *Decoder) SetMaxDynamicTableSize(v uint32) * func (d *Decoder) SetMaxStringLength(n int) * func (d *Decoder) Write(p []byte) (n int, err error) * type DecodingError * * func (de DecodingError) Error() string * type Encoder * * func NewEncoder(w io.Writer) *Encoder * * func (e *Encoder) MaxDynamicTableSize() (v uint32) * func (e *Encoder) SetMaxDynamicTableSize(v uint32) * func (e *Encoder) SetMaxDynamicTableSizeLimit(v uint32) * func (e *Encoder) WriteField(f HeaderField) error * type HeaderField * * func (hf HeaderField) IsPseudo() bool * func (hf HeaderField) Size() uint32 * func (hf HeaderField) String() string * type InvalidIndexError * * func (e InvalidIndexError) Error() string CONSTANTS ¶ This section is empty. VARIABLES ¶ View Source var ErrInvalidHuffman = errors.New("hpack: invalid Huffman-encoded data") ErrInvalidHuffman is returned for errors found decoding Huffman-encoded strings. View Source var ErrStringLength = errors.New("hpack: string too long") ErrStringLength is returned by Decoder.Write when the max string length (as configured by Decoder.SetMaxStringLength) would be violated. FUNCTIONS ¶ FUNC APPENDHUFFMANSTRING ¶ func AppendHuffmanString(dst []byte, s string) []byte AppendHuffmanString appends s, as encoded in Huffman codes, to dst and returns the extended buffer. FUNC HUFFMANDECODE ¶ func HuffmanDecode(w io.Writer, v []byte) (int, error) HuffmanDecode decodes the string in v and writes the expanded result to w, returning the number of bytes written to w and the Write call's return value. At most one Write call is made. FUNC HUFFMANDECODETOSTRING ¶ func HuffmanDecodeToString(v []byte) (string, error) HuffmanDecodeToString decodes the string in v. FUNC HUFFMANENCODELENGTH ¶ func HuffmanEncodeLength(s string) uint64 HuffmanEncodeLength returns the number of bytes required to encode s in Huffman codes. The result is round up to byte boundary. TYPES ¶ TYPE DECODER ¶ type Decoder struct { // contains filtered or unexported fields } A Decoder is the decoding context for incremental processing of header blocks. FUNC NEWDECODER ¶ func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder NewDecoder returns a new decoder with the provided maximum dynamic table size. The emitFunc will be called for each valid field parsed, in the same goroutine as calls to Write, before Write returns. FUNC (*DECODER) CLOSE ¶ func (d *Decoder) Close() error Close declares that the decoding is complete and resets the Decoder to be reused again for a new header block. If there is any remaining data in the decoder's buffer, Close returns an error. FUNC (*DECODER) DECODEFULL ¶ func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) DecodeFull decodes an entire block. TODO: remove this method and make it incremental later? This is easier for debugging now. FUNC (*DECODER) EMITENABLED ¶ func (d *Decoder) EmitEnabled() bool EmitEnabled reports whether calls to the emitFunc provided to NewDecoder are currently enabled. The default is true. FUNC (*DECODER) SETALLOWEDMAXDYNAMICTABLESIZE ¶ func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) SetAllowedMaxDynamicTableSize sets the upper bound that the encoded stream (via dynamic table size updates) may set the maximum size to. FUNC (*DECODER) SETEMITENABLED ¶ func (d *Decoder) SetEmitEnabled(v bool) SetEmitEnabled controls whether the emitFunc provided to NewDecoder should be called. The default is true. This facility exists to let servers enforce MAX_HEADER_LIST_SIZE while still decoding and keeping in-sync with decoder state, but without doing unnecessary decompression or generating unnecessary garbage for header fields past the limit. FUNC (*DECODER) SETEMITFUNC ¶ func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) SetEmitFunc changes the callback used when new header fields are decoded. It must be non-nil. It does not affect EmitEnabled. FUNC (*DECODER) SETMAXDYNAMICTABLESIZE ¶ func (d *Decoder) SetMaxDynamicTableSize(v uint32) FUNC (*DECODER) SETMAXSTRINGLENGTH ¶ func (d *Decoder) SetMaxStringLength(n int) SetMaxStringLength sets the maximum size of a HeaderField name or value string. If a string exceeds this length (even after any decompression), Write will return ErrStringLength. A value of 0 means unlimited and is the default from NewDecoder. FUNC (*DECODER) WRITE ¶ func (d *Decoder) Write(p []byte) (n int, err error) TYPE DECODINGERROR ¶ type DecodingError struct { Err error } A DecodingError is something the spec defines as a decoding error. FUNC (DECODINGERROR) ERROR ¶ func (de DecodingError) Error() string TYPE ENCODER ¶ type Encoder struct { // contains filtered or unexported fields } FUNC NEWENCODER ¶ func NewEncoder(w io.Writer) *Encoder NewEncoder returns a new Encoder which performs HPACK encoding. An encoded data is written to w. FUNC (*ENCODER) MAXDYNAMICTABLESIZE ¶ ADDED IN V0.3.0 func (e *Encoder) MaxDynamicTableSize() (v uint32) MaxDynamicTableSize returns the current dynamic header table size. FUNC (*ENCODER) SETMAXDYNAMICTABLESIZE ¶ func (e *Encoder) SetMaxDynamicTableSize(v uint32) SetMaxDynamicTableSize changes the dynamic header table size to v. The actual size is bounded by the value passed to SetMaxDynamicTableSizeLimit. FUNC (*ENCODER) SETMAXDYNAMICTABLESIZELIMIT ¶ func (e *Encoder) SetMaxDynamicTableSizeLimit(v uint32) SetMaxDynamicTableSizeLimit changes the maximum value that can be specified in SetMaxDynamicTableSize to v. By default, it is set to 4096, which is the same size of the default dynamic header table size described in HPACK specification. If the current maximum dynamic header table size is strictly greater than v, "Header Table Size Update" will be done in the next WriteField call and the maximum dynamic header table size is truncated to v. FUNC (*ENCODER) WRITEFIELD ¶ func (e *Encoder) WriteField(f HeaderField) error WriteField encodes f into a single Write to e's underlying Writer. This function may also produce bytes for "Header Table Size Update" if necessary. If produced, it is done before encoding f. TYPE HEADERFIELD ¶ type HeaderField struct { Name, Value string // Sensitive means that this header field should never be // indexed. Sensitive bool } A HeaderField is a name-value pair. Both the name and value are treated as opaque sequences of octets. FUNC (HEADERFIELD) ISPSEUDO ¶ func (hf HeaderField) IsPseudo() bool IsPseudo reports whether the header field is an http2 pseudo header. That is, it reports whether it starts with a colon. It is not otherwise guaranteed to be a valid pseudo header field, though. FUNC (HEADERFIELD) SIZE ¶ func (hf HeaderField) Size() uint32 Size returns the size of an entry per RFC 7541 section 4.1. FUNC (HEADERFIELD) STRING ¶ func (hf HeaderField) String() string TYPE INVALIDINDEXERROR ¶ type InvalidIndexError int An InvalidIndexError is returned when an encoder references a table entry before the static table or after the end of the dynamic table. FUNC (INVALIDINDEXERROR) ERROR ¶ func (e InvalidIndexError) Error() string SOURCE FILES ¶ View all Source files * encode.go * hpack.go * huffman.go * static_table.go * tables.go Click to show internal directories. Click to hide internal directories. Why Go Use Cases Case Studies Get Started Playground Tour Stack Overflow Help Packages Standard Library Sub-repositories About Go Packages About Download Blog Issue Tracker Release Notes Brand Guidelines Code of Conduct Connect Twitter GitHub Slack r/golang Meetup Golang Weekly * Copyright * Terms of Service * Privacy Policy * Report an Issue * Theme Toggle * Shortcuts Modal JUMP TO Close KEYBOARD SHORTCUTS ? : This menu / : Search site f or F : Jump to y or Y : Canonical URL Close go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. Learn more. Okay