diff options
author | Eric Wong <e@80x24.org> | 2015-09-21 11:11:11 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-09-21 11:37:10 +0000 |
commit | 62f1d3057304ab1e598a3d3bff54fce1bca0dd72 (patch) | |
tree | fabe4b3623e8f0ba02b3713416882acfe71f0d88 /lib | |
parent | 326f7412b601e8d0d929026802e469bdb7fe1940 (diff) | |
download | public-inbox-62f1d3057304ab1e598a3d3bff54fce1bca0dd72.tar.gz |
Apparently, my mental model of Perl internals is still incorrect after all these years. I am but a simple *nix programmer: everything is a bag of bytes to me. This fixes a problem with UTF-8 headers from Xapian (via "XHDR Subject [range]") triggering partial writes and writing an extra newline to the outputs.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Filter.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/GitCatFile.pm | 2 | ||||
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/PublicInbox/Filter.pm b/lib/PublicInbox/Filter.pm index 84df0e7d..cab6aad1 100644 --- a/lib/PublicInbox/Filter.pm +++ b/lib/PublicInbox/Filter.pm @@ -233,7 +233,7 @@ sub replace_body { sub recheck_type_ok { my ($part) = @_; my $s = $part->body; - ((bytes::length($s) < 0x10000) && + ((length($s) < 0x10000) && ($s =~ /\A([\P{XPosixPrint}\f\n\r\t]+)\z/)) } diff --git a/lib/PublicInbox/GitCatFile.pm b/lib/PublicInbox/GitCatFile.pm index dd3f2912..48ae6734 100644 --- a/lib/PublicInbox/GitCatFile.pm +++ b/lib/PublicInbox/GitCatFile.pm @@ -41,7 +41,7 @@ sub cat_file { my ($self, $object, $sizeref) = @_; $object .= "\n"; - my $len = bytes::length($object); + my $len = length($object); $self->_cat_file_begin; my $written = syswrite($self->{out}, $object); diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index fb93330b..2b580d16 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -771,9 +771,9 @@ sub do_more ($$) { if (MSG_MORE && !$self->{write_buf_size}) { my $n = send($self->{sock}, $data, MSG_MORE); if (defined $n) { - my $dlen = bytes::length($data); + my $dlen = length($data); return 1 if $n == $dlen; # all done! - $data = bytes::substr($data, $n, $dlen - $n); + $data = substr($data, $n, $dlen - $n); } } $self->do_write($data); @@ -813,7 +813,7 @@ again: } return $self->close if $r < 0; - my $len = bytes::length($self->{rbuf}); + my $len = length($self->{rbuf}); return $self->close if ($len >= LINE_MAX); } |