Add protection for malformed requests

This commit is contained in:
Leonid Bugaev
2015-08-23 13:07:29 +03:00
parent f3ea30c6df
commit f0b96af420
3 changed files with 26 additions and 1 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ import (
"log"
"sync/atomic"
"time"
"github.com/buger/gor/proto"
)
const initialDynamicWorkers = 10
@@ -186,8 +187,13 @@ func (o *HTTPOutput) sendRequest(client *HTTPClient, request []byte) {
meta := payloadMeta(request)
uuid := meta[1]
body := payloadBody(request)
if !proto.IsHTTPPayload(body) {
return
}
start := time.Now()
resp, err := client.Send(payloadBody(request))
resp, err := client.Send(body)
stop := time.Now()
if err != nil {