[Bps-public-commit] Net-IMAP-Server branch, master, updated. 1.36-3-ge1e3ddc
Alex Vandiver
alexmv at bestpractical.com
Sun Jan 26 19:17:45 EST 2014
The branch, master has been updated
via e1e3ddcf0e2395e2623fff84e4032f47cbc5e085 (commit)
via 80c8667a984bd7eaf10de271b3c112c211ae647a (commit)
via 94f9df0d0a76c1f63ae4e4e7e7c6801c990b3768 (commit)
from 1d5cfb867b21c47e7b3113daa0b38b90b350561b (commit)
Summary of changes:
Changes | 4 ++++
MANIFEST | 1 +
lib/Net/IMAP/Server.pm | 2 +-
lib/Net/IMAP/Server/Command.pm | 16 +++++++++-------
t/rfc-6.3.10-status.t | 41 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 56 insertions(+), 8 deletions(-)
create mode 100644 t/rfc-6.3.10-status.t
- Log -----------------------------------------------------------------
commit 94f9df0d0a76c1f63ae4e4e7e7c6801c990b3768
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sun Jan 26 18:39:08 2014 -0500
Testcases for STATUS
diff --git a/t/rfc-6.3.10-status.t b/t/rfc-6.3.10-status.t
new file mode 100644
index 0000000..3c45d27
--- /dev/null
+++ b/t/rfc-6.3.10-status.t
@@ -0,0 +1,41 @@
+use lib 't/lib';
+use strict;
+use warnings;
+
+use Net::IMAP::Server::Test;
+my $t = "Net::IMAP::Server::Test";
+
+$t->start_server_ok;
+
+$t->connect_ok;
+$t->cmd_like( "STATUS INBOX (MESSAGES)", "tag BAD Log in first" );
+
+$t->cmd_ok("LOGIN username password");
+
+$t->cmd_like( "STATUS INBOX", "tag BAD Not enough options" );
+$t->cmd_like( "STATUS INBOX MESSAGES", "tag BAD Wrong second option" );
+
+my $test = sub {
+ my @res = split /\r\n/, $t->send_cmd( "STATUS INBOX (@_)" );
+ like( pop(@res), qr/^tag OK\b/);
+ my $untagged = pop(@res);
+ like( $untagged, qr/^\* STATUS "INBOX" \(.*?\)$/, "Got an untagged STATUS response" );
+ $untagged =~ qr/\((.*?)\)/;
+ return split ' ', $1;
+};
+
+my %ret = $test->("MESSAGES");
+is_deeply( \%ret, { MESSAGES => 0 },
+ "Asked for MESSAGES, got MESSAGES" );
+
+%ret = $test->(qw/MESSAGES UIDNEXT/);
+is_deeply( \%ret, { MESSAGES => 0, UIDNEXT => 1000 },
+ "Asked for MESSAGES and UIDNEXT, got both" );
+
+%ret = $test->(qw/MESSAGES UIDNEXT UNSEEN/);
+is_deeply( \%ret, { MESSAGES => 0, UIDNEXT => 1000, UNSEEN => 0 },
+ "Asked for MESSAGES, UIDNEXT and UNSEEN, got all" );
+
+$t->disconnect;
+
+done_testing;
commit 80c8667a984bd7eaf10de271b3c112c211ae647a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sun Jan 26 18:39:21 2014 -0500
Work around Regexp::Common >= 2013030901, which adds a capturing group
Versions of Regexp::Common since 2013030901 always add a capturing group
to $RE{balanced} matches, regardless of the whether {-keep} is used or
not. This results in sub-expressions being repeated in the parsed
option list.
Switch from using split to using the token regular expression to nibble
off matching tokens.
Reported-by: Lubomir Rintel <lkundrak at v3.sk>
diff --git a/lib/Net/IMAP/Server/Command.pm b/lib/Net/IMAP/Server/Command.pm
index 15c5c41..bbd3d14 100644
--- a/lib/Net/IMAP/Server/Command.pm
+++ b/lib/Net/IMAP/Server/Command.pm
@@ -137,14 +137,16 @@ sub parse_options {
return $self->_parsed_options
if not defined $str and not defined $self->options_str;
+ my $to_parse = defined $str ? $str : $self->options_str;
+
+ my $token = qr/^($RE{delimited}{-delim=>'"'}{-esc=>'\\'}
+ |$RE{balanced}{-parens=>'()'}
+ |\S+$RE{balanced}{-parens=>'()[]<>'}
+ |\S+)\s*/x;
+
my @parsed;
- for my $term (
- grep {/\S/}
- split
- /($RE{delimited}{-delim=>'"'}{-esc=>'\\'}|$RE{balanced}{-parens=>'()'}|\S+$RE{balanced}{-parens=>'()[]<>'}|\S+)/,
- defined $str ? $str : $self->options_str
- )
- {
+ while ($to_parse =~ s/$token//) {
+ my $term = $1;
if ( $term =~ /^$RE{delimited}{-delim=>'"'}{-esc=>'\\'}{-keep}$/ ) {
my $value = $3;
$value =~ s/\\([\\"])/$1/g;
commit e1e3ddcf0e2395e2623fff84e4032f47cbc5e085
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sun Jan 26 19:16:19 2014 -0500
Version 1.37 releng
diff --git a/Changes b/Changes
index 8f8938b..a67ad7d 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for Net-IMAP-Server
+1.37 Sun Jan 26 19:14:17 2013
+ * Fix parsing par parenthesized expressions with recent
+ Regexp::Common
+
1.36 Thu Jan 17 08:09:17 2012
* Fix string literals (such as for APPEND), which have counted
characters incorrectly since 1.32 due to newline trimming.
diff --git a/MANIFEST b/MANIFEST
index a791adb..4fd82a0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -65,6 +65,7 @@ t/rfc-6.2.1-starttls.t
t/rfc-6.2.2-authenticate.t
t/rfc-6.2.3-login.t
t/rfc-6.3.1-select.t
+t/rfc-6.3.10-status.t
t/rfc-6.3.3-create.t
t/rfc-6.3.4-delete.t
t/rfc-6.3.5-rename.t
diff --git a/lib/Net/IMAP/Server.pm b/lib/Net/IMAP/Server.pm
index bac9d3b..e947392 100644
--- a/lib/Net/IMAP/Server.pm
+++ b/lib/Net/IMAP/Server.pm
@@ -9,7 +9,7 @@ use UNIVERSAL::require;
use Coro;
use 5.008_008;
-our $VERSION = '1.36';
+our $VERSION = '1.37';
=head1 NAME
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list