net-imap 0.3.7 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pages.yml +46 -0
- data/.github/workflows/test.yml +5 -12
- data/Gemfile +1 -0
- data/README.md +15 -4
- data/Rakefile +0 -7
- data/benchmarks/generate_parser_benchmarks +52 -0
- data/benchmarks/parser.yml +578 -0
- data/benchmarks/stringprep.yml +1 -1
- data/lib/net/imap/authenticators.rb +26 -57
- data/lib/net/imap/command_data.rb +13 -6
- data/lib/net/imap/deprecated_client_options.rb +139 -0
- data/lib/net/imap/response_data.rb +46 -41
- data/lib/net/imap/response_parser/parser_utils.rb +230 -0
- data/lib/net/imap/response_parser.rb +665 -627
- data/lib/net/imap/sasl/anonymous_authenticator.rb +69 -0
- data/lib/net/imap/sasl/authentication_exchange.rb +107 -0
- data/lib/net/imap/sasl/authenticators.rb +118 -0
- data/lib/net/imap/sasl/client_adapter.rb +72 -0
- data/lib/net/imap/{authenticators/cram_md5.rb → sasl/cram_md5_authenticator.rb} +21 -11
- data/lib/net/imap/sasl/digest_md5_authenticator.rb +180 -0
- data/lib/net/imap/sasl/external_authenticator.rb +83 -0
- data/lib/net/imap/sasl/gs2_header.rb +80 -0
- data/lib/net/imap/{authenticators/login.rb → sasl/login_authenticator.rb} +25 -16
- data/lib/net/imap/sasl/oauthbearer_authenticator.rb +199 -0
- data/lib/net/imap/sasl/plain_authenticator.rb +101 -0
- data/lib/net/imap/sasl/protocol_adapters.rb +45 -0
- data/lib/net/imap/sasl/scram_algorithm.rb +58 -0
- data/lib/net/imap/sasl/scram_authenticator.rb +287 -0
- data/lib/net/imap/sasl/stringprep.rb +6 -66
- data/lib/net/imap/sasl/xoauth2_authenticator.rb +106 -0
- data/lib/net/imap/sasl.rb +144 -43
- data/lib/net/imap/sasl_adapter.rb +21 -0
- data/lib/net/imap/stringprep/nameprep.rb +70 -0
- data/lib/net/imap/stringprep/saslprep.rb +69 -0
- data/lib/net/imap/stringprep/saslprep_tables.rb +96 -0
- data/lib/net/imap/stringprep/tables.rb +146 -0
- data/lib/net/imap/stringprep/trace.rb +85 -0
- data/lib/net/imap/stringprep.rb +159 -0
- data/lib/net/imap.rb +976 -590
- data/net-imap.gemspec +1 -1
- data/rakelib/saslprep.rake +4 -4
- data/rakelib/string_prep_tables_generator.rb +82 -60
- metadata +30 -11
- data/lib/net/imap/authenticators/digest_md5.rb +0 -115
- data/lib/net/imap/authenticators/plain.rb +0 -41
- data/lib/net/imap/authenticators/xoauth2.rb +0 -20
- data/lib/net/imap/sasl/saslprep.rb +0 -55
- data/lib/net/imap/sasl/saslprep_tables.rb +0 -98
- data/lib/net/imap/sasl/stringprep_tables.rb +0 -153
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ea9e3ff227103752eda7658da755be8f4aabda8fdf60f33379f95c27a1a69c
|
4
|
+
data.tar.gz: b7878cec3bdd9216ee1eda01fe8276c1753f01de6bd875988415665150b5fb00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df018d07e090469ff814af057d94ee4c8b9327071bc173f6f10aa106385071bd39076c334e195f163a670c756b3379a38ffcb00b46248a06b80b3d4aa3ed04c1
|
7
|
+
data.tar.gz: b6215f30153f034d04bfe6d0006da68cb0beee20ec15c2664283d2c766b5a37b9fddfaec82a0fa94a36233e175e81a492829a7094fda4581dc847573e572f0e9
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: Deploy RDoc site to Pages
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ 'master' ]
|
6
|
+
workflow_dispatch:
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: read
|
10
|
+
pages: write
|
11
|
+
id-token: write
|
12
|
+
|
13
|
+
concurrency:
|
14
|
+
group: "pages"
|
15
|
+
cancel-in-progress: true
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
build:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
steps:
|
21
|
+
- name: Checkout
|
22
|
+
uses: actions/checkout@v4
|
23
|
+
- name: Setup Ruby
|
24
|
+
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
|
25
|
+
with:
|
26
|
+
ruby-version: '3.2'
|
27
|
+
bundler-cache: true
|
28
|
+
- name: Setup Pages
|
29
|
+
id: pages
|
30
|
+
uses: actions/configure-pages@v3
|
31
|
+
- name: Build with RDoc
|
32
|
+
run: bundle exec rake rdoc
|
33
|
+
- name: Upload artifact
|
34
|
+
uses: actions/upload-pages-artifact@v2
|
35
|
+
with: { path: 'doc' }
|
36
|
+
|
37
|
+
deploy:
|
38
|
+
environment:
|
39
|
+
name: github-pages
|
40
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
41
|
+
runs-on: ubuntu-latest
|
42
|
+
needs: build
|
43
|
+
steps:
|
44
|
+
- name: Deploy to GitHub Pages
|
45
|
+
id: deployment
|
46
|
+
uses: actions/deploy-pages@v2
|
data/.github/workflows/test.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
8
|
with:
|
9
9
|
engine: cruby
|
10
|
-
min_version: 2.
|
10
|
+
min_version: 2.7
|
11
11
|
|
12
12
|
build:
|
13
13
|
needs: ruby-versions
|
@@ -17,22 +17,15 @@ jobs:
|
|
17
17
|
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
18
18
|
os: [ ubuntu-latest, macos-latest ]
|
19
19
|
experimental: [false]
|
20
|
-
include:
|
21
|
-
# - ruby: 2.6
|
22
|
-
# os: ubuntu-latest
|
23
|
-
# experimental: true
|
24
|
-
- ruby: 2.6
|
25
|
-
os: macos-latest
|
26
|
-
experimental: false
|
27
20
|
runs-on: ${{ matrix.os }}
|
28
21
|
continue-on-error: ${{ matrix.experimental }}
|
29
22
|
steps:
|
30
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v4
|
31
24
|
- name: Set up Ruby
|
32
25
|
uses: ruby/setup-ruby@v1
|
33
26
|
with:
|
34
27
|
ruby-version: ${{ matrix.ruby }}
|
35
|
-
|
36
|
-
|
28
|
+
bundler-cache: true
|
29
|
+
rubygems: latest
|
37
30
|
- name: Run test
|
38
|
-
run: rake test
|
31
|
+
run: bundle exec rake test
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -21,11 +21,24 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
+
### Connect with TLS to port 993
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
imap = Net::IMAP.new('mail.example.com', ssl: true)
|
28
|
+
imap.port => 993
|
29
|
+
imap.tls_verified? => true
|
30
|
+
case imap.greeting.name
|
31
|
+
in /OK/i
|
32
|
+
# The client is connected in the "Not Authenticated" state.
|
33
|
+
imap.authenticate("PLAIN", "joe_user", "joes_password")
|
34
|
+
in /PREAUTH/i
|
35
|
+
# The client is connected in the "Authenticated" state.
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
24
39
|
### List sender and subject of all recent messages in the default mailbox
|
25
40
|
|
26
41
|
```ruby
|
27
|
-
imap = Net::IMAP.new('mail.example.com')
|
28
|
-
imap.authenticate('LOGIN', 'joe_user', 'joes_password')
|
29
42
|
imap.examine('INBOX')
|
30
43
|
imap.search(["RECENT"]).each do |message_id|
|
31
44
|
envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
|
@@ -36,8 +49,6 @@ end
|
|
36
49
|
### Move all messages from April 2003 from "Mail/sent-mail" to "Mail/sent-apr03"
|
37
50
|
|
38
51
|
```ruby
|
39
|
-
imap = Net::IMAP.new('mail.example.com')
|
40
|
-
imap.authenticate('LOGIN', 'joe_user', 'joes_password')
|
41
52
|
imap.select('Mail/sent-mail')
|
42
53
|
if not imap.list('Mail/', 'sent-apr03')
|
43
54
|
imap.create('Mail/sent-apr03')
|
data/Rakefile
CHANGED
@@ -10,11 +10,4 @@ Rake::TestTask.new(:test) do |t|
|
|
10
10
|
t.test_files = FileList["test/**/test_*.rb"]
|
11
11
|
end
|
12
12
|
|
13
|
-
task :sync_tool do
|
14
|
-
require 'fileutils'
|
15
|
-
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
|
16
|
-
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
17
|
-
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
18
|
-
end
|
19
|
-
|
20
13
|
task :default => :test
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "pathname"
|
5
|
+
require "net/imap"
|
6
|
+
|
7
|
+
path = Pathname.new(__dir__) / "../test/net/imap/fixtures/response_parser"
|
8
|
+
files = path.glob("*.yml")
|
9
|
+
tests = files.flat_map {|file|
|
10
|
+
file.to_s
|
11
|
+
.then { YAML.unsafe_load_file _1 }
|
12
|
+
.fetch(:tests)
|
13
|
+
.select {|test_name, test|
|
14
|
+
:parser_assert_equal == test.fetch(:test_type) {
|
15
|
+
test.key?(:expected) ? :parser_assert_equal : :parser_pending
|
16
|
+
}
|
17
|
+
}
|
18
|
+
.map {|test_name, _|
|
19
|
+
[
|
20
|
+
file.relative_path_from(__dir__).to_s,
|
21
|
+
test_name.to_s,
|
22
|
+
]
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
init = <<RUBY
|
27
|
+
require "yaml"
|
28
|
+
require "net/imap"
|
29
|
+
|
30
|
+
def load_response(file, name)
|
31
|
+
YAML.unsafe_load_file(file).dig(:tests, name, :response)
|
32
|
+
.force_encoding "ASCII-8BIT" \\
|
33
|
+
or abort "ERRORO: missing %p fixture data in %p" % [name, file]
|
34
|
+
end
|
35
|
+
|
36
|
+
parser = Net::IMAP::ResponseParser.new
|
37
|
+
RUBY
|
38
|
+
|
39
|
+
prelude = <<RUBY
|
40
|
+
response = load_response(%p,
|
41
|
+
%p)
|
42
|
+
RUBY
|
43
|
+
script = "parser.parse(response)"
|
44
|
+
|
45
|
+
benchmarks = tests.map {|file, fixture_name|
|
46
|
+
name = fixture_name.delete_prefix("test_")
|
47
|
+
{name:, prelude: prelude % [file, fixture_name], script:}
|
48
|
+
.transform_keys(&:to_s)
|
49
|
+
}
|
50
|
+
.sort_by { _1["name"] }
|
51
|
+
|
52
|
+
puts YAML.dump({"prelude" => init, "benchmark" => benchmarks})
|