parseIfHeader parses the "If: foo bar" HTTP header. The httpHeader string should omit the "If:" prefix and have any "\r\n"s collapsed to a " ", as is returned by req.Header.Get("If") for a http.Request req.
(httpHeader string)
| 26 | // should omit the "If:" prefix and have any "\r\n"s collapsed to a " ", as is |
| 27 | // returned by req.Header.Get("If") for a http.Request req. |
| 28 | func parseIfHeader(httpHeader string) (h ifHeader, ok bool) { |
| 29 | s := strings.TrimSpace(httpHeader) |
| 30 | switch tokenType, _, _ := lex(s); tokenType { |
| 31 | case '(': |
| 32 | return parseNoTagLists(s) |
| 33 | case angleTokenType: |
| 34 | return parseTaggedLists(s) |
| 35 | default: |
| 36 | return ifHeader{}, false |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | func parseNoTagLists(s string) (h ifHeader, ok bool) { |
| 41 | for { |
no test coverage detected