diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-01-13 18:17:03 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-01-13 18:17:03 +0200 |
commit | 485098e5dc90f6cab18e62826e4b50f82286139b (patch) | |
tree | 7f02bc030c0ded59dee236d789b27f5050684d7b /bytesconv.go | |
parent | typo fix (diff) | |
download | fasthttp-485098e5dc90f6cab18e62826e4b50f82286139b.tar.gz fasthttp-485098e5dc90f6cab18e62826e4b50f82286139b.tar.bz2 fasthttp-485098e5dc90f6cab18e62826e4b50f82286139b.zip |
Exported AppendQuotedArg
Diffstat (limited to 'bytesconv.go')
-rw-r--r-- | bytesconv.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bytesconv.go b/bytesconv.go index 1ccf70e..d9e8c6b 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -303,8 +303,9 @@ func unsafeBytesToStr(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } -func appendQuotedArg(dst, v []byte) []byte { - for _, c := range v { +// AppendQuotedArg appends url-encoded src to dst and returns appended dst. +func AppendQuotedArg(dst, src []byte) []byte { + for _, c := range src { // See http://www.w3.org/TR/html5/forms.html#form-submission-algorithm if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '*' || c == '-' || c == '.' || c == '_' { @@ -316,8 +317,8 @@ func appendQuotedArg(dst, v []byte) []byte { return dst } -func appendQuotedPath(dst, v []byte) []byte { - for _, c := range v { +func appendQuotedPath(dst, src []byte) []byte { + for _, c := range src { 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) |