<commit_before>require 'rack/handler'

module Rack
  module Handler
    module Puma
      DEFAULT_OPTIONS = {
        :Verbose => false,
        :Silent  => false
      }

      def self.run(app, options = {})
        require 'puma/configuration'
        require 'puma/events'
        require 'puma/launcher'

        options = DEFAULT_OPTIONS.merge(options)

        conf = ::Puma::Configuration.new(options) do |c|
          c.quiet

          if options.delete(:Verbose)
            app = Rack::CommonLogger.new(app, STDOUT)
          end

          if options[:environment]
            c.environment options[:environment]
          end

          if options[:Threads]
            min, max = options.delete(:Threads).split(':', 2)
            c.threads min, max
          end

          host = options[:Host]

          if host && (host[0,1] == '.' || host[0,1] == '/')
            c.bind "unix://#{host}"
          else<commit_msg>Allow rack handler to accept ssl host (#1129)<commit_after>require 'rack/handler'

module Rack
  module Handler
    module Puma
      DEFAULT_OPTIONS = {
        :Verbose => false,
        :Silent  => false
      }

      def self.run(app, options = {})
        require 'puma/configuration'
        require 'puma/events'
        require 'puma/launcher'

        options = DEFAULT_OPTIONS.merge(options)

        conf = ::Puma::Configuration.new(options) do |c|
          c.quiet

          if options.delete(:Verbose)
            app = Rack::CommonLogger.new(app, STDOUT)
          end

          if options[:environment]
            c.environment options[:environment]
          end

          if options[:Threads]
            min, max = options.delete(:Threads).split(':', 2)
            c.threads min, max
          end

          host = options[:Host]

          if host && (host[0,1] == '.' || host[0,1] == '/')
            c.bind "unix://#{host}"
          elsif host && host =~ /^ssl:\/\//
            uri = URI.parse(host)
            uri.port ||= options[:Port] || ::Puma::Configuration::DefaultTCPPort
            c.bind uri.to_s
          else
{'fraction_non_alphanumeric': 0.1302058401148875, 'fraction_numerical': 0.006701771182383916, 'mean_word_length': 1.7142857142857142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5736822', 'n_tokens_mistral': 635, 'n_tokens_neox': 609, 'n_words': 135}