Skip to content

Commit

Permalink
Add https_client_spec for fully-qualified host name with trailing dot
Browse files Browse the repository at this point in the history
  • Loading branch information
compumike committed Dec 12, 2022
1 parent b5aa703 commit 5e69f8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/manual/https_client_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ describe "https requests" do
HTTP::Client.get("https://google.com")
end

it "can fetch from google.com. FQDN with trailing dot (#12777)" do
HTTP::Client.get("https://google.com.")
end

it "can close request before consuming body" do
HTTP::Client.get("https://crystal-lang.org") do
break
Expand Down
4 changes: 4 additions & 0 deletions spec/std/uri_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ describe "URI" do
assert_uri("http://[::1]:81/", scheme: "http", host: "[::1]", port: 81, path: "/")
assert_uri("http://192.0.2.16:81/", scheme: "http", host: "192.0.2.16", port: 81, path: "/")

# preserves fully-qualified host with trailing dot
assert_uri("https://example.com./", scheme: "https", host: "example.com.", path: "/")
assert_uri("https://example.com.:8443/", scheme: "https", host: "example.com.", port: 8443, path: "/")

# port
it { URI.parse("http://192.168.0.2:/foo").should eq URI.new(scheme: "http", host: "192.168.0.2", path: "/foo") }

Expand Down

0 comments on commit 5e69f8d

Please sign in to comment.