@@ -11,7 +11,6 @@ const RedirectHandler = require('./handler/redirect')
11
11
const {
12
12
RequestContentLengthMismatchError,
13
13
ResponseContentLengthMismatchError,
14
- TrailerMismatchError,
15
14
InvalidArgumentError,
16
15
RequestAbortedError,
17
16
HeadersTimeoutError,
@@ -425,7 +424,6 @@ class Parser {
425
424
426
425
this . bytesRead = 0
427
426
428
- this . trailer = ''
429
427
this . keepAlive = ''
430
428
this . contentLength = ''
431
429
}
@@ -615,8 +613,6 @@ class Parser {
615
613
const key = this . headers [ len - 2 ]
616
614
if ( key . length === 10 && key . toString ( ) . toLowerCase ( ) === 'keep-alive' ) {
617
615
this . keepAlive += buf . toString ( )
618
- } else if ( key . length === 7 && key . toString ( ) . toLowerCase ( ) === 'trailer' ) {
619
- this . trailer += buf . toString ( )
620
616
} else if ( key . length === 14 && key . toString ( ) . toLowerCase ( ) === 'content-length' ) {
621
617
this . contentLength += buf . toString ( )
622
618
}
@@ -819,7 +815,7 @@ class Parser {
819
815
}
820
816
821
817
onMessageComplete ( ) {
822
- const { client, socket, statusCode, upgrade, trailer , headers, contentLength, bytesRead, shouldKeepAlive } = this
818
+ const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
823
819
824
820
if ( socket . destroyed && ( ! statusCode || shouldKeepAlive ) ) {
825
821
return - 1
@@ -838,7 +834,6 @@ class Parser {
838
834
this . statusText = ''
839
835
this . bytesRead = 0
840
836
this . contentLength = ''
841
- this . trailer = ''
842
837
this . keepAlive = ''
843
838
844
839
assert ( this . headers . length % 2 === 0 )
@@ -849,23 +844,6 @@ class Parser {
849
844
return
850
845
}
851
846
852
- const trailers = trailer ? trailer . split ( / , \s * / ) : [ ]
853
- for ( let i = 0 ; i < trailers . length ; i ++ ) {
854
- const trailer = trailers [ i ]
855
- let found = false
856
- for ( let n = 0 ; n < headers . length ; n += 2 ) {
857
- const key = headers [ n ]
858
- if ( key . length === trailer . length && key . toString ( ) . toLowerCase ( ) === trailer . toLowerCase ( ) ) {
859
- found = true
860
- break
861
- }
862
- }
863
- if ( ! found ) {
864
- util . destroy ( socket , new TrailerMismatchError ( ) )
865
- return - 1
866
- }
867
- }
868
-
869
847
/* istanbul ignore next: should be handled by llhttp? */
870
848
if ( request . method !== 'HEAD' && contentLength && bytesRead !== parseInt ( contentLength , 10 ) ) {
871
849
util . destroy ( socket , new ResponseContentLengthMismatchError ( ) )
0 commit comments