Cask::Audit: Align user agents with livecheck
The `#page_headers` and `#page_content` methods in `Livecheck::Strategy` will fetch a URL using our default user agent but if the request fails it will retry with the `:browser` user agent. [For context, it was added as an interim measure to make URLs work that require a different user agent but I aim to remove it in the future in favor of specifying the user agent in a `livecheck` block (so we don't make unnecessary requests that we know will fail).] `Cask::Audit#audit_livecheck_https_availability` checks the `livecheck` block URL but it only does so using our default user agent (i.e., it calls `#validate_url_for_https_availability` which calls `Utils::Curl#curl_check_http_content` which has a `user_agents: [:default]` parameter). Due to this behavioral mismatch, it's possible for a `livecheck` block to work but for this cask audit to fail. This addresses the issue by adding `user_agents: [:default, :browser]` to the arguments the audit uses, which aligns its behavior with livecheck's.
This commit is contained in:
		
							parent
							
								
									214359316f
								
							
						
					
					
						commit
						fcc87c901d
					
				@ -839,7 +839,8 @@ module Cask
 | 
			
		||||
 | 
			
		||||
      validate_url_for_https_availability(
 | 
			
		||||
        url, "livecheck URL",
 | 
			
		||||
        check_content: true
 | 
			
		||||
        check_content: true,
 | 
			
		||||
        user_agents:   [:default, :browser]
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user