This file is indexed.

/usr/lib/ruby/vendor_ruby/ms_rest/retry_policy_middleware.rb is in ruby-ms-rest 0.6.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

module MsRest
  #
  # Class which handles retry policy.
  #
  class RetryPolicyMiddleware < Faraday::Response::Middleware
    #
    # Initializes a new instance of the RetryPolicyMiddleware class.
    #
    def initialize(app, options = {})
      @times = options[:times] || 5
      @delay = options[:delay] || 0.01

      super(app)
    end

    #
    # Performs request and response processing.
    #
    def call(request_env)
      request_body = request_env[:body]

      begin
        request_env[:body] = request_body

        @app.call(request_env).on_complete do |response_env|
          status_code = response_env.status

          if @times > 0 && (status_code == 408 || (status_code >= 500 && status_code != 501 && status_code != 505))
            sleep @delay
            fail 'faraday_retry'
          end
        end
      rescue Exception => e
        raise e if e.message != 'faraday_retry'
        @times = @times - 1
        retry
      end
    end
  end
end