https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.7
()
| 197 | |
| 198 | // https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.7 |
| 199 | func (p *parser) parseItem() (Item, error) { |
| 200 | if p.isEmpty() { |
| 201 | return nil, errors.New("structuredheader: item expected, got EOS") |
| 202 | } |
| 203 | c := p.input[0] |
| 204 | if c == '-' || isDigit(c) { |
| 205 | return p.parseNumber() |
| 206 | } |
| 207 | if c == '"' { |
| 208 | return p.parseString() |
| 209 | } |
| 210 | if c == '*' { |
| 211 | return p.parseByteSequence() |
| 212 | } |
| 213 | // TODO: Support Booleans. |
| 214 | if isAlpha(c) { |
| 215 | return p.parseToken() |
| 216 | } |
| 217 | return nil, fmt.Errorf("structuredheader: item expected, got '%c'", c) |
| 218 | } |
| 219 | |
| 220 | // https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09#section-4.2.8 |
| 221 | func (p *parser) parseNumber() (int64, error) { |