Skip to content

Commit a4b9140

Browse files
committed
Use URI::DEFAULT_PARSER.unescape() instead of CGI.unescape()
It never felt quite right using CGI and it incorrectly changes '+' to space.
1 parent 6c60e2e commit a4b9140

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/mqtt/client.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
autoload :OpenSSL, 'openssl'
22
autoload :URI, 'uri'
3-
autoload :CGI, 'cgi'
43

54
# Client class for talking to an MQTT server
65
module MQTT
@@ -592,8 +591,8 @@ def parse_uri(uri)
592591
{
593592
:host => uri.host,
594593
:port => uri.port || nil,
595-
:username => uri.user ? CGI.unescape(uri.user) : nil,
596-
:password => uri.password ? CGI.unescape(uri.password) : nil,
594+
:username => uri.user ? URI::DEFAULT_PARSER.unescape(uri.user) : nil,
595+
:password => uri.password ? URI::DEFAULT_PARSER.unescape(uri.password) : nil,
597596
:ssl => ssl
598597
}
599598
end

0 commit comments

Comments
 (0)