leffss / gowebssh

Webssh implemented by github.com/gorilla/websocket and golang.org/x/crypto/ssh
MIT License
80 stars 25 forks source link

前后端数据转换bug #3

Closed wenbingzhang closed 3 years ago

wenbingzhang commented 3 years ago

webssh.go

        case messageTypeStdin:
            if stdin == nil {
                ws.logger.Printf("stdin wait login")
                continue
            }
            data, _ := url.QueryUnescape(string(msg.Data))
            _, err = stdin.Write([]byte(data))

url.QueryUnescape 会将'+'加号转换为' '空格。 需要修正

data := strings.ReplaceAll(string(msg.Data), "+", "%2b")
data, _ = url.QueryUnescape(data)
_, err = stdin.Write([]byte(data))
leffss commented 3 years ago

webssh.go

      case messageTypeStdin:
          if stdin == nil {
              ws.logger.Printf("stdin wait login")
              continue
          }
          data, _ := url.QueryUnescape(string(msg.Data))
          _, err = stdin.Write([]byte(data))

url.QueryUnescape 会将'+'加号转换为' '空格。 需要修正

data := strings.ReplaceAll(string(msg.Data), "+", "%2b")
data, _ = url.QueryUnescape(data)
_, err = stdin.Write([]byte(data))

已修复