Replace the use of bufio.Scanner with bufio.Reader so that requests over 64Kb in size can be replayed from a capture file.

This commit is contained in:
Jon Barber
2016-04-21 10:15:48 +01:00
parent 6c410ab978
commit e659f65d76
4 changed files with 275 additions and 23 deletions
+12
View File
@@ -53,6 +53,18 @@ func (i *TestInput) EmitLargePOST() {
rs := base64.URLEncoding.EncodeToString(rb)
i.data <- []byte("POST / HTTP/1.1\nHost: www.w3.org\nContent-Length:5242880\r\n\r\n" + rs)
Debug("Sent large POST")
}
// EmitSizedPOST emit a POST with a payload set to a supplied size
func (i *TestInput) EmitSizedPOST(payloadSize int) {
rb := make([]byte, payloadSize)
rand.Read(rb)
rs := base64.URLEncoding.EncodeToString(rb)
i.data <- []byte("POST / HTTP/1.1\nHost: www.w3.org\nContent-Length:5242880\r\n\r\n" + rs)
Debug("Sent large POST")
}
// EmitOPTIONS emits OPTIONS request, similar to GET