Skip to content

Commit 8abf77e

Browse files
committed
fix : http trailer parse
fix : http header parse
1 parent 22d63d8 commit 8abf77e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nbhttp/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ UPGRADER:
577577
}
578578
return ErrLFExpected
579579
case stateBodyTrailerHeaderKeyBefore:
580-
if isAlpha(c) {
580+
if isToken(c) {
581581
start = i
582582
p.nextState(stateBodyTrailerHeaderKey)
583583
continue

nbhttp/parser_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ func TestServerParserTrailer(t *testing.T) {
6767
if err != nil {
6868
t.Fatalf("test failed: %v", err)
6969
}
70+
data = []byte("POST / HTTP/1.1\r\nHost: localhost:1235\r\nUser-Agent: Go-http-client/1.1\r\nTransfer-Encoding: chunked\r\nTrailer: 123456789,!#$%&'*+-.^_`|~\r\nAccept-Encoding: gzip \r\n\r\n0\r\n123456789: value \r\n !#$%&'*+-.^_`|~: value \r\n\r\n")
71+
err = testParser(t, false, data)
72+
if err != nil {
73+
t.Fatalf("test failed: %v", err)
74+
}
7075
}
7176

7277
func TestClientParserContentLength(t *testing.T) {

0 commit comments

Comments
 (0)