[MM-16437] Plugin crashes the server when calling WriteHeader with an invalid http code (#11276)

* [MM-16437] add a check so that we don't write an invalid header

* better solution

* * passing in the logger; logging the error; fixed a spelling mistake

* trigger jenkins
Этот коммит содержится в:
Christopher Poile
2019-10-31 13:27:49 -04:00
коммит произвёл GitHub
родитель 7c658a98f0
Коммит 0697f5206c
2 изменённых файлов: 14 добавлений и 3 удалений

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

@@ -286,8 +286,8 @@ func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Re
defer connection.Close()
rpcServer := rpc.NewServer()
if err := rpcServer.RegisterName("Plugin", &httpResponseWriterRPCServer{w: w}); err != nil {
g.log.Error("Plugin failed to ServeHTTP, coulden't register RPC name", mlog.Err(err))
if err := rpcServer.RegisterName("Plugin", &httpResponseWriterRPCServer{w: w, log: g.log}); err != nil {
g.log.Error("Plugin failed to ServeHTTP, couldn't register RPC name", mlog.Err(err))
return
}
rpcServer.ServeConn(connection)