Sha256: ab8655cb6aac74b4583c06267e5d1d157c696370e347ee207de8c4a0471b8339

Contents?: true

Size: 1.14 KB

Versions: 39

Compression:

Stored size: 1.14 KB

Contents

# encoding: utf-8

# This module includes utilities for manipulating URIs, particularly from the
# context of Net::HTTP requests. We don't always have direct access to the full
# URI from our instrumentation points in Net::HTTP, and we want to filter out
# some URI parts before saving URIs from instrumented calls - logic for that
# lives here.

module OneApm
  module Support
    module HTTPClients
      module URIUtil

        def self.filter_uri(original)
          filtered = original.dup
          filtered.user = nil
          filtered.password = nil
          filtered.query = nil
          filtered.fragment = nil
          filtered.to_s
        end

        # There are valid URI strings that some HTTP client libraries will
        # accept that the stdlib URI module doesn't handle. If we find that
        # Addressable is around, use that to normalize out our URL's.
        def self.parse_url(url)
          if defined?(::Addressable::URI)
            address = ::Addressable::URI.parse(url)
            address.normalize!
            URI.parse(address.to_s)
          else
            URI.parse(url)
          end
        end

      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.3.7 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.6 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.5 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.4 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.3 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.2 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.0 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.2.9 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.2.9.rc1 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.2.8 lib/one_apm/support/http_clients/uri_util.rb
oneapm_rpm-1.2.8.rc1 lib/one_apm/support/http_clients/uri_util.rb