]> Sergey Matveev's repositories - public-inbox.git/commitdiff
http: cleanup partial-write handling on readonly values
authorEric Wong <e@80x24.org>
Wed, 6 Feb 2019 10:33:21 +0000 (10:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 7 Feb 2019 01:00:27 +0000 (01:00 +0000)
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

index bc10814e12634c6b21ab693ed14ba0cf8437f1ec..9657b31a894ee5ebec9faa9cb1d701a4b45298f0 100644 (file)
@@ -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]);