diff --git a/README.md b/README.md index 8248907..972b4c6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This assertion implements a cache to improve the performance of the tests and to Add this line to your application's Gemfile: ```ruby -gem 'feed_validator' +gem 'feedvalidator' ``` And then execute: @@ -24,7 +24,7 @@ And then execute: Or install it yourself as: - $ gem install feed_validator + $ gem install feedvalidator ## Examples @@ -64,7 +64,7 @@ Or install it yourself as: Documentation can be found at -* http://feedvalidator.rubyforge.org +* https://www.rubydoc.info/gems/feedvalidator/ ## License diff --git a/lib/feed_validator.rb b/lib/feed_validator.rb index 22b2942..602420c 100644 --- a/lib/feed_validator.rb +++ b/lib/feed_validator.rb @@ -89,9 +89,9 @@ def validate_data(rawdata) begin # headers = VERSION == "1.8.4" ? {'Content-Type'=>'application/x-www-form-urlencoded'} : {} headers = {'Content-Type'=>'application/x-www-form-urlencoded'} - @response = Net::HTTP.start('validator.w3.org',80) {|http| - http.post('/feed/check.cgi',params,headers) - } + @response = Net::HTTP.start('validator.w3.org', 443, use_ssl: true) do |https| + https.post('/feed/check.cgi', params, headers) + end rescue Exception => e warn "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}" if $VERBOSE return false @@ -109,7 +109,7 @@ def validate_url(url) params = "url=#{CGI.escape(url)}&output=soap12" @request_type = :url begin - @response = Net::HTTP.get_response('validator.w3.org',"/feed/check.cgi?#{params}",80) + @response = Net::HTTP.get_response(URI("https://validator.w3.org/feed/check.cgi?#{params}")) rescue Exception => e warn "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}" if $VERBOSE return false @@ -121,7 +121,7 @@ def validate_url(url) alias :valid? :valid def to_s - msg = "Vailidity: #{@valid}\n" + msg = "Validity: #{@valid}\n" msg << "Errors count: #{@errors.size}\n" @errors.each_with_index{ |item, i| msg << "(#{i+1}) type: #{item[:type]} | line: #{item[:line]} | column: #{item[:column]} | text: #{item[:text]},\n"} msg << "Warnings count: #{@warnings.size}\n"