http_utilities 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ac9dfacd5301579a55e9518c5d4cd6e36c6c0bf
4
- data.tar.gz: aa08e069a0edd6f90fe3d09a51249ad44351c9b4
3
+ metadata.gz: 1a18294693d9cd95171156f4fccdf461a8c45127
4
+ data.tar.gz: 6d32ede9f59c390b64ebcfcc47ec00901fe6e77f
5
5
  SHA512:
6
- metadata.gz: 14a066ac081bd6d7e10fefe321e5639af960477071d5329fc655b9466d7c67948cdd9948721f4b68011b6a96c6b0832bba3c7be7d3952cca096ee15f74f06bcd
7
- data.tar.gz: c2b90fe93035cbe1ee7ca2bbf9f1562f7d9bbd4fa69ca43d259cfc25a356c853c61e18655b14e5548a3f962ad919f5c6b3944a168708d97c202cda8fdf271a8a
6
+ metadata.gz: 51c959c41979b8c1a253c1b5d43e019ac19e692b9fbb7f92b04da37be639099949bd540e2ed2b068f30d9943a2a3f46212401bc416e4a1a44730d1758e553f09
7
+ data.tar.gz: 0fe6a191e9f0e802622d5eb24a2529e0b6c9d1c1cdc1525347570492c1d27aae74baa15e5650566dbc69701397e58d9df47ea4fb8e105002aeea8b69ca98c930
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = "http_utilities"
6
- s.version = "1.1.1"
6
+ s.version = "1.1.2"
7
7
 
8
8
  s.authors = ["Sebastian Johnsson"]
9
9
  s.description = "Wrapper for common Http Libraries (Net:HTTP/Open URI/Curl)"
@@ -11,7 +11,9 @@ module HttpUtilities
11
11
  attr_accessor :limit, :minimum_successful_attempts, :maximum_failed_attempts
12
12
 
13
13
  def initialize
14
- self.client = HttpUtilities::Http::Client.new
14
+ self.client = HttpUtilities::Http::Mechanize::Client.new(verbose: false)
15
+ self.client.agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
16
+
15
17
  self.processed_proxies = []
16
18
 
17
19
  self.limit = 1000
@@ -88,26 +90,25 @@ module HttpUtilities
88
90
  document = nil
89
91
  valid_proxy = false
90
92
 
91
- options = {method: :net_http,
92
- use_proxy: true,
93
- proxy: proxy.proxy_address,
94
- proxy_protocol: proxy.protocol,
95
- timeout: timeout,
96
- maximum_redirects: 1,
97
- disable_auth: true
98
- }
93
+ options = {
94
+ use_proxy: true,
95
+ proxy: proxy.proxy_address,
96
+ proxy_protocol: proxy.protocol,
97
+ timeout: timeout,
98
+ }
99
99
 
100
100
  Rails.logger.info "#{Time.now}: Fetching Google.com with proxy #{proxy.proxy_address}."
101
-
102
- response = self.client.retrieve_parsed_html("http://www.google.com/webhp?hl=en", options)
103
-
104
- if (response && response.parsed_body)
105
- title = response.parsed_body.css("title").first
101
+
102
+ page = self.client.get_page("https://www.google.com/webhp?hl=en&gws_rd=ssl", options)
103
+
104
+ if (page)
105
+ parser = self.client.get_parser(page)
106
+ title = parser.at_css("head title")
106
107
 
107
108
  if (title && title.content)
108
109
  begin
109
110
  title = title.content.encode("UTF-8").strip.downcase
110
- body_content = response.parsed_body.content.to_s.encode("UTF-8").strip.downcase
111
+ body_content = page.body.to_s.encode("UTF-8").strip.downcase
111
112
 
112
113
  valid_proxy = (title.eql?("google") || !(body_content =~ /google home/i).nil?)
113
114
 
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module HttpUtilities
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
 
5
5
  require File.join(File.dirname(__FILE__), 'http_utilities/railtie') if defined?(Rails)
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson