@@ -444,43 +444,34 @@ struct HTTPRequestStateMachine{
444444return . wait
445445}
446446
447- var expectingBody : Bool = false
448- if let length = head. headers. first ( name: " content-length " ) . flatMap ( { Int ( $0) } ) {
449- if length > 0 {
450- expectingBody = true
451- }
452- } else if head. headers. contains ( name: " transfer-encoding " ) {
453- expectingBody = true
454- }
455-
456447switch self . state {
457448case . initialized, . waitForChannelToBecomeWritable:
458449preconditionFailure ( " How can we receive a response head before sending a request head ourselves " )
459450
460451case . running( . streaming( let expectedBodyLength, let sentBodyBytes, producer: . paused) , . waitingForHead) :
461452self . state = . running(
462453. streaming( expectedBodyLength: expectedBodyLength, sentBodyBytes: sentBodyBytes, producer: . paused) ,
463- . receivingBody( head, . init( expectingBody : expectingBody ) )
454+ . receivingBody( head, . init( ) )
464455)
465456return . forwardResponseHead( head, pauseRequestBodyStream: false )
466457
467458case . running( . streaming( let expectedBodyLength, let sentBodyBytes, producer: . producing) , . waitingForHead) :
468459if head. status. code >= 300 {
469460self . state = . running(
470461. streaming( expectedBodyLength: expectedBodyLength, sentBodyBytes: sentBodyBytes, producer: . paused) ,
471- . receivingBody( head, . init( expectingBody : expectingBody ) )
462+ . receivingBody( head, . init( ) )
472463)
473464return . forwardResponseHead( head, pauseRequestBodyStream: true )
474465} else {
475466self . state = . running(
476467. streaming( expectedBodyLength: expectedBodyLength, sentBodyBytes: sentBodyBytes, producer: . producing) ,
477- . receivingBody( head, . init( expectingBody : expectingBody ) )
468+ . receivingBody( head, . init( ) )
478469)
479470return . forwardResponseHead( head, pauseRequestBodyStream: false )
480471}
481472
482473case . running( . endSent, . waitingForHead) :
483- self . state = . running( . endSent, . receivingBody( head, . init( expectingBody : expectingBody ) ) )
474+ self . state = . running( . endSent, . receivingBody( head, . init( ) ) )
484475return . forwardResponseHead( head, pauseRequestBodyStream: false )
485476
486477case . running( _, . receivingBody) , . running( _, . endReceived) , . finished:
0 commit comments