@@ -273,10 +273,15 @@ BEGIN {
273273 $h -> {' content-type' } = ' application/octet-stream' ;
274274 }
275275 for (keys %$h ) {
276- if (exists $hdr {lc $_ }) { $good [ $hdri {lc $_ } ] = $hdr { lc $_ }." : " .$h -> {$_ }.$LF ; }
277- else { push @bad , " \u\L $_ \E : " .$h -> {$_ }.$LF ; }
276+ if (exists $hdr {lc $_ }) { $good [ $hdri {lc $_ } ] = $hdr { lc $_ }." : " .$h -> {$_ }; }
277+ else { push @bad , " \u\L $_ \E : " .$h -> {$_ }; }
278+ }
279+ for (@good ,@bad ) {
280+ if (defined ()) {
281+ s / [\r\n ]+/ / g ;
282+ $reply .= $_ . $LF ;
283+ }
278284 }
279- defined () and $reply .= $_ for @good ,@bad ;
280285 $reply .= $LF ;
281286 if ( $self -> {writer } ) {
282287 $self -> {writer }-> ( \$reply );
@@ -360,7 +365,7 @@ BEGIN {
360365 }
361366
362367 for (keys %$h ) {
363- if (exists $hdr {lc $_ }) { $good [ $hdri {lc $_ } ] = $hdr { lc $_ }." : " .$h -> {$_ }. $LF ; }
368+ if (exists $hdr {lc $_ }) { $good [ $hdri {lc $_ } ] = $hdr { lc $_ }." : " .$h -> {$_ }; }
364369 else {
365370 if (lc $_ eq ' set-cookie' ) {
366371 my $cookies = HTTP::Easy::Cookies-> decode($h -> {$_ });
@@ -376,16 +381,21 @@ BEGIN {
376381 push @c , " Secure" if $o -> {secure };
377382 push @c , " HttpOnly" if $o -> {httponly };
378383 push @c , " SameSite=" . $o -> {samesite } if $o -> {samesite };
379- push @bad , " \u\L set-cookie\E : " . join (' ; ' ,@c ) . $LF ;
384+ push @bad , " \u\L set-cookie\E : " . join (' ; ' ,@c );
380385 }
381386 }
382387 }
383388 } else {
384- push @bad , " \u\L $_ \E : " .$h -> {$_ }. $LF ;
389+ push @bad , " \u\L $_ \E : " .$h -> {$_ };
385390 }
386391 }
387392 }
388- defined () and $reply .= $_ for @good ,@bad ;
393+ for (@good ,@bad ) {
394+ if (defined ()) {
395+ s / [\r\n ]+/ / g ;
396+ $reply .= $_ . $LF ;
397+ }
398+ }
389399 # 2 is size of LF
390400 $self -> attrs-> {head_size } = length ($reply ) + 2;
391401 $self -> attrs-> {body_size } = length $content ;
0 commit comments