[MM-16473] Make plugins' ServerHTTP http.ResponseWriter hijackable (#14822)
* Make plugins' ServerHTTP http.ResponseWriter hijackable * Rename brw to align with docs * Fix error handling
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0118db9d23
Коммит
d0e035467c
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user