|
@@ -17,7 +17,6 @@
|
|
|
package rafthttp
|
|
package rafthttp
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
- "io"
|
|
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"log"
|
|
"log"
|
|
|
"net/http"
|
|
"net/http"
|
|
@@ -25,6 +24,7 @@ import (
|
|
|
"strconv"
|
|
"strconv"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
+ "github.com/coreos/etcd/pkg/ioutils"
|
|
|
"github.com/coreos/etcd/pkg/types"
|
|
"github.com/coreos/etcd/pkg/types"
|
|
|
"github.com/coreos/etcd/raft/raftpb"
|
|
"github.com/coreos/etcd/raft/raftpb"
|
|
|
|
|
|
|
@@ -90,7 +90,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
// Limit the data size that could be read from the request body, which ensures that read from
|
|
// Limit the data size that could be read from the request body, which ensures that read from
|
|
|
// connection will not time out accidentally due to possible block in underlying implementation.
|
|
// connection will not time out accidentally due to possible block in underlying implementation.
|
|
|
- limitedr := io.LimitReader(r.Body, ConnReadLimitByte)
|
|
|
|
|
|
|
+ limitedr := ioutils.NewLimitedBufferReader(r.Body, ConnReadLimitByte)
|
|
|
b, err := ioutil.ReadAll(limitedr)
|
|
b, err := ioutil.ReadAll(limitedr)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
log.Println("rafthttp: error reading raft message:", err)
|
|
log.Println("rafthttp: error reading raft message:", err)
|