Skip to content

Commit

Permalink
Fixes #17239 - Increase scap content validation timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomizadok committed Dec 13, 2016
1 parent 208bf3d commit bf1be27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/lib/proxy_api/openscap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def initialize(args)
@url = args[:url] + '/compliance/'
super args
@connect_params[:headers].merge!(:content_type => :xml)
@connect_params[:timeout] = timeout
end

def fetch_policies_for_scap_content(scap_file)
Expand All @@ -12,6 +13,8 @@ def fetch_policies_for_scap_content(scap_file)

def validate_scap_content(scap_file)
parse(post(scap_file, "scap_content/validator"))
rescue RestClient::RequestTimeout => e
raise ::ProxyAPI::ProxyException.new(url, e, N_("Request timed out. Please try increasing Settings -> proxy_request_timeout"))
end

def policy_html_guide(scap_file, policy)
Expand Down Expand Up @@ -46,5 +49,11 @@ def destroy_report(report, cname)
false
end
end

private

def timeout
Setting[:proxy_request_timeout] && Setting[:proxy_request_timeout] > 120 ? Setting[:proxy_request_timeout] : 120
end
end
end

0 comments on commit bf1be27

Please sign in to comment.