From b9dacfe72dfead313f8c3555ef580583be6eb8d4 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 8 Dec 2023 13:03:12 -0800 Subject: [PATCH] initial commits --- method/bytes_tolerant.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/method/bytes_tolerant.go b/method/bytes_tolerant.go index 002bf80..00eac44 100644 --- a/method/bytes_tolerant.go +++ b/method/bytes_tolerant.go @@ -1,5 +1,9 @@ package method +import ( + "sourcecode.social/reiver/go-rfc2616/sp" +) + func BytesTolerant(p []byte) (result []byte, rest []byte, ok bool) { if len(p) <= 0 { @@ -9,14 +13,14 @@ func BytesTolerant(p []byte) (result []byte, rest []byte, ok bool) { { p0 := p[0] - if ' ' == p0 || '\t' == p0 || '\r' == p0 || '\n' == p0 { + if sp.ByteIsTolerant(p0) || '\r' == p0 || '\n' == p0 { return nil, p, false } } { for i,b := range p { - if ' ' == b || '\t' == b || '\r' == b || '\n' == b { + if sp.ByteIsTolerant(p0) || '\r' == p0 || '\n' == p0 { return p[:i], p[i:], true } }