This file is indexed.

/usr/lib/ruby/vendor_ruby/typhoeus/request/block_connection.rb is in ruby-typhoeus 0.6.8-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
45
46
47
48
49
50
51
52
module Typhoeus
  class Request

    # This module handles the blocked connection request mode on
    # the request side, where only stubbed requests
    # are allowed.
    # Connection blocking needs to be turned on:
    #   Typhoeus.configure do |config|
    #     config.block_connection = true
    #   end
    #
    # When trying to do real requests a NoStub error
    # is raised.
    #
    # @api private
    module BlockConnection

      # Overrides run in order to check before if block connection
      # is turned on. If thats the case a NoStub error is
      # raised.
      #
      # @example Run request.
      #   request.run
      #
      # @raise [Typhoeus::Errors::NoStub] If connection is blocked
      #   and no stub defined.
      def run
        if blocked?
          raise Typhoeus::Errors::NoStub.new(self)
        else
          super
        end
      end

      # Returns wether a request is blocked or not. Takes
      # request.block_connection and Typhoeus::Config.block_connection
      # into consideration.
      #
      # @example Blocked?
      #   request.blocked?
      #
      # @return [ Boolean ] True if blocked, false else.
      def blocked?
        if block_connection.nil?
          Typhoeus::Config.block_connection
        else
          block_connection
        end
      end
    end
  end
end