From 8d05a030b0e3bc75dc2ecb6c634a8fddb2581d02 Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:05:29 +0200 Subject: [PATCH 1/6] Now using the W3C's service HTTPS URL Instead of the HTTP URI, which is permantly redirected to HTTPS, and which made validate_url fail. --- lib/feed_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/feed_validator.rb b/lib/feed_validator.rb index 22b2942..a72f979 100644 --- a/lib/feed_validator.rb +++ b/lib/feed_validator.rb @@ -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 From a752af0c0300f2ed2434d8f864b09be2497a92e8 Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:19:11 +0200 Subject: [PATCH 2/6] Now using the HTTPS URL for .validate_data, too. --- lib/feed_validator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/feed_validator.rb b/lib/feed_validator.rb index a72f979..98a0089 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 From ba342680e6d9b5b27ce0f3357a467908ae06baba Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:20:31 +0200 Subject: [PATCH 3/6] Fixing a typo --- lib/feed_validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/feed_validator.rb b/lib/feed_validator.rb index 98a0089..602420c 100644 --- a/lib/feed_validator.rb +++ b/lib/feed_validator.rb @@ -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" From 45f71ece847551c3ef7b13a2edd32540c6d365a8 Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:22:10 +0200 Subject: [PATCH 4/6] Fixing Gem name in installation instructions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8248907..0bbb42a 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 From a30d32dfb76604132feaaa7d51ce8980470dae15 Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:23:56 +0200 Subject: [PATCH 5/6] Updating link to API documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bbb42a..5ecfa21 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Or install it yourself as: Documentation can be found at -* http://feedvalidator.rubyforge.org +* https://www.rubydoc.info/gems/feedvalidator/0.2.2 ## License From f639e01b1b296585aa373bd75a3ab6b9ab3090f8 Mon Sep 17 00:00:00 2001 From: Daniel Pietzsch Date: Mon, 1 Apr 2024 07:31:28 +0200 Subject: [PATCH 6/6] Using the more generic docs URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ecfa21..972b4c6 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Or install it yourself as: Documentation can be found at -* https://www.rubydoc.info/gems/feedvalidator/0.2.2 +* https://www.rubydoc.info/gems/feedvalidator/ ## License