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 4b02b37 commit adcfa4d
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 @@ -438,7 +438,7 @@ func decodeTimeout(s string) (time.Duration, error) {

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

Expand All @@ -456,7 +456,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 @@ -478,7 +478,7 @@ func encodeGrpcMessageUnchecked(msg string) string {
// utf8.RuneError.
//
// fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD".
if b >= spaceByte && b <= tildaByte && b != percentByte {
if b >= spaceByte && b <= tildeByte && b != percentByte {
buf.WriteByte(b)
} else {
buf.WriteString(fmt.Sprintf("%%%02X", b))
Expand Down

0 comments on commit adcfa4d

Please sign in to comment.