diff options
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/http.rb | 3 | ||||
-rw-r--r-- | lib/net/http/header.rb | 2 | ||||
-rw-r--r-- | lib/net/imap.rb | 6 | ||||
-rw-r--r-- | lib/net/smtp.rb | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index f77df5efa3..f6499f2a59 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -912,8 +912,7 @@ module Net #:nodoc: buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n" buf << "Host: #{@address}:#{@port}\r\n" if proxy_user - credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') - credential.delete!("\r\n") + credential = ["#{proxy_user}:#{proxy_pass}"].pack('m0') buf << "Proxy-Authorization: Basic #{credential}\r\n" end buf << "\r\n" diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 5d99e8f070..3a76dcfe4c 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -427,7 +427,7 @@ module Net::HTTPHeader end def basic_encode(account, password) - 'Basic ' + ["#{account}:#{password}"].pack('m').delete("\r\n") + 'Basic ' + ["#{account}:#{password}"].pack('m0') end private :basic_encode diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 439ca13206..9895ed68ce 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -419,7 +419,7 @@ module Net send_command("AUTHENTICATE", auth_type) do |resp| if resp.instance_of?(ContinuationRequest) data = authenticator.process(resp.data.text.unpack("m")[0]) - s = [data].pack("m").gsub(/\n/, "") + s = [data].pack("m0") send_string_data(s) put_string(CRLF) end @@ -1007,8 +1007,8 @@ module Net if $1 "&-" else - base64 = [$&.encode(Encoding::UTF_16BE)].pack("m") - "&" + base64.delete("=\n").tr("/", ",") + "-" + base64 = [$&.encode(Encoding::UTF_16BE)].pack("m0") + "&" + base64.delete("=").tr("/", ",") + "-" end }.force_encoding("ASCII-8BIT") end diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index d634274c3e..250293bdbe 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -788,7 +788,7 @@ module Net def base64_encode(str) # expects "str" may not become too long - [str].pack('m').gsub(/\s+/, '') + [str].pack('m0') end IMASK = 0x36 |