scrubber-scrubyt 0.4.14 → 0.4.15
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.
- data/lib/scrubyt/core/navigation/agents/mechanize.rb +16 -13
- metadata +1 -1
|
@@ -125,24 +125,27 @@ module Scrubyt
|
|
|
125
125
|
|
|
126
126
|
def self.parse_and_set_proxy(proxy)
|
|
127
127
|
@@proxy_user = @@proxy_pass = nil
|
|
128
|
-
if proxy.downcase
|
|
128
|
+
if proxy.downcase.include?('localhost')
|
|
129
129
|
@@host = 'localhost'
|
|
130
130
|
@@port = proxy.split(':').last
|
|
131
131
|
else
|
|
132
132
|
parts = proxy.split(':')
|
|
133
133
|
if (parts.size > 2)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
@@proxy_user = user_pass
|
|
140
|
-
end
|
|
141
|
-
@@host = parts[1]
|
|
142
|
-
@@port = parts[2]
|
|
134
|
+
user_pass = parts[0].split('@')
|
|
135
|
+
@@proxy_user = user_pass[0]
|
|
136
|
+
@@proxy_pass = user_pass[1]
|
|
137
|
+
@@host = parts[1]
|
|
138
|
+
@@port = parts[2]
|
|
143
139
|
else
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
if (parts[0].include?('@'))
|
|
141
|
+
user_host = parts[0].split('@')
|
|
142
|
+
@@proxy_user = user_host[0]
|
|
143
|
+
@@host = user_host[1]
|
|
144
|
+
@@port = parts[1]
|
|
145
|
+
else
|
|
146
|
+
@@host = parts[0]
|
|
147
|
+
@@port = parts[1]
|
|
148
|
+
end
|
|
146
149
|
end
|
|
147
150
|
|
|
148
151
|
if (@@host == nil || @@port == nil)# !@@host =~ /^http/)
|
|
@@ -151,7 +154,7 @@ module Scrubyt
|
|
|
151
154
|
exit
|
|
152
155
|
end
|
|
153
156
|
end
|
|
154
|
-
Scrubyt.log :ACTION, "[ACTION] Setting proxy: host=<#{@@host}>, port=<#{@@port}>, username=<#{@@proxy_user}
|
|
157
|
+
Scrubyt.log :ACTION, "[ACTION] Setting proxy: host=<#{@@host}>, port=<#{@@port}>, username=<#{@@proxy_user}>, password=<#{@@proxy_pass}>"
|
|
155
158
|
@@agent.set_proxy(@@host, @@port, @@proxy_user, @@proxy_pass)
|
|
156
159
|
end
|
|
157
160
|
|