<commit_before>class Service::Redmine < Service
  string :address, :project, :api_key
  boolean :fetch_commits
  boolean :update_redmine_issues_about_commits
  white_list :address, :project

  def receive_push

    if fetch_github_commits_enabled?
      http.ssl[:verify] = false
      http.url_prefix = data['address']
      http_get "sys/fetch_changesets" do |req|
        req.params['key'] = data['api_key']
        req.params['id']  = data['project']
      end
    end

    if update_issues_enabled?
      begin
        # check configurations first
        check_configuration_options(data)

        payload['commits'].each do |commit|
          message = commit['message'].clone

          #Extract issue IDs and send update to the related issues
          while !(id= message[/#(\d)+/]).nil? do 
            message.gsub!(id,'')
            issue_no = id.gsub('#','')

            # Send the commit information to the related issue on redmine
            res = http_method :put, "#{data['address']}/issues/#{issue_no}.json" do |req|
              req.headers['Content-Type'] = 'application/json'
              req.headers['X-Redmine-API-Key'] = data['api_key']
              req.params['issue[notes]'] = commit_text(commit)
            end
          end<commit_msg>fixing update for unverified HTTPS redmine instances<commit_after>class Service::Redmine < Service
  string :address, :project, :api_key
  boolean :fetch_commits
  boolean :update_redmine_issues_about_commits
  white_list :address, :project

  def receive_push

    if fetch_github_commits_enabled?
      http.ssl[:verify] = false
      http.url_prefix = data['address']
      http_get "sys/fetch_changesets" do |req|
        req.params['key'] = data['api_key']
        req.params['id']  = data['project']
      end
    end

    if update_issues_enabled?
      begin
        # check configurations first
        check_configuration_options(data)

        payload['commits'].each do |commit|
          message = commit['message'].clone

          #Extract issue IDs and send update to the related issues
          while !(id= message[/#(\d)+/]).nil? do 
            message.gsub!(id,'')
            issue_no = id.gsub('#','')

            # Send the commit information to the related issue on redmine
            http.ssl[:verify] = false
            http.url_prefix = data['address']
            
            http_method :put, "/issues/#{issue_no}.json" do |req|
              req.headers['Content-Type'] = 'application/json'
              req.headers['X-Redmine-API-Key'] = data['api_key']
              req.params['issue[notes]'] = commit_text(commit)
            end
          end
{'fraction_non_alphanumeric': 0.11944235116804823, 'fraction_numerical': 0.0, 'mean_word_length': 2.4213917525773194, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6054962', 'n_tokens_mistral': 766, 'n_tokens_neox': 753, 'n_words': 178}