<commit_before>module PasswordManagerApi

  class Base


    protected

    def self.get(method)
      fail "The connection is not initialized" if PasswordManager.connection.nil?
      connection = PasswordManager.connection

      http = Net::HTTP.new(connection.host, connection.port)
      http.instance_eval { @ssl_context = OpenSSL::SSL::SSLContext.new(:SSLv3)}
      http.use_ssl = true
      http.ssl_version = 'SSLv3'
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      response = nil
      http.start do |sock|
        response = sock.get("/restapi/json/v1/#{method}/?AUTHTOKEN=#{connection.auth_token}")
      end
      if (Integer(response.code) == 200 )
        JSON.load( response.body )
      else
        fail "Error response - The response code was #{response.code} body: #{response.body}"
      end
    end<commit_msg>BUGFIX: use TLSv1 instead of SSLv3<commit_after>module PasswordManagerApi

  class Base


    protected

    def self.get(method)
      fail "The connection is not initialized" if PasswordManager.connection.nil?
      connection = PasswordManager.connection

      http = Net::HTTP.new(connection.host, connection.port)
      http.use_ssl = true
      http.ssl_version = 'TLSv1'
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      response = nil
      http.start do |sock|
        response = sock.get("/restapi/json/v1/#{method}/?AUTHTOKEN=#{connection.auth_token}")
      end
      if (Integer(response.code) == 200 )
        JSON.load( response.body )
      else
        fail "Error response - The response code was #{response.code} body: #{response.body}"
      end
    end
{'fraction_non_alphanumeric': 0.10844115834873691, 'fraction_numerical': 0.008009858287122612, 'mean_word_length': 2.839243498817967, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '768742', 'n_tokens_mistral': 494, 'n_tokens_neox': 471, 'n_words': 111}