fix course link validator

use HEAD instead of GET and accept only gzip compression

test plan:
- create a page and use these links:
  - http://www.osa.org/en-us/home/
  - http://www.aaes.org/
- start Course Link Validator
- the links above should not be listed under broken links

fixes CNVS-27460

Change-Id: I8b75b48249b1c8b0e87ee8fa417373357b69462d
Reviewed-on: https://gerrit.instructure.com/74461
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
Felix Milea-Ciobanu 2016-03-14 15:51:26 -06:00 committed by James Williams
parent aa0c0c91c4
commit c22f77ae9a
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,10 @@ module CanvasHttp
CanvasHttp.request(Net::HTTP::Delete, *args, &block)
end
def self.head(*args, &block)
CanvasHttp.request(Net::HTTP::Head, *args, &block)
end
def self.get(*args, &block)
CanvasHttp.request(Net::HTTP::Get, *args, &block)
end

View File

@ -273,7 +273,7 @@ class CourseLinkValidator
# ping the url and make sure we get a 200
def reachable_url?(url)
begin
response = CanvasHttp.get(url, {}, 9)
response = CanvasHttp.head(url, { "Accept-Encoding" => "gzip" }, 9)
case response.code
when /^2/ # 2xx code