cobweb 1.0.16 → 1.0.17

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjVmMzgyNjRjMGZkYzAyMTZiODRhNDJiOTljYzFjMmRmMjAxMjExZQ==
4
+ ZjMzY2NkZjAzZjUzMmExMTM1NTQzOTU4ZWY0OWI3Yzk4ODFiOGRmZQ==
5
5
  data.tar.gz: !binary |-
6
- OGVjMTJmM2Q5MTQzZDE0YWI5ZTUxMTg2NzM3MjIzNjVmOTQxMjEzYQ==
6
+ YjIwOTE0MzY0NzIwNDRhNTNjN2EzYTg3Njc4MzQyYzIwNzUzYmFmYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzQ2YTI5MDRlZWE2M2FjMTRkNGQ4YjAyOTRjOTIyN2EwNDg2ZjdhNTg5NDRj
10
- ZTYzZDRkNTUzNjhlMzU4MjM4YWJiZGJlNDkyOGQyM2ExOWZiNGVmYmYzM2Ey
11
- NmU0YzAyYmEzMGUwZmRjODM2OWU1MGE2MzNiZWRkODc4YmEzNDk=
9
+ ZmZlODk5ZTZmMDI0MzVkN2M2NDM3MjMzYmM3MjA1MjQ5MDRmMmUwNzU2MzUw
10
+ YTM5MWNlM2Y4MjJhMWEwMDk3ZDQ3MDJkNDBhOTExNWRhNWU4OWE4N2JmYjU3
11
+ YzM2NzYzZWJmNjM3MjQzZThlOGM2NGMzMzAxZDdhZTFjMTQxYTI=
12
12
  data.tar.gz: !binary |-
13
- NGY0MzVlOTA0Mzg0MDIxMDNmOTQ0YmQ5NTVmODE3ZmUxZTg4MzY4NjM5Y2Jm
14
- MDM5YTY0MTc3MzJiOGI5ODMxMDMyMGVlMDY4MzZhYWE5MGYyNGYwNzZiMWIw
15
- Yjc1NTRhZjY0YjJhODdiMDk2OWQ3ZmNlZDA1YTk1Y2ZjMzFhMjE=
13
+ NDBhZTdlZjc1NTljMGE4NTU2M2UyZWM5YzZhNjQ2OTc1ZTQ5NjJmOGRiY2E2
14
+ MTc4ZDAxMmRjNTlkMjMzZGRlZGZiODQzYmZlZWMwYzIxMTlhOWZlZDEyY2Fh
15
+ ZjFmYWY5NTgwYTc1OTY1ODdkOWY3NThhODk1ZWEwMWY1N2M4OTQ=
data/README.textile CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- h1. Cobweb v1.0.16
2
+ h1. Cobweb v1.0.17
3
3
 
4
4
  "@cobweb_gem":https://twitter.com/cobweb_gem
5
5
  !https://badge.fury.io/rb/cobweb.png!:http://badge.fury.io/rb/cobweb
data/lib/cobweb.rb CHANGED
@@ -157,7 +157,7 @@ class Cobweb
157
157
  @http.use_ssl = true
158
158
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
159
159
  end
160
-
160
+
161
161
  request_time = Time.now.to_f
162
162
  @http.read_timeout = @options[:timeout].to_i
163
163
  @http.open_timeout = @options[:timeout].to_i
@@ -168,6 +168,12 @@ class Cobweb
168
168
  request_options['User-Agent']= options[:user_agent] if options.has_key?(:user_agent)
169
169
 
170
170
  request = Net::HTTP::Get.new uri.request_uri, request_options
171
+ # authentication
172
+ if @options[:authentication] == "basic"
173
+ raise ":username and :password are required if using basic authentication" unless @options[:username] && @options[:password]
174
+ request.basic_auth @options[:username], @options[:password]
175
+ end
176
+
171
177
  response = @http.request request
172
178
 
173
179
  if @options[:follow_redirects] and response.code.to_i >= 300 and response.code.to_i < 400
@@ -324,7 +330,7 @@ class Cobweb
324
330
  @http.use_ssl = true
325
331
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
326
332
  end
327
-
333
+
328
334
  request_time = Time.now.to_f
329
335
  @http.read_timeout = @options[:timeout].to_i
330
336
  @http.open_timeout = @options[:timeout].to_i
@@ -335,6 +341,11 @@ class Cobweb
335
341
  request_options[ 'Cookie']= options[:cookies]
336
342
  end
337
343
  request = Net::HTTP::Head.new uri.request_uri, request_options
344
+ # authentication
345
+ if @options[:authentication] == "basic"
346
+ raise ":username and :password are required if using basic authentication" unless @options[:username] && @options[:password]
347
+ request.basic_auth @options[:username], @options[:password]
348
+ end
338
349
 
339
350
  response = @http.request request
340
351
 
@@ -3,7 +3,7 @@ class CobwebVersion
3
3
 
4
4
  # Returns a string of the current version
5
5
  def self.version
6
- "1.0.16"
6
+ "1.0.17"
7
7
  end
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stewart McKee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-22 00:00:00.000000000 Z
11
+ date: 2013-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis