@@ -11,7 +11,6 @@ const RedirectHandler = require('./handler/redirect')
1111const {
1212 RequestContentLengthMismatchError,
1313 ResponseContentLengthMismatchError,
14- TrailerMismatchError,
1514 InvalidArgumentError,
1615 RequestAbortedError,
1716 HeadersTimeoutError,
@@ -425,7 +424,6 @@ class Parser {
425424
426425 this . bytesRead = 0
427426
428- this . trailer = ''
429427 this . keepAlive = ''
430428 this . contentLength = ''
431429 }
@@ -615,8 +613,6 @@ class Parser {
615613 const key = this . headers [ len - 2 ]
616614 if ( key . length === 10 && key . toString ( ) . toLowerCase ( ) === 'keep-alive' ) {
617615 this . keepAlive += buf . toString ( )
618- } else if ( key . length === 7 && key . toString ( ) . toLowerCase ( ) === 'trailer' ) {
619- this . trailer += buf . toString ( )
620616 } else if ( key . length === 14 && key . toString ( ) . toLowerCase ( ) === 'content-length' ) {
621617 this . contentLength += buf . toString ( )
622618 }
@@ -819,7 +815,7 @@ class Parser {
819815 }
820816
821817 onMessageComplete ( ) {
822- const { client, socket, statusCode, upgrade, trailer , headers, contentLength, bytesRead, shouldKeepAlive } = this
818+ const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this
823819
824820 if ( socket . destroyed && ( ! statusCode || shouldKeepAlive ) ) {
825821 return - 1
@@ -838,7 +834,6 @@ class Parser {
838834 this . statusText = ''
839835 this . bytesRead = 0
840836 this . contentLength = ''
841- this . trailer = ''
842837 this . keepAlive = ''
843838
844839 assert ( this . headers . length % 2 === 0 )
@@ -849,23 +844,6 @@ class Parser {
849844 return
850845 }
851846
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-
869847 /* istanbul ignore next: should be handled by llhttp? */
870848 if ( request . method !== 'HEAD' && contentLength && bytesRead !== parseInt ( contentLength , 10 ) ) {
871849 util . destroy ( socket , new ResponseContentLengthMismatchError ( ) )
0 commit comments