Sha256: d0855dbf4ad7698b259cfba8fa3831e9c0ad9f756de228b9169d349e024b527e

Contents?: true

Size: 1.3 KB

Versions: 14

Compression:

Stored size: 1.3 KB

Contents

# -*- ruby -*-
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

# 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 NewRelic
  module Agent
    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

14 entries across 14 versions & 1 rubygems

Version Path
newrelic_rpm-3.11.2.286 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.11.1.284 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.11.0.283 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.10.0.279 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.9.275 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.8.273 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.7.266 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.6.257 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.5.251 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.4.245 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.3.241 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.2.239 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.1.236 lib/new_relic/agent/http_clients/uri_util.rb
newrelic_rpm-3.9.0.229 lib/new_relic/agent/http_clients/uri_util.rb