initial commits

master
Charles Iliya Krempeaux 2023-12-08 13:44:36 -08:00
parent b9dacfe72d
commit c273e80fcb
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
package requesturi
import (
"sourcecode.social/reiver/go-rfc2616/sp"
)
func BytesTolerant(p []byte) (result []byte, rest []byte, ok bool) {
if len(p) <= 0 {
return nil, nil, false
}
{
p0 := p[0]
if sp.ByteIsTolerant(p0) || '\r' == p0 || '\n' == p0 {
return nil, p, false
}
}
{
for i,b := range p {
if sp.ByteIsTolerant(p0) || '\r' == p0 || '\n' == p0 {
return p[:i], p[i:], true
}
}
return p, nil, true
}
}