Method: Pod::HTTP.validate_url

Defined in:
lib/cocoapods-core/http.rb

.validate_url(url, user_agent = nil) ⇒ REST::response

Performs validation of a URL

Returns:

  • (REST::response)


41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cocoapods-core/http.rb', line 41

def self.validate_url(url, user_agent = nil)
  return nil unless url =~ /^#{URI.regexp}$/

  begin
    url = get_actual_url(url, user_agent)
    resp = perform_head_request(url, user_agent)
  rescue SocketError, URI::InvalidURIError, REST::Error, REST::Error::Connection
    resp = nil
  end

  resp
end