@@ -131,8 +131,16 @@ defmodule URI do
131
131
destructure [ _ , _ , scheme , _ , authority , path , _ , query , _ , fragment ] , parts
132
132
{ userinfo , host , port } = split_authority ( authority )
133
133
134
+ if authority do
135
+ authority = ""
136
+
137
+ if userinfo , do: authority = authority <> userinfo <> "@"
138
+ if host , do: authority = authority <> host
139
+ if port , do: authority = authority <> ":" <> integer_to_binary ( port )
140
+ end
141
+
134
142
in fo = URI.Info [
135
- scheme : scheme , path: path , query: query ,
143
+ scheme : scheme && String . downcase ( scheme ) , path: path , query: query ,
136
144
fragment: fragment , authority: authority ,
137
145
userinfo: userinfo , host: host , port: port
138
146
]
@@ -169,7 +177,7 @@ defmodule URI do
169
177
components = Regex . run % r /( ^ ( . * ) @) ?( [ ^ :] * ) ( :( \d* ) ) ?/ , s
170
178
destructure [ _ , _ , userinfo , host , _ , port ] , nillify ( components )
171
179
port = if port , do: binary_to_integer ( port )
172
- { userinfo , host , port }
180
+ { userinfo , host && String . downcase ( host ) , port }
173
181
end
174
182
175
183
# Regex.run returns empty strings sometimes. We want
0 commit comments