<commit_before>require 'uri'

module Aws
  module Plugins

    # @note This plugin is not async compatible.
    class S3Redirects < Seahorse::Client::Plugin

      option(:follow_redirects, true)

      # @api private
      class Handler < Seahorse::Client::Handler

        def call(context)
          response = @handler.call(context)
          if response.http_response.status_code == 307
            uri = URI.parse(response.http_response.headers['location'])
            endpoint = Seahorse::Client::Http::Endpoint.new(uri)
            context.http_response.body.truncate(0)
            context.http_request.endpoint = endpoint
            @handler.call(context)
          else
            response
          end<commit_msg>Simplified the S3 redirects plugin.<commit_after>module Aws
  module Plugins

    # @note This plugin is not async compatible.
    class S3Redirects < Seahorse::Client::Plugin

      option(:follow_redirects, true)

      # @api private
      class Handler < Seahorse::Client::Handler

        def call(context)
          response = @handler.call(context)
          if response.http_response.status_code == 307
            endpoint = response.http_response.headers['location']
            endpoint = Seahorse::Client::Http::Endpoint.new(endpoint)
            context.http_request.endpoint = endpoint
            context.http_response.body.truncate(0)
            @handler.call(context)
          else
            response
          end
{'fraction_non_alphanumeric': 0.08879781420765027, 'fraction_numerical': 0.007513661202185792, 'mean_word_length': 2.3755760368663594, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1186710', 'n_tokens_mistral': 397, 'n_tokens_neox': 372, 'n_words': 83}