(urlBytes []byte)
| 467 | } |
| 468 | |
| 469 | func validateFallbackURL(urlBytes []byte) (string, error) { |
| 470 | // draft-yasskin-http-origin-signed-responses.html#application-signed-exchange |
| 471 | // Step 3. "fallbackUrlLength bytes holding a fallbackUrl, which MUST be an absolute URL with a scheme of “https”. " [spec text] |
| 472 | urlStr := string(urlBytes) |
| 473 | parsedUrl, err := url.Parse(urlStr) |
| 474 | if err != nil { |
| 475 | return "", fmt.Errorf("signedexchange: cannot parse fallback URL %q: %v", urlStr, err) |
| 476 | } |
| 477 | if parsedUrl.Scheme != "https" { // This also ensures that parsedUrl is absolute. |
| 478 | return "", fmt.Errorf("signedexchange: non-https fallback URL: %q", urlStr) |
| 479 | } |
| 480 | return urlStr, nil |
| 481 | } |
| 482 | |
| 483 | func (e *Exchange) DumpSignedMessage(w io.Writer, s *Signer) error { |
| 484 | bs, err := serializeSignedMessage(e, calculateCertSha256(s.Certs), s.ValidityUrl.String(), s.Date.Unix(), s.Expires.Unix()) |
no outgoing calls
no test coverage detected