100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/httpx/plugins/ssrf_filter.rb', line 100
def send_requests(*requests)
responses = requests.map do |request|
next if @options.allowed_schemes.include?(request.uri.scheme)
error = ServerSideRequestForgeryError.new("#{request.uri} URI scheme not allowed")
error.set_backtrace(caller)
response = ErrorResponse.new(request, error)
request.emit(:response, response)
response
end
allowed_requests = requests.select { |req| responses[requests.index(req)].nil? }
allowed_responses = super(*allowed_requests)
allowed_responses.each_with_index do |res, idx|
req = allowed_requests[idx]
responses[requests.index(req)] = res
end
responses
end
|