net-imap 0.3.4 → 0.4.1
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 +12 -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/data_encoding.rb +3 -3
- 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 +68 -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} +15 -9
- data/lib/net/imap/sasl/digest_md5_authenticator.rb +168 -0
- data/lib/net/imap/sasl/external_authenticator.rb +62 -0
- data/lib/net/imap/sasl/gs2_header.rb +80 -0
- data/lib/net/imap/{authenticators/login.rb → sasl/login_authenticator.rb} +19 -14
- data/lib/net/imap/sasl/oauthbearer_authenticator.rb +164 -0
- data/lib/net/imap/sasl/plain_authenticator.rb +93 -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 +278 -0
- data/lib/net/imap/sasl/stringprep.rb +6 -66
- data/lib/net/imap/sasl/xoauth2_authenticator.rb +88 -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 +2 -2
- data/rakelib/saslprep.rake +4 -4
- data/rakelib/string_prep_tables_generator.rb +82 -60
- metadata +31 -12
- 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: 2bba73e8db611b37b7c5b9be540d99c2288e9188e7f12620259862b30db47815
|
4
|
+
data.tar.gz: fde1bcda99236beafea397d36768fb9fe185ec20ca2cd5d9c991b48cfdf51bd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee43fab9eaea8c870940e0cc625e3223722e4b722e1055da6f3629707aaf12e580143139abb97ae1294757a99db977428c8aa23bc57d8e9a23ff9ab5eb695cf
|
7
|
+
data.tar.gz: 67a965fdd6b4af0480917241a8efad57c3356c82ec975bcc10373242e477718a1751e78cc9f0e51286b553e6222c26cddca119dbaa9dfef855c9611de6a55a64
|
@@ -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
@@ -3,29 +3,29 @@ name: ubuntu
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
+
ruby-versions:
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
+
with:
|
9
|
+
engine: cruby
|
10
|
+
min_version: 2.7
|
11
|
+
|
6
12
|
build:
|
13
|
+
needs: ruby-versions
|
7
14
|
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
15
|
strategy:
|
9
16
|
matrix:
|
10
|
-
ruby:
|
17
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
11
18
|
os: [ ubuntu-latest, macos-latest ]
|
12
19
|
experimental: [false]
|
13
|
-
include:
|
14
|
-
# - ruby: 2.6
|
15
|
-
# os: ubuntu-latest
|
16
|
-
# experimental: true
|
17
|
-
- ruby: 2.6
|
18
|
-
os: macos-latest
|
19
|
-
experimental: false
|
20
20
|
runs-on: ${{ matrix.os }}
|
21
21
|
continue-on-error: ${{ matrix.experimental }}
|
22
22
|
steps:
|
23
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v4
|
24
24
|
- name: Set up Ruby
|
25
25
|
uses: ruby/setup-ruby@v1
|
26
26
|
with:
|
27
27
|
ruby-version: ${{ matrix.ruby }}
|
28
|
-
|
29
|
-
|
28
|
+
bundler-cache: true
|
29
|
+
rubygems: latest
|
30
30
|
- name: Run test
|
31
|
-
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})
|