From 90d926f6f32dd3ff06e5c49e6a982777ead9f691 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 15 Sep 2015 16:48:29 +0200 Subject: Remove support for the Binary Content extension [RFC3516]. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “If the server does not know how to decode the section's CTE, it MUST fail the request and issue a "NO" response that contains the "UNKNOWN-CTE" extended response code.” — [RFC3516 section 4.3] Unfortunately the client doesn't know which message couldn't be decoded, so it can't fallback and use BODY instead. This made ‘use-binary=NO’ pretty much mandatory. Hence we remove support for BINARY [RFC3516]. Instead, we increase the thresold for when to add Zlib full flush points from 4096 to the buffer size (32768). --- interimap | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'interimap') diff --git a/interimap b/interimap index b3a7342..45a6643 100755 --- a/interimap +++ b/interimap @@ -74,7 +74,6 @@ my $CONF = read_config( delete $CONFIG{config} // $NAME , 'list-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ , 'list-select-opts' => qr/\A([\x21\x23\x24\x26\x27\x2B-\x5B\x5E-\x7A\x7C-\x7E]+)\z/ , 'ignore-mailbox' => qr/\A([\x01-\x09\x0B\x0C\x0E-\x7F]+)\z/ - , 'use-binary' => qr/\A(YES|NO)\z/i, ); my ($DBFILE, $LOCKFILE, $LOGGER_FD); @@ -512,10 +511,7 @@ sub sync_mailbox_list() { sync_mailbox_list(); ($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/; -my $ATTRS = 'MODSEQ FLAGS INTERNALDATE '. - (((!defined $CONF->{_} or $CONF->{_}->{'use-binary'} // 1) and - !$lIMAP->incapable('BINARY') and !$rIMAP->incapable('BINARY')) - ? 'BINARY' : 'BODY').'.PEEK[]'; +my $ATTRS = join ' ', qw/MODSEQ FLAGS INTERNALDATE BODY.PEEK[]/; ############################################################################# @@ -600,7 +596,7 @@ sub download_missing($$$@) { my $attrs = $ATTRS.' ENVELOPE'; ($source eq 'local' ? $lIMAP : $rIMAP)->fetch(compact_set(@set), "($attrs)", sub($) { my $mail = shift; - return unless exists $mail->{RFC822} or exists $mail->{BINARY}; # not for us + return unless exists $mail->{RFC822}; # not for us my $uid = $mail->{UID}; my $from = first { defined $_ and @$_ } @{$mail->{ENVELOPE}}[2,3,4]; @@ -969,10 +965,9 @@ sub sync_known_messages($$) { # after the FETCH. sub callback_new_message($$$$;$$$) { my ($idx, $mailbox, $name, $mail, $UIDs, $buff, $bufflen) = @_; + return unless exists $mail->{RFC822}; # not for us - my $length = defined $mail->{RFC822} ? length(${$mail->{RFC822}}) - : defined $mail->{BINARY} ? length(${$mail->{BINARY}}) - : return; # not for us + my $length = length ${$mail->{RFC822}}; if ($length == 0) { msg("$name($mailbox)", "WARNING: Ignoring new 0-length message (UID $mail->{UID})"); return; -- cgit v1.2.3