[MM-16473] Make plugins' ServerHTTP http.ResponseWriter hijackable (#14822)

* Make plugins' ServerHTTP http.ResponseWriter hijackable

* Rename brw to align with docs

* Fix error handling
Этот коммит содержится в:
Claudio Costa
2020-06-26 10:51:23 +02:00
коммит произвёл GitHub
родитель 0118db9d23
Коммит d0e035467c
5 изменённых файлов: 374 добавлений и 0 удалений

Просмотреть файл

@@ -4,18 +4,27 @@
package plugin
import (
"bufio"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/rpc"
"github.com/mattermost/mattermost-server/v5/mlog"
)
type hijackedResponse struct {
conn net.Conn
bufrw *bufio.ReadWriter
readBuf []byte
}
type httpResponseWriterRPCServer struct {
w http.ResponseWriter
log *mlog.Logger
hjr *hijackedResponse
}
func (w *httpResponseWriterRPCServer) Header(args struct{}, reply *http.Header) error {