Sha256: 2d2ecbf610f8236b508d4928d7c996d0effa06229e48639a83af705461e0af1a

Contents?: true

Size: 1.15 KB

Versions: 192

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8
require "logstash/environment"

if LogStash::Environment.windows? && LogStash::Environment.jruby?
  require "socket"
  module JRubyBug2558SocketPeerAddrBugFix
    def peeraddr(*args)
      orig_peeraddr(*args).map do |v|
        case v
        when String
          v.force_encoding(Encoding::UTF_8)
        else
          v
        end
      end
    end
  end

  class << Socket
    # Bugfix for jruby #2558
    alias_method :orig_gethostname, :gethostname
    def gethostname
      return orig_gethostname.force_encoding(Encoding::UTF_8)
    end
  end

  class TCPSocket
    alias_method :orig_peeraddr, :peeraddr
    include JRubyBug2558SocketPeerAddrBugFix
  end
  class UDPSocket
    alias_method :orig_peeraddr, :peeraddr
    include JRubyBug2558SocketPeerAddrBugFix
  end
end

if LogStash::Environment.windows?
  # make sure all strings pulled out of ENV are UTF8
  class <<ENV
    alias_method :orig_getter, :[]
    def [](key)
      case value = orig_getter(key)
      when String
        # dup is necessary since force_encoding is destructive
        value.dup.force_encoding(Encoding::UTF_8)
      else
        value
      end
    end
  end
end

Version data entries

192 entries across 183 versions & 17 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/lib/logstash/patches/bugfix_jruby_2558.rb