net-imap 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of net-imap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/net/imap/response_parser/parser_utils.rb +4 -4
- data/lib/net/imap/response_parser.rb +19 -34
- data/lib/net/imap.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8cb634d9ee1613035c81a25d28ae9f36b3d0985bcb61da9a38aacb87854a5f
|
4
|
+
data.tar.gz: e504b145415da3a025c6f4ab973b212764c75ef4214d0fed485fdb0b17e83752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cef39a5ac6454ded84c395fb2671df678e17611d7eff42665113c21f955ebcb6ffdf9035dd1e6fdb3de38aa38f43431537ded3d484ffba7d699b478bb8c3e1e
|
7
|
+
data.tar.gz: 23f777092b2940b725685285a6372b56744a9968fcc76872ebf9ef3136fb3665a89a85174dc34636e547b90d8d3a1945627ce79390f10122aadb57b57004f789
|
@@ -15,6 +15,7 @@ module Net
|
|
15
15
|
|
16
16
|
# we can skip lexer for single character matches, as a shortcut
|
17
17
|
def def_char_matchers(name, char, token)
|
18
|
+
byte = char.ord
|
18
19
|
match_name = name.match(/\A[A-Z]/) ? "#{name}!" : name
|
19
20
|
char = char.dump
|
20
21
|
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
@@ -27,7 +28,7 @@ module Net
|
|
27
28
|
|
28
29
|
# use token or string peek
|
29
30
|
def peek_#{name}?
|
30
|
-
@token ? @token.symbol == #{token} : @str
|
31
|
+
@token ? @token.symbol == #{token} : @str.getbyte(@pos) == #{byte}
|
31
32
|
end
|
32
33
|
|
33
34
|
# like accept(token_symbols); returns token or nil
|
@@ -35,7 +36,7 @@ module Net
|
|
35
36
|
if @token&.symbol == #{token}
|
36
37
|
#{SHIFT_TOKEN}
|
37
38
|
#{char}
|
38
|
-
elsif !@token && @str
|
39
|
+
elsif !@token && @str.getbyte(@pos) == #{byte}
|
39
40
|
@pos += 1
|
40
41
|
#{char}
|
41
42
|
end
|
@@ -46,7 +47,7 @@ module Net
|
|
46
47
|
if @token&.symbol == #{token}
|
47
48
|
#{SHIFT_TOKEN}
|
48
49
|
#{char}
|
49
|
-
elsif !@token && @str
|
50
|
+
elsif !@token && @str.getbyte(@pos) == #{byte}
|
50
51
|
@pos += 1
|
51
52
|
#{char}
|
52
53
|
else
|
@@ -109,7 +110,6 @@ module Net
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
RUBY
|
112
|
-
|
113
113
|
end
|
114
114
|
|
115
115
|
end
|
@@ -1101,47 +1101,32 @@ module Net
|
|
1101
1101
|
end
|
1102
1102
|
|
1103
1103
|
# RFC3501 & RFC9051:
|
1104
|
-
#
|
1104
|
+
# header-fld-name = astring
|
1105
|
+
#
|
1106
|
+
# NOTE: Previously, Net::IMAP recreated the raw original source string.
|
1107
|
+
# Now, it grabs the raw encoded value using @str and @pos. A future
|
1108
|
+
# version may simply return the decoded astring value. Although that is
|
1109
|
+
# technically incompatible, it should almost never make a difference: all
|
1110
|
+
# standard header field names are valid atoms:
|
1111
|
+
#
|
1112
|
+
# https://www.iana.org/assignments/message-headers/message-headers.xhtml
|
1105
1113
|
#
|
1106
1114
|
# Although RFC3501 allows any astring, RFC5322-valid header names are one
|
1107
1115
|
# or more of the printable US-ASCII characters, except SP and colon. So
|
1108
1116
|
# empty string isn't valid, and literals aren't needed and should not be
|
1109
|
-
# used. This
|
1117
|
+
# used. This is explicitly unchanged by [I18N-HDRS] (RFC6532).
|
1110
1118
|
#
|
1111
1119
|
# RFC5233:
|
1112
|
-
#
|
1113
|
-
#
|
1114
|
-
#
|
1115
|
-
#
|
1116
|
-
#
|
1117
|
-
#
|
1118
|
-
# Atom and quoted should be sufficient.
|
1119
|
-
#
|
1120
|
-
# TODO: Use original source string, rather than decode and re-encode.
|
1121
|
-
# TODO: or at least, DRY up this code with the send_command formatting.
|
1120
|
+
# optional-field = field-name ":" unstructured CRLF
|
1121
|
+
# field-name = 1*ftext
|
1122
|
+
# ftext = %d33-57 / ; Printable US-ASCII
|
1123
|
+
# %d59-126 ; characters not including
|
1124
|
+
# ; ":".
|
1122
1125
|
def header_fld_name
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
return '""'
|
1128
|
-
when /[\x80-\xff\r\n]/n
|
1129
|
-
warn "%s header-fld-name %p has invalid RFC5322 field-name char: %p" %
|
1130
|
-
[self.class, str, $&]
|
1131
|
-
# literal
|
1132
|
-
return "{" + str.bytesize.to_s + "}" + CRLF + str
|
1133
|
-
when /[^\x21-\x39\x3b-\xfe]/n
|
1134
|
-
warn "%s header-fld-name %p has invalid RFC5322 field-name char: %p" %
|
1135
|
-
[self.class, str, $&]
|
1136
|
-
# invalid quoted string
|
1137
|
-
return '"' + str.gsub(/["\\]/n, "\\\\\\&") + '"'
|
1138
|
-
when /[(){ \x00-\x1f\x7f%*"\\]/n
|
1139
|
-
# quoted string
|
1140
|
-
return '"' + str.gsub(/["\\]/n, "\\\\\\&") + '"'
|
1141
|
-
else
|
1142
|
-
# atom
|
1143
|
-
return str
|
1144
|
-
end
|
1126
|
+
assert_no_lookahead
|
1127
|
+
start = @pos
|
1128
|
+
astring
|
1129
|
+
@str[start...@pos - 1]
|
1145
1130
|
end
|
1146
1131
|
|
1147
1132
|
# mailbox-data = "FLAGS" SP flag-list / "LIST" SP mailbox-list /
|
data/lib/net/imap.rb
CHANGED
@@ -662,7 +662,7 @@ module Net
|
|
662
662
|
# * {IMAP URLAUTH Authorization Mechanism Registry}[https://www.iana.org/assignments/urlauth-authorization-mechanism-registry/urlauth-authorization-mechanism-registry.xhtml]
|
663
663
|
#
|
664
664
|
class IMAP < Protocol
|
665
|
-
VERSION = "0.4.
|
665
|
+
VERSION = "0.4.4"
|
666
666
|
|
667
667
|
# Aliases for supported capabilities, to be used with the #enable command.
|
668
668
|
ENABLE_ALIASES = {
|
@@ -2188,7 +2188,7 @@ module Net
|
|
2188
2188
|
.join(' ')
|
2189
2189
|
synchronize do
|
2190
2190
|
send_command("ENABLE #{capabilities}")
|
2191
|
-
result = clear_responses("ENABLED").last
|
2191
|
+
result = clear_responses("ENABLED").last || []
|
2192
2192
|
@utf8_strings ||= result.include? "UTF8=ACCEPT"
|
2193
2193
|
@utf8_strings ||= result.include? "IMAP4REV2"
|
2194
2194
|
result
|
@@ -2642,7 +2642,7 @@ module Net
|
|
2642
2642
|
else
|
2643
2643
|
send_command(cmd, *keys)
|
2644
2644
|
end
|
2645
|
-
clear_responses("SEARCH").last
|
2645
|
+
clear_responses("SEARCH").last || []
|
2646
2646
|
end
|
2647
2647
|
end
|
2648
2648
|
|
@@ -2691,7 +2691,7 @@ module Net
|
|
2691
2691
|
normalize_searching_criteria(search_keys)
|
2692
2692
|
synchronize do
|
2693
2693
|
send_command(cmd, sort_keys, charset, *search_keys)
|
2694
|
-
clear_responses("SORT").last
|
2694
|
+
clear_responses("SORT").last || []
|
2695
2695
|
end
|
2696
2696
|
end
|
2697
2697
|
|
@@ -2704,7 +2704,7 @@ module Net
|
|
2704
2704
|
normalize_searching_criteria(search_keys)
|
2705
2705
|
synchronize do
|
2706
2706
|
send_command(cmd, algorithm, charset, *search_keys)
|
2707
|
-
clear_responses("THREAD").last
|
2707
|
+
clear_responses("THREAD").last || []
|
2708
2708
|
end
|
2709
2709
|
end
|
2710
2710
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-protocol
|