diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2015-09-15 16:48:29 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-09-15 17:10:11 +0200 |
commit | 90d926f6f32dd3ff06e5c49e6a982777ead9f691 (patch) | |
tree | 0d91c1c134a439344737a34f99fe90036f6e03f6 /interimap | |
parent | 6011b94a5c6f0b787ce883b5646684828a54a994 (diff) |
Remove support for the Binary Content extension [RFC3516].
“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).
Diffstat (limited to 'interimap')
-rwxr-xr-x | interimap | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -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; |