sbsm 1.5.3 → 1.5.4

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: fc9f5d89b19d63cc1e535df21aeb118e6b701b94
4
- data.tar.gz: f938b3e39401c6edce02fac8fbbc50aa92fcf91c
3
+ metadata.gz: 4d571577c95ff6d71831c663d7472e277db43caa
4
+ data.tar.gz: a48912ed3413eb301e44a4c77fdc25d93cccadff
5
5
  SHA512:
6
- metadata.gz: d3053e25db4359a6e37239361a402dc39b137742adc082002c0834633be846e064b0e6724f1e9e549cac0c23fb298bbb7e3aa473d658263cf8a9976d8434993b
7
- data.tar.gz: 79952026cd9423c00d419e9bd6731fd6550f99c97dd288345e1c357f224577aaa2a85cea9370ae08fcfb850a10c07f137b1577ce1847b86d6a3d5a33a2a9b1a6
6
+ metadata.gz: 10b3360d408d609c1400d0ffd038960b0507489e8bd5b66ec76275e4eaad82b1643fbd4f0e97c8008169a528699205d2125c5ca8a9dd3bb29191e69fc0f2c7ba
7
+ data.tar.gz: 628c2b1c6e2f25afe69fe6d839c434febf1a6f3ecee33690b6b3386e7881c484b1d16529d4385927a70afbc126d85a42ace5365c0484e2e680f4807a674038f2
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.5.3 / 11.07.2017
2
+
3
+ * Avoid nil error when rack_request is nil
4
+
1
5
  === 1.5.3 / 05.07.2017
2
6
 
3
7
  * Add process_late for ODDB.org limit_request
data/lib/sbsm/session.rb CHANGED
@@ -210,8 +210,8 @@ module SBSM
210
210
  begin
211
211
  @passthru = false
212
212
  @disposition = false
213
- @request_path ||= rack_request.path
214
213
  @rack_request = rack_request
214
+ @request_path ||= rack_request.path
215
215
  @post_content = nil
216
216
 
217
217
  if rack_request.request_method.eql?('POST')
@@ -395,7 +395,7 @@ module SBSM
395
395
  end
396
396
  def is_crawler?
397
397
  crawler_pattern = /archiver|slurp|bot|crawler|jeeves|spider|\.{6}/i
398
- !!crawler_pattern.match(@rack_request.user_agent)
398
+ !!(@rack_request && crawler_pattern.match(@rack_request.user_agent))
399
399
  end
400
400
  def language
401
401
  cookie_set_or_get(:language) || default_language
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.5.3'
2
+ VERSION = '1.5.4'
3
3
  end
data/test/test_session.rb CHANGED
@@ -421,4 +421,10 @@ class TestSession < Minitest::Test
421
421
  @session.process_rack(rack_request: @request)
422
422
  assert_equal(true, @session.is_crawler?)
423
423
  end
424
+ def test_is_crawler_nil_rack_request
425
+ @request.user_agent = 'google crawler'
426
+ @session.process_rack(rack_request: @request)
427
+ @session.rack_request = nil
428
+ assert_equal(false, @session.is_crawler?)
429
+ end
424
430
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz