@@ -532,40 +532,31 @@ public function send(string $body = ''): void
532532 $ this ->addHeader ('Server ' , $ serverHeader );
533533 $ this ->addHeader ('X-Debug-Speed ' , (string ) (microtime (true ) - $ this ->startTime ));
534534
535- $ this ->appendCookies ()->appendHeaders ();
536-
537- // Send response
538- if ($ this ->disablePayload ) {
539- $ this ->end ();
540- return ;
541- }
535+ $ this ->appendCookies ();
542536
543537 // Compress body
544- Console::log ('Accept-Encoding: ' .$ this ->acceptEncoding . ' - ' . $ this ->compressionMinSize );
545- Console::log ('Content-Type: ' .$ this ->contentType . ' - ' . $ this ->compressed [$ this ->contentType ]);
546- Console::log ('Content-Length: ' .strlen ($ body ) . ' - ' . $ this ->compressionMinSize );
547-
548538 if (
549539 !empty ($ this ->acceptEncoding ) &&
550540 isset ($ this ->compressed [$ this ->contentType ]) &&
551541 strlen ($ body ) > $ this ->compressionMinSize
552542 ) {
553543 $ algorithm = Compression::fromAcceptEncoding ($ this ->acceptEncoding , $ this ->compressionSupported );
554544
555- Console::log ('Compression Algorithm: ' .($ algorithm ? $ algorithm ->getName () : 'none ' ));
556-
557545 if ($ algorithm ) {
558- Console::log ('Body before compression: ' .strlen ($ body ));
559-
560546 $ body = $ algorithm ->compress ($ body );
561-
562- Console::log ('Body after compression: ' .strlen ($ body ));
563-
564547 $ this ->addHeader ('Content-Encoding ' , $ algorithm ->getContentEncoding ());
565548 $ this ->addHeader ('Vary ' , 'Accept-Encoding ' );
566549 }
567550 }
568551
552+ $ this ->appendHeaders ();
553+
554+ // Send response
555+ if ($ this ->disablePayload ) {
556+ $ this ->end ();
557+ return ;
558+ }
559+
569560 $ headerSize = strlen (implode ("\n" , $ this ->headers ));
570561 $ bodyLength = strlen ($ body );
571562 $ this ->size += $ headerSize + $ bodyLength ;
0 commit comments