From e7165be526e984e9b018d157df4515dc817db84f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 6 Feb 2019 10:33:21 +0000 Subject: http: cleanup partial-write handling on readonly values Don't bother assigning to $_[1]; just let Danga::Socket do its thing since $_[1] should be out-of-scope soon. --- lib/PublicInbox/HTTP.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index bc10814e..9657b31a 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -318,11 +318,9 @@ sub more ($$) { if (defined $n) { my $nlen = length($_[1]) - $n; return 1 if $nlen == 0; # all done! - eval { $_[1] = substr($_[1], $n, $nlen) }; - if ($@) { # modification of read-only value: - return $self->write(substr($_[1], $n, $nlen)); - } - # fall through to normal write: + + # Danga::Socket::write queues the unwritten substring: + return $self->write(substr($_[1], $n, $nlen)); } } $self->write($_[1]); -- cgit v1.2.3-24-ge0c7