Moved appendQuotedPath to bytesconv

This commit is contained in:
Aliaksandr Valialkin
2015-12-23 11:22:14 +02:00
parent ea8a7f54d5
commit e4ed4ab3c0
2 changed files with 12 additions and 12 deletions
+12
View File
@@ -321,6 +321,18 @@ func appendQuotedArg(dst, v []byte) []byte {
return dst
}
func appendQuotedPath(dst, v []byte) []byte {
for _, c := range v {
if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' ||
c == '/' || c == '.' || c == ',' || c == '=' || c == ':' || c == '&' || c == '~' || c == '-' || c == '_' {
dst = append(dst, c)
} else {
dst = append(dst, '%', hexCharUpper(c>>4), hexCharUpper(c&15))
}
}
return dst
}
// EqualBytesStr returns true if string(b) == s.
//
// This function has no performance benefits comparing to string(b) == s.
-12
View File
@@ -434,15 +434,3 @@ func (x *URI) parseQueryArgs() {
x.queryArgs.ParseBytes(x.queryString)
x.parsedQueryArgs = true
}
func appendQuotedPath(dst, v []byte) []byte {
for _, c := range v {
if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' ||
c == '/' || c == '.' || c == ',' || c == '=' || c == ':' || c == '&' || c == '~' || c == '-' || c == '_' {
dst = append(dst, c)
} else {
dst = append(dst, '%', hexCharUpper(c>>4), hexCharUpper(c&15))
}
}
return dst
}