Skip to content

Commit

Permalink
Merge pull request #33 from securenative/dev
Browse files Browse the repository at this point in the history
Fix multi-value headers
  • Loading branch information
alexivsn authored Oct 28, 2020
2 parents a5dcfd0 + 29dafa4 commit caad62f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
securenative (0.1.38)
securenative (0.1.39)

GEM
remote: https://rubygems.org/
Expand Down
12 changes: 6 additions & 6 deletions lib/securenative/utils/request_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request.env['HTTP_X_FORWARDED_FOR']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header_value
Expand All @@ -59,7 +59,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request['HTTP_X_FORWARDED_FOR']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header_value
Expand All @@ -72,7 +72,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request.env['HTTP_X_REAL_IP']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header
Expand All @@ -81,7 +81,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request['HTTP_X_REAL_IP']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header_value
Expand All @@ -94,7 +94,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request.env['REMOTE_ADDR']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header_value
Expand All @@ -103,7 +103,7 @@ def self.get_client_ip_from_request(request, options)
begin
header_value = request['REMOTE_ADDR']
if header_value.include? ','
header_value = ip.split(',')[0]
header_value = header_value.split(',')[0]
end
if self.validate_ip(header_value)
return header_value
Expand Down
2 changes: 1 addition & 1 deletion lib/securenative/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SecureNative
VERSION = '0.1.38'
VERSION = '0.1.39'
end
2 changes: 1 addition & 1 deletion spec/securenative/spec_api_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'YOUR_API_KEY',
'Content-Type' => 'application/json',
'Sn-Version' => '0.1.38',
'Sn-Version' => '0.1.39',
'User-Agent' => 'SecureNative-ruby'
}
).to_return(status: 200, body: '', headers: {})
Expand Down
6 changes: 3 additions & 3 deletions spec/securenative/spec_event_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def initialize
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'YOUR_API_KEY',
'Content-Type' => 'application/json',
'Sn-Version' => '0.1.38',
'Sn-Version' => '0.1.39',
'User-Agent' => 'SecureNative-ruby'
})
.to_return(status: 200, body: '', headers: {})
Expand All @@ -53,7 +53,7 @@ def initialize
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'YOUR_API_KEY',
'Content-Type' => 'application/json',
'Sn-Version' => '0.1.38',
'Sn-Version' => '0.1.39',
'User-Agent' => 'SecureNative-ruby'
})
.to_return(status: 401, body: '', headers: {})
Expand All @@ -74,7 +74,7 @@ def initialize
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'YOUR_API_KEY',
'Content-Type' => 'application/json',
'Sn-Version' => '0.1.38',
'Sn-Version' => '0.1.39',
'User-Agent' => 'SecureNative-ruby'
})
.to_return(status: 500, body: '', headers: {})
Expand Down
2 changes: 1 addition & 1 deletion spec/securenative/spec_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization' => 'YOUR_API_KEY',
'Content-Type' => 'application/json',
'Sn-Version' => '0.1.38',
'Sn-Version' => '0.1.39',
'User-Agent' => 'SecureNative-ruby'
}).to_return(status: 200, body: '', headers: {})

Expand Down

0 comments on commit caad62f

Please sign in to comment.