<commit_before># Rely on autoloading instead of explicit require; helps avoid the "already
# initialized constant" warning on Ruby 1.8.7 when NetHttp is refereced below.
# require 'faraday/adapter/net_http'

module Faraday
  class Adapter
    # Experimental adapter for net-http-persistent
    class NetHttpPersistent < NetHttp
      dependency 'net/http/persistent'

      def net_http_connection(env)
        Net::HTTP::Persistent.new 'Faraday',
          env[:request][:proxy] ? env[:request][:proxy][:uri] : nil<commit_msg>fix HTTP proxy authentication for net-http-persistent<commit_after># Rely on autoloading instead of explicit require; helps avoid the "already
# initialized constant" warning on Ruby 1.8.7 when NetHttp is refereced below.
# require 'faraday/adapter/net_http'

module Faraday
  class Adapter
    # Experimental adapter for net-http-persistent
    class NetHttpPersistent < NetHttp
      dependency 'net/http/persistent'

      def net_http_connection(env)
        if proxy = env[:request][:proxy]
          proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s)
          proxy_uri.user = proxy_uri.password = <PASSWORD>
          # awful patch for net-http-persistent 2.8 not unescaping user/password
          (class << proxy_uri; self; end).class_eval do
            define_method(:user) { proxy[:user] }
            define_method(:password) { proxy[:password] }
          end if proxy[:user]
        end
        Net::HTTP::Persistent.new 'Faraday', proxy_uri
{'fraction_non_alphanumeric': 0.103086014445174, 'fraction_numerical': 0.005252790544977019, 'mean_word_length': 3.443148688046647, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, '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': '2355317', 'n_tokens_mistral': 455, 'n_tokens_neox': 436, 'n_words': 124}