server.
* Add a configuration option 'null-stderr=YES' to send STDERR to
/dev/null for type=tunnel.
- * Add support for the Binary Content extension [RFC3516]. Enabled by
- default if both the local and remote servers advertize "BINARY".
- Can be disabled by adding 'use-binary=NO' to the default section in
- the configuration file.
* Exit with return value 0 when receiving a SIGTERM.
* Add SSL options SINGLE_ECDH_USE, SINGLE_DH_USE, NO_SSLv2, NO_SSLv3
and NO_COMPRESSION to the compiled-in CTX options.
* LITERAL+ [RFC2088] non-synchronizing literals (recommended),
* MULTIAPPEND [RFC3502] (recommended),
* COMPRESS=DEFLATE [RFC4978] (recommended),
- * SASL-IR [RFC4959] SASL Initial Client Response,
- * UNSELECT [RFC3691], and
- * BINARY [RFC3516].
+ * SASL-IR [RFC4959] SASL Initial Client Response, and
+ * UNSELECT [RFC3691].
#######################################################################
, '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);
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[]/;
#############################################################################
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];
# 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;
for type \fItype\fR=tunnel.
(Default: \(lqNO\(rq.)
-.TP
-.I use-binary
-Whether to use the Binary Content extension [RFC3516] in FETCH and
-APPEND commands.
-This is useful for binary attachments for instance, as it avoids the
-overhead caused by base64 encodings. Moreover if the IMAP COMPRESS
-extension is enabled, full flush points are placed around large non-text
-literals to empty the compression dictionary.
-This option is only available in the default section, and is ignored if
-either server does not advertize \(lqBINARY\(rq in its capability list.
-(Default: \(lqYES\(rq.)
-
.TP
.I SSL_cipher_list
The cipher list to send to the server. Although the server determines
.IP \[bu]
COMPRESS=DEFLATE [RFC4978] (recommended),
.IP \[bu]
-SASL-IR [RFC4959] SASL Initial Client Response,
-.IP \[bu]
-UNSELECT [RFC3691], and
+SASL-IR [RFC4959] SASL Initial Client Response, and
.IP \[bu]
-BINARY [RFC3516].
+UNSELECT [RFC3691].
.SH KNOWN BUGS AND LIMITATIONS
#list-mailbox = "*"
list-select-opts = SUBSCRIBED
ignore-mailbox = ^virtual/
-#use-binary = YES
[local]
type = tunnel
# Issue an APPEND command with the given mails. Croak if the server
# did not advertise "UIDPLUS" (RFC 4315) in its CAPABILITY list.
# Each $mail is a hash reference with key 'RFC822' and optionally
-# 'FLAGS' and 'INTERNALDATE'. If the server supports the "BINARY"
-# extension (RFC 3516), the key 'RFC822' can be replaced with 'BINARY'
-# to send the mail body as a binary literal.
+# 'FLAGS' and 'INTERNALDATE'.
# Providing multiple mails is only allowed for servers supporting
# "MULTIAPPEND" (RFC 3502).
# Return the list of UIDs allocated for the new messages.
my $str = ' ';
$str .= '('.join(' ', grep {lc $_ ne '\recent'} @{$mail->{FLAGS}}).') ' if defined $mail->{FLAGS};
$str .= '"'.$mail->{INTERNALDATE}.'" ' if defined $mail->{INTERNALDATE};
- my ($body, $t) = defined $mail->{RFC822} ? ($mail->{RFC822}, 0)
- : defined $mail->{BINARY} ? ($mail->{BINARY}, 1)
- : $self->panic("Missing message body in APPEND");
$self->_cmd_extend(\$str);
- $self->_cmd_extend_lit($body, $t);
+ $self->_cmd_extend_lit($mail->{RFC822} // $self->panic("Missing message body in APPEND"));
}
$self->_cmd_flush();
# FETCH new messages since the UIDNEXT found in the persistent cache
# (or 1 in no such UIDNEXT is found), and process each response on the
# fly with the callback.
-# The list of attributes to FETCH, $attr, much contain either BODY or
-# BINARY.
+# The list of attributes to FETCH, $attr, must contain BODY[].
# If an @ignore list is supplied, then these messages are ignored from
# the UID FETCH range.
# Finally, update the UIDNEXT from the persistent cache to the value
}
-# $self->_cmd_extend_lit($lit, [$lit8])
+# $self->_cmd_extend_lit($lit)
# Append the literal $lit to the command buffer. $lit must be a
-# scalar reference. If $lit8 is true, a literal8 is sent instead [RFC
-# 3516].
-sub _cmd_extend_lit($$;$) {
- my ($self, $lit, $lit8) = @_;
+# scalar reference.
+sub _cmd_extend_lit($$) {
+ my ($self, $lit) = @_;
my $len = length($$lit);
my $d = $self->{_Z_DEFLATE};
- # create a full flush point for long binary literals
- my $z_flush = ($len > 4096 and !($self->{'use-binary'} // 1 and !$lit8)) ? 1 : 0;
- $lit8 = $lit8 ? '~' : ''; # literal8, RFC 3516 BINARY
-
- my $strlen = $lit8.'{'.$len.$self->{_LITPLUS}.'}'.$CRLF;
+ # create a full flush point for long literals, cf. RFC 4978 section 4
+ my $z_flush = $len > $BUFSIZE ? 1 : 0;
+ my $strlen = "{$len$self->{_LITPLUS}}$CRLF";
if ($self->{_LITPLUS} ne '') {
$self->_cmd_extend_(\$strlen);
elsif (s/\A(?:RFC822|BODY\[\]) //) {
$mail{RFC822} = \$self->_nstring(\$_);
}
- elsif (s/\ABINARY\[\] //) {
- if (s/\A~\{([0-9]+)\}\z//) { # literal8, RFC 3516 BINARY
- (my $lit, $_) = $self->_getline($1);
- $mail{BINARY} = $lit;
- } else {
- $mail{RFC822} = \$self->_nstring(\$_);
- }
- }
elsif (s/\AFLAGS \((\\?$RE_ATOM_CHAR+(?: \\?$RE_ATOM_CHAR+)*)?\)//) {
$mail{FLAGS} = defined $1 ? [ split / /, $1 ] : [];
}
my $uid = $mail{UID} // $self->panic(); # sanity check
$self->panic() unless defined $mail{MODSEQ} or !$self->_enabled('QRESYNC'); # sanity check
- if (!exists $mail{RFC822} and !exists $mail{BINARY} and !exists $mail{ENVELOPE} and # ignore new mails
+ if (!exists $mail{RFC822} and !exists $mail{ENVELOPE} and # ignore new mails
(!exists $self->{_MODIFIED}->{$uid} or $self->{_MODIFIED}->{$uid}->[0] < $mail{MODSEQ} or
($self->{_MODIFIED}->{$uid}->[0] == $mail{MODSEQ} and !defined $self->{_MODIFIED}->{$uid}->[1]))) {
my $flags = join ' ', sort(grep {lc $_ ne '\recent'} @{$mail{FLAGS}}) if defined $mail{FLAGS};