Skip to content

Commit aa6d7d9

Browse files
committed
Modernize gem.
1 parent bc1bfa0 commit aa6d7d9

File tree

25 files changed

+137
-131
lines changed

25 files changed

+137
-131
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636

3737
- uses: actions/upload-artifact@v4
3838
with:
39+
include-hidden-files: true
40+
if-no-files-found: error
3941
name: coverage-${{matrix.os}}-${{matrix.ruby}}
4042
path: .covered.db
4143

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ Layout/EmptyLinesAroundModuleBody:
4747

4848
Style/FrozenStringLiteralComment:
4949
Enabled: true
50+
51+
Style/StringLiterals:
52+
Enabled: true
53+
EnforcedStyle: double_quotes

config/sus.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Released under the MIT License.
44
# Copyright, 2023, by Samuel Williams.
55

6-
require 'covered/sus'
6+
require "covered/sus"
77
include Covered::Sus

examples/early-hints/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
88

9-
require 'async'
10-
require 'async/http/endpoint'
9+
require "async"
10+
require "async/http/endpoint"
1111

1212
RESPONSE = <<~HTTP.split(/\r?\n/).join("\r\n")
1313
HTTP/1.1 103 Early Hints

examples/http1/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
88

9-
require 'async'
10-
require 'async/http/endpoint'
11-
require 'protocol/http1/connection'
9+
require "async"
10+
require "async/http/endpoint"
11+
require "protocol/http1/connection"
1212

1313
Async do
1414
endpoint = Async::HTTP::Endpoint.parse("http://localhost:8080")

examples/http1/server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
88

9-
require 'socket'
10-
require 'protocol/http1/connection'
11-
require 'protocol/http/body/buffered'
9+
require "socket"
10+
require "protocol/http1/connection"
11+
require "protocol/http/body/buffered"
1212

1313
# Test with: curl http://localhost:8080/
1414

fixtures/connection_context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2023, by Samuel Williams.
55

6-
require 'protocol/http1/connection'
6+
require "protocol/http1/connection"
77

8-
require 'socket'
8+
require "socket"
99

1010
ConnectionContext = Sus::Shared("a connection") do
1111
let(:sockets) {Socket.pair(Socket::PF_UNIX, Socket::SOCK_STREAM)}

fuzz/request/script.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Released under the MIT License.
55
# Copyright, 2020-2022, by Samuel Williams.
66

7-
require 'socket'
8-
require_relative '../../lib/protocol/http1'
7+
require "socket"
8+
require_relative "../../lib/protocol/http1"
99

1010
def test
1111
# input, output = Socket.pair(Socket::PF_UNIX, Socket::SOCK_STREAM)
@@ -25,8 +25,8 @@ def test
2525
end
2626

2727
if ENV["_"] =~ /afl/
28-
require 'kisaten'
29-
Kisaten.crash_at [], [], Signal.list['USR1']
28+
require "kisaten"
29+
Kisaten.crash_at [], [], Signal.list["USR1"]
3030

3131
while Kisaten.loop 10000
3232
test

lib/protocol/http1.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2022, by Samuel Williams.
55

6-
require_relative 'http1/version'
7-
require_relative 'http1/connection'
6+
require_relative "http1/version"
7+
require_relative "http1/connection"

lib/protocol/http1/body/chunked.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Copyright, 2019-2024, by Samuel Williams.
55
# Copyright, 2023, by Thomas Morgan.
66

7-
require 'protocol/http/body/readable'
7+
require "protocol/http/body/readable"
88

99
module Protocol
1010
module HTTP1

lib/protocol/http1/body/fixed.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http/body/readable'
6+
require "protocol/http/body/readable"
77

88
module Protocol
99
module HTTP1

lib/protocol/http1/body/remainder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http/body/readable'
6+
require "protocol/http/body/readable"
77

88
module Protocol
99
module HTTP1

lib/protocol/http1/connection.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@
77
# Copyright, 2023-2024, by Thomas Morgan.
88
# Copyright, 2024, by Anton Zhuravsky.
99

10-
require 'protocol/http/headers'
10+
require "protocol/http/headers"
1111

12-
require_relative 'reason'
13-
require_relative 'error'
12+
require_relative "reason"
13+
require_relative "error"
1414

15-
require_relative 'body/chunked'
16-
require_relative 'body/fixed'
17-
require_relative 'body/remainder'
18-
require 'protocol/http/body/head'
15+
require_relative "body/chunked"
16+
require_relative "body/fixed"
17+
require_relative "body/remainder"
18+
require "protocol/http/body/head"
1919

