@@ -3,7 +3,6 @@ package sigsci
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
- "io"
7
6
"io/ioutil"
8
7
"log"
9
8
"net"
@@ -226,13 +225,7 @@ func (m *Module) inspectorPreRequest(req *http.Request) (inspin2 RPCMsgIn2, out
226
225
req .Body = ioutil .NopCloser (bytes .NewBuffer (reqbody ))
227
226
}
228
227
229
- inspin , err := NewRPCMsgInWithModuleConfig (m .config , req , bytes .NewReader (reqbody ))
230
- if err != nil {
231
- if m .config .Debug () {
232
- log .Printf ("DEBUG: PreRequest call error (%s %s): %s" , req .Method , req .RequestURI , err )
233
- }
234
- return
235
- }
228
+ inspin := NewRPCMsgInWithModuleConfig (m .config , req , reqbody )
236
229
m .extractHeaders (req , inspin )
237
230
238
231
if m .config .Debug () {
@@ -381,7 +374,7 @@ func NewRPCMsgIn(r *http.Request, postbody []byte, code int, size int64, dur tim
381
374
// NewRPCMsgInWithModuleConfig creates a message from a ModuleConfig object
382
375
// End-users of the golang module never need to use this
383
376
// directly and it is only exposed for performance testing
384
- func NewRPCMsgInWithModuleConfig (mcfg * ModuleConfig , r * http.Request , postbody io. Reader ) ( * RPCMsgIn , error ) {
377
+ func NewRPCMsgInWithModuleConfig (mcfg * ModuleConfig , r * http.Request , postbody [] byte ) * RPCMsgIn {
385
378
386
379
now := time .Now ()
387
380
@@ -403,11 +396,6 @@ func NewRPCMsgInWithModuleConfig(mcfg *ModuleConfig, r *http.Request, postbody i
403
396
hin = append ([][2 ]string {{"Host" , r .Host }}, hin ... )
404
397
}
405
398
406
- body , err := ioutil .ReadAll (postbody )
407
- if err != nil {
408
- return nil , err
409
- }
410
-
411
399
return & RPCMsgIn {
412
400
ModuleVersion : mcfg .ModuleIdentifier (),
413
401
ServerVersion : mcfg .ServerIdentifier (),
@@ -425,9 +413,9 @@ func NewRPCMsgInWithModuleConfig(mcfg *ModuleConfig, r *http.Request, postbody i
425
413
ResponseCode : - 1 ,
426
414
ResponseMillis : 0 ,
427
415
ResponseSize : - 1 ,
428
- PostBody : string (body ),
416
+ PostBody : string (postbody ),
429
417
HeadersIn : hin ,
430
- }, nil
418
+ }
431
419
}
432
420
433
421
// stripPort removes any port from an address (e.g., the client port from the RemoteAddr)
0 commit comments