Skip to content

Commit

Permalink
tilde
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuxuan committed Jun 14, 2018
1 parent b01fec1 commit 19ac0e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions transport/http_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func decodeTimeout(s string) (time.Duration, error) {

const (
spaceByte = ' '
tildaByte = '~'
tildeByte = '~'
percentByte = '%'
)

Expand All @@ -454,7 +454,7 @@ func encodeGrpcMessage(msg string) string {
lenMsg := len(msg)
for i := 0; i < lenMsg; i++ {
c := msg[i]
if !(c >= spaceByte && c <= tildaByte && c != percentByte) {
if !(c >= spaceByte && c <= tildeByte && c != percentByte) {
return encodeGrpcMessageUnchecked(msg)
}
}
Expand All @@ -466,7 +466,7 @@ func encodeGrpcMessageUnchecked(msg string) string {
lenMsg := len(msg)
for i := 0; i < lenMsg; i++ {
c := msg[i]
if c >= spaceByte && c <= tildaByte && c != percentByte {
if c >= spaceByte && c <= tildeByte && c != percentByte {
buf.WriteByte(c)
} else {
buf.WriteString(fmt.Sprintf("%%%02X", c))
Expand Down

0 comments on commit 19ac0e4

Please sign in to comment.