0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

trim possible line terminators from message

This commit is contained in:
Austin 2015-11-03 13:37:32 -08:00
parent abc7c6a148
commit 34c369155c

View file

@ -5,6 +5,7 @@ package websocket
import (
"bufio"
"bytes"
"io"
"net"
"net/http"
@ -224,7 +225,7 @@ func pumpStdout(conn *websocket.Conn, stdout io.Reader, done chan struct{}) {
s := bufio.NewScanner(stdout)
for s.Scan() {
conn.SetWriteDeadline(time.Now().Add(writeWait))
if err := conn.WriteMessage(websocket.TextMessage, s.Bytes()); err != nil {
if err := conn.WriteMessage(websocket.TextMessage, bytes.TrimSpace(s.Bytes())); err != nil {
break
}
}