aboutsummaryrefslogtreecommitdiff
path: root/bytesconv.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-12-23 11:22:14 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-12-23 11:22:14 +0200
commite4ed4ab3c044584ab72f981b3efb4dfd66804956 (patch)
tree983da45fcf1fb98dd554f3de4a21c709c23ac930 /bytesconv.go
parentDo not escape '-' and '_' in url path and query args (diff)
downloadfasthttp-e4ed4ab3c044584ab72f981b3efb4dfd66804956.tar.gz
fasthttp-e4ed4ab3c044584ab72f981b3efb4dfd66804956.tar.bz2
fasthttp-e4ed4ab3c044584ab72f981b3efb4dfd66804956.zip
Moved appendQuotedPath to bytesconv
Diffstat (limited to 'bytesconv.go')
-rw-r--r--bytesconv.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/bytesconv.go b/bytesconv.go
index f203b29..1ac46c3 100644
--- a/bytesconv.go
+++ b/bytesconv.go
@@ -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.