Skip to content

Commit

Permalink
Merge pull request #227 from shlomizadok/fix_17239
Browse files Browse the repository at this point in the history
Fixes #17239 - Increase scap content validation timeout
  • Loading branch information
xprazak2 committed Dec 14, 2016
2 parents 208bf3d + bf1be27 commit a726ad0
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 a726ad0

Please sign in to comment.