Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -24,7 +24,7 @@ And then execute:

Or install it yourself as:

$ gem install feed_validator
$ gem install feedvalidator


## Examples
Expand Down Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions lib/feed_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down