mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
test long header
This commit is contained in:
parent
440cf090d6
commit
874fc87498
@ -1,7 +1,9 @@
|
||||
package http_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -54,6 +56,20 @@ func TestRequestHeader(t *testing.T) {
|
||||
assert(cache.String(), Equals, "GET / HTTP/1.1\r\nTest: Value\r\n\r\n")
|
||||
}
|
||||
|
||||
func TestLongRequestHeader(t *testing.T) {
|
||||
payload := make([]byte, buf.Size+2)
|
||||
common.Must2(rand.Read(payload[:buf.Size-2]))
|
||||
copy(payload[buf.Size-2:], []byte(ENDING))
|
||||
payload = append(payload, []byte("abcd")...)
|
||||
|
||||
reader := HeaderReader{}
|
||||
b, err := reader.Read(bytes.NewReader(payload))
|
||||
common.Must(err)
|
||||
if b.String() != "abcd" {
|
||||
t.Error("expect content abcd, but actually ", b.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestConnection(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user