package httpbearer // There could be more of these characters: // // • "\t" i.e,. horizontal tab (␉) // • " " i.e., space (␠) // • "\r\n" i.e., carriage return (␍), line feed (␊) // // We will consume them (and ignore them) if they are there. func trimleft(value string) string { for { if len(value) <= 0 { return value } c0 := value[0] switch c0 { case ' ','\t': value = value[1:] // Nothing else here. We got LWSP-char. So we will continue. case '\r': if len(value) < 2 { return value } c1 := value[1] if '\n' != c1 { return value } value = value[2:] // Nothing else here. We got "\r\n". So we will continue. default: return value } } }