20-
require 'protocol/http/methods'
20+
require "protocol/http/methods"
2121

2222
module Protocol
2323
module HTTP1
24-
CONTENT_LENGTH = 'content-length'
24+
CONTENT_LENGTH = "content-length"
2525

26-
TRANSFER_ENCODING = 'transfer-encoding'
27-
CHUNKED = 'chunked'
26+
TRANSFER_ENCODING = "transfer-encoding"
27+
CHUNKED = "chunked"
2828

29-
CONNECTION = 'connection'
30-
CLOSE = 'close'
31-
KEEP_ALIVE = 'keep-alive'
29+
CONNECTION = "connection"
30+
CLOSE = "close"
31+
KEEP_ALIVE = "keep-alive"
3232

33-
HOST = 'host'
34-
UPGRADE = 'upgrade'
33+
HOST = "host"
34+
UPGRADE = "upgrade"
3535

3636
# HTTP/1.x request line parser:
3737
TOKEN = /[!#$%&'*+\-\.\^_`|~0-9a-zA-Z]+/.freeze

lib/protocol/http1/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http/error'
6+
require "protocol/http/error"
77

88
module Protocol
99
module HTTP1

lib/protocol/http1/reason.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2022, by Samuel Williams.
55

6-
require 'protocol/http/error'
6+
require "protocol/http/error"
77

88
module Protocol
99
module HTTP1

protocol-http1.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
1010
spec.authors = ["Samuel Williams", "Thomas Morgan", "Anton Zhuravsky", "Brian Morearty", "Bruno Sutic", "Olle Jonsson"]
1111
spec.license = "MIT"
1212

13-
spec.cert_chain = ['release.cert']
14-
spec.signing_key = File.expand_path('~/.gem/release.pem')
13+
spec.cert_chain = ["release.cert"]
14+
spec.signing_key = File.expand_path("~/.gem/release.pem")
1515

1616
spec.homepage = "https://github.com/socketry/protocol-http1"
1717

@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020
"source_code_uri" => "https://github.com/socketry/protocol-http1.git",
2121
}
2222

23-
spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
23+
spec.files = Dir.glob(["{lib}/**/*", "*.md"], File::FNM_DOTMATCH, base: __dir__)
2424

2525
spec.required_ruby_version = ">= 3.1"
2626

test/protocol/http1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2023, by Samuel Williams.
55

6-
require 'protocol/http1/version'
6+
require "protocol/http1/version"
77

88
describe Protocol::HTTP1 do
99
it "has a version number" do

test/protocol/http1/body/chunked.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http1/body/chunked'
7-
require 'connection_context'
6+
require "protocol/http1/body/chunked"
7+
require "connection_context"
88

99
describe Protocol::HTTP1::Body::Chunked do
1010
let(:content) {"Hello World"}
@@ -60,24 +60,24 @@
6060
let(:postfix) {"ETag: abcd\r\n"}
6161

6262
it "can read trailing etag" do
63-
headers.add('trailer', 'etag')
63+
headers.add("trailer", "etag")
6464

6565
expect(body.read).to be == "Hello World"
66-
expect(headers['etag']).to be_nil
66+
expect(headers["etag"]).to be_nil
6767

6868
expect(body.read).to be == nil
69-
expect(headers['etag']).to be == 'abcd'
69+
expect(headers["etag"]).to be == "abcd"
7070
end
7171
end
7272

7373
with "bad trailers" do
7474
let(:postfix) {":ETag abcd\r\n"}
7575

7676
it "raises error" do
77-
headers.add('trailer', 'etag')
77+
headers.add("trailer", "etag")
7878

7979
expect(body.read).to be == "Hello World"
80-
expect(headers['etag']).to be_nil
80+
expect(headers["etag"]).to be_nil
8181

8282
expect{body.read}.to raise_exception(Protocol::HTTP1::BadHeader)
8383
end

test/protocol/http1/body/fixed.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http1/body/fixed'
6+
require "protocol/http1/body/fixed"
77

88
describe Protocol::HTTP1::Body::Fixed do
99
let(:content) {"Hello World"}

test/protocol/http1/body/remainder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http1/body/remainder'
6+
require "protocol/http1/body/remainder"
77

88
describe Protocol::HTTP1::Body::Remainder do
99
let(:content) {"Hello World"}

0 commit comments

Comments
 (0)