From af3054ded3c5fe48576de11a4f02b34ede40ccfa Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 30 Nov 2018 03:03:46 +0000 Subject: [PATCH 1/3] =?UTF-8?q?httperrors:=20=E4=BF=AE=E6=AD=A3InternalSer?= =?UTF-8?q?verError=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/httperrors/httperrors.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/httperrors/httperrors.go b/pkg/httperrors/httperrors.go index d34dd572e8..500de5df2f 100644 --- a/pkg/httperrors/httperrors.go +++ b/pkg/httperrors/httperrors.go @@ -1,7 +1,6 @@ package httperrors import ( - "fmt" "net/http" "yunion.io/x/jsonutils" @@ -31,7 +30,7 @@ func GeneralServerError(w http.ResponseWriter, e error) { if ok { JsonClientError(w, je) } else { - InternalServerError(w, fmt.Sprintf("%s", e)) + InternalServerError(w, "%s", e) } } From 72761eb3ac757c14289009ebadb5da1cb428dc02 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 30 Nov 2018 03:04:17 +0000 Subject: [PATCH 2/3] =?UTF-8?q?webconsole:=20=E6=94=B9=E8=BF=9Bprotocol?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/webconsole/server/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/webconsole/server/server.go b/pkg/webconsole/server/server.go index 5b0dd2fc0a..5232ac89a3 100644 --- a/pkg/webconsole/server/server.go +++ b/pkg/webconsole/server/server.go @@ -5,7 +5,6 @@ import ( "yunion.io/x/jsonutils" "yunion.io/x/log" - "yunion.io/x/pkg/util/sets" "yunion.io/x/onecloud/pkg/httperrors" "yunion.io/x/onecloud/pkg/webconsole/session" @@ -37,9 +36,10 @@ func (s *ConnectionServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { } var srv http.Handler protocol := sessionObj.GetProtocol() - if sets.NewString(session.VNC, session.SPICE, session.WMKS).Has(protocol) { + switch protocol { + case session.VNC, session.SPICE, session.WMKS: srv, err = NewWebsockifyServer(sessionObj) - } else { + default: srv, err = NewTTYServer(sessionObj) } if err != nil { From 3213cf047a99c57965bc983e02e8f47f902b25fd Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 30 Nov 2018 03:05:03 +0000 Subject: [PATCH 3/3] =?UTF-8?q?webconsole:=20=E4=BF=AE=E6=AD=A3httperrors.?= =?UTF-8?q?GeneralServerError=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/webconsole/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/webconsole/server/server.go b/pkg/webconsole/server/server.go index 5232ac89a3..7028528aba 100644 --- a/pkg/webconsole/server/server.go +++ b/pkg/webconsole/server/server.go @@ -43,7 +43,7 @@ func (s *ConnectionServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { srv, err = NewTTYServer(sessionObj) } if err != nil { - httperrors.GeneralServerError(w, "New server error: %v", err) + httperrors.GeneralServerError(w, err) return } srv.ServeHTTP(w, req)