Sha256: 1e23155856973b55c1ea75ac61de2804eb37a73f8031eff3853f504c3800712e

Contents?: true

Size: 720 Bytes

Versions: 86

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

require 'cgi'

module Seahorse
  # @api private
  module Util
    class << self
      def uri_escape(string)
        CGI.escape(string.to_s.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')
      end

      def uri_path_escape(path)
        path.gsub(/[^\/]+/) { |part| uri_escape(part) }
      end

      def escape_header_list_string(s)
        s.include?('"') || s.include?(',') ? "\"#{s.gsub('"', '\"')}\"" : s
      end

      # Checks for a valid host label
      # @see https://tools.ietf.org/html/rfc3986#section-3.2.2
      # @see https://tools.ietf.org/html/rfc1123#page-13
      def host_label?(str)
        str =~ /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)$/
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
aws-sdk-core-3.214.0 lib/seahorse/util.rb
aws-sdk-core-3.213.0 lib/seahorse/util.rb
aws-sdk-core-3.212.0 lib/seahorse/util.rb
aws-sdk-core-3.211.0 lib/seahorse/util.rb
aws-sdk-core-3.210.0 lib/seahorse/util.rb
aws-sdk-core-3.209.1 lib/seahorse/util.rb
aws-sdk-core-3.209.0 lib/seahorse/util.rb
aws-sdk-core-3.208.0 lib/seahorse/util.rb
aws-sdk-core-3.207.0 lib/seahorse/util.rb
aws-sdk-core-3.206.0 lib/seahorse/util.rb
aws-sdk-core-3.205.0 lib/seahorse/util.rb
aws-sdk-core-3.204.0 lib/seahorse/util.rb
aws-sdk-core-3.203.0 lib/seahorse/util.rb
aws-sdk-core-3.202.2 lib/seahorse/util.rb
aws-sdk-core-3.202.1 lib/seahorse/util.rb
aws-sdk-core-3.202.0 lib/seahorse/util.rb
aws-sdk-core-3.201.5 lib/seahorse/util.rb
aws-sdk-core-3.201.4 lib/seahorse/util.rb
aws-sdk-core-3.201.3 lib/seahorse/util.rb
aws-sdk-core-3.201.2 lib/seahorse/util.rb