yawast 0.5.0.beta7 → 0.5.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f046f0314626571128c97bbcf2ff87947f88e66
4
- data.tar.gz: 8a01a5d54536515a6ab541b54bb9abdeb29f864f
3
+ metadata.gz: 76e1b89755a35676aaf8b0c09b610374cc65ffb0
4
+ data.tar.gz: d724a23dfeadf0c7caa6cd6d743d0f4b7bb8e7fe
5
5
  SHA512:
6
- metadata.gz: 865bb32735ba681b546395eaf8c7edf9bd6671d5681a9f8c93a3cf68b36e71fac4b70b2ee1807197dfbd9c96a23160c117589a28a45bbf58dd91c0fc9e457018
7
- data.tar.gz: aea15cd82a94b9310170b9640278b3e4b34582f6f550685c900bd9eaf544fa6eb93a592c617d5141a644fc361be5ade12035d3f883a5086e14d155751f2cc939
6
+ metadata.gz: 632588ee25be17d27c1c280db6ce036bb6947edba73d6b656934942977501363de41da0b2e6f7b483285a828f239ad81dd84ff98c63f043d35ebfe9f20be0b62
7
+ data.tar.gz: 9e90bb7d3cd0cdb5929a1ed7bd42e18d60a47a84808ee35dcc546b6560f78e2d657dffccc62ddbaccc3a3babf6c43406a7a6a03d030b7764853f31bc8ccf5225
@@ -21,6 +21,9 @@ module Yawast
21
21
  req.keep_alive_timeout = 600
22
22
  headers = Yawast::Shared::Http.get_headers
23
23
 
24
+ #we will use HEAD by default, but allow GET if we have issues with HEAD
25
+ use_head = true
26
+
24
27
  #force 3DES - this is to ensure that 3DES specific limits are caught
25
28
  req.ciphers = ['3DES']
26
29
 
@@ -32,7 +35,23 @@ module Yawast
32
35
 
33
36
  begin
34
37
  req.start do |http|
35
- head = http.head(uri.path, headers)
38
+
39
+ head = nil
40
+ begin
41
+ if use_head
42
+ head = http.head(uri.path, headers)
43
+ else
44
+ head = http.request_get(uri.path, headers)
45
+ end
46
+ rescue
47
+ #check if we are using HEAD or GET. If we've already switched to GET, no need to do this again.
48
+ if use_head
49
+ head = http.request_get(uri.path, headers)
50
+
51
+ #if we are here, that means that HEAD failed, but GET didn't, so we'll use GET from now on.
52
+ use_head = false
53
+ end
54
+ end
36
55
 
37
56
  #check to see if this is on Cloudflare - they break Keep-Alive limits, creating a false positive
38
57
  head.each do |k, v|
@@ -57,7 +76,11 @@ module Yawast
57
76
  #cache the number of hits
58
77
  hits = http.instance_variable_get(:@ssl_context).session_cache_stats[:cache_hits]
59
78
  10000.times do |i|
60
- http.head(uri.path, headers)
79
+ if use_head
80
+ http.head(uri.path, headers)
81
+ else
82
+ http.request_get(uri.path, headers)
83
+ end
61
84
 
62
85
  # hack to detect transparent disconnects
63
86
  if http.instance_variable_get(:@ssl_context).session_cache_stats[:cache_hits] != hits
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yawast
2
- VERSION = '0.5.0.beta7'
2
+ VERSION = '0.5.0.beta8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yawast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.beta7
4
+ version: 0.5.0.beta8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Caudill