MCPcopy Create free account
hub / github.com/WICG/webpackage / parseManifestSection

Function parseManifestSection

go/bundle/decoder.go:323–337  ·  view source on GitHub ↗

https://wpack-wg.github.io/bundled-responses/draft-ietf-wpack-bundled-responses.html#manifest-section

(sectionContents []byte)

Source from the content-addressed store, hash-verified

321
322// https://wpack-wg.github.io/bundled-responses/draft-ietf-wpack-bundled-responses.html#manifest-section
323func parseManifestSection(sectionContents []byte) (*url.URL, error) {
324 dec := cbor.NewDecoder(bytes.NewBuffer(sectionContents))
325 urlString, err := dec.DecodeTextString()
326 if err != nil {
327 return nil, fmt.Errorf("bundle: failed to parse manifest section: %v", err)
328 }
329 manifestURL, err := url.Parse(urlString)
330 if err != nil {
331 return nil, fmt.Errorf("bundle: failed to parse manifest URL (%s): %v", urlString, err)
332 }
333 if !manifestURL.IsAbs() || manifestURL.Fragment != "" || manifestURL.User != nil {
334 return nil, fmt.Errorf("bundle: manifest URL (%s) must be an absolute url without fragment or credentials.", urlString)
335 }
336 return manifestURL, nil
337}
338
339// https://wpack-wg.github.io/bundled-responses/draft-ietf-wpack-bundled-responses.html#signatures-section
340func parseSignaturesSection(sectionContents []byte) (*Signatures, error) {

Callers 1

loadMetadataFunction · 0.85

Calls 2

DecodeTextStringMethod · 0.95
NewDecoderFunction · 0.92

Tested by

no test coverage detected