Skip to content

Commit

Permalink
Merge pull request #7 from taketo1113/http1.1-default-port
Browse files Browse the repository at this point in the history
Fix default port 443 with doh http/1.1
  • Loading branch information
taketo1113 authored May 15, 2024
2 parents 3ffd813 + ac8d6f4 commit cb5f303
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/ddig/ddr/designated_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def to_s
# ref: https://www.rfc-editor.org/rfc/rfc9461.html#section-4.2
def set_default_port
case @protocol
when 'http/1.1'
@port = 80
when 'h2', 'h3'
when 'http/1.1', 'h2', 'h3'
@port = 443
when 'dot', 'doq'
@port = 853
Expand Down
2 changes: 1 addition & 1 deletion spec/ddig/ddr/designated_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it "return default port with protocol: http/1.1" do
@designated_resolver = Ddig::Ddr::DesignatedResolver.new(unencrypted_resolver: '8.8.8.8', target: 'dns.google', protocol: 'http/1.1', port: nil, dohpath: nil, address: '8.8.4.4', ip: :ipv4)

expect(@designated_resolver.port).to eq 80
expect(@designated_resolver.port).to eq 443
end

it "return default port with protocol: h2" do
Expand Down

0 comments on commit cb5f303

Please sign in to comment.