exceptiontrap 1.0.1 → 1.0.2

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.
@@ -36,7 +36,7 @@ module Exceptiontrap
36
36
  'location' => location(exception),
37
37
  'root' => application_root.to_s,
38
38
  'app_environment' => application_environment,
39
- 'request_uri' => env['REQUEST_URI'],
39
+ 'request_uri' => rack_request_url(env),
40
40
  'request_params' => clean_params(env['action_dispatch.request.parameters']),
41
41
  'request_session' => clean_params(extrap_session_data(env['rack.session'])),
42
42
  'environment' => clean_params(env),
@@ -45,6 +45,26 @@ module Exceptiontrap
45
45
  }
46
46
  end
47
47
 
48
+ def rack_request_url(env)
49
+ protocol = rack_scheme(env)
50
+ host = env['SERVER_NAME'] || ""
51
+ path = env['REQUEST_URI'] || ""
52
+ port = env['SERVER_PORT'] || "80"
53
+ port = ["80", "443"].include?(port.to_s) ? "" : ":#{port}"
54
+
55
+ "#{protocol}://" + host + port + path;
56
+ end
57
+
58
+ def rack_scheme(env)
59
+ if env['HTTPS'] == 'on'
60
+ 'https'
61
+ elsif env['HTTP_X_FORWARDED_PROTO']
62
+ env['HTTP_X_FORWARDED_PROTO'].split(',')[0]
63
+ else
64
+ env["rack.url_scheme"]
65
+ end
66
+ end
67
+
48
68
  # Cleanup data
49
69
  def clean_params(params)
50
70
  return if params == nil
@@ -8,7 +8,7 @@ module Exceptiontrap
8
8
  begin
9
9
  response = @app.call(env)
10
10
  rescue Exception => raised
11
- puts 'DEBUG: Raised Exceptiontrap::Rack::Exception'
11
+ puts '[Exceptiontrap] Raised Exceptiontrap::Rack::Exception'
12
12
  data = Exceptiontrap::Data.rack_data(raised, env)
13
13
  Exceptiontrap::Notifier.notify(data)
14
14
  raise
@@ -1,3 +1,3 @@
1
1
  module Exceptiontrap
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exceptiontrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: