parseKey parses as defined in https://httpwg.org/specs/rfc9651.html#parse-key.
(s *scanner)
| 58 | // parseKey parses as defined in |
| 59 | // https://httpwg.org/specs/rfc9651.html#parse-key. |
| 60 | func parseKey(s *scanner) (string, error) { |
| 61 | if s.eof() { |
| 62 | return "", &UnmarshalError{s.off, ErrInvalidKeyFormat} |
| 63 | } |
| 64 | |
| 65 | c := s.data[s.off] |
| 66 | if !isLowerCaseAlpha(c) && c != '*' { |
| 67 | return "", &UnmarshalError{s.off, ErrInvalidKeyFormat} |
| 68 | } |
| 69 | |
| 70 | start := s.off |
| 71 | s.off++ |
| 72 | |
| 73 | for !s.eof() { |
| 74 | if !isKeyChar(s.data[s.off]) { |
| 75 | break |
| 76 | } |
| 77 | s.off++ |
| 78 | } |
| 79 | |
| 80 | return s.data[start:s.off], nil |
| 81 | } |
searching dependent graphs…