proxy_request 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/proxy_request.rb +9 -3
  2. metadata +2 -2
data/lib/proxy_request.rb CHANGED
@@ -2,11 +2,16 @@
2
2
 
3
3
  require 'httpclient'
4
4
 
5
- def _proxy_request(env,path,args = {})
5
+ def _proxy_request(env,path,args)
6
+
7
+
8
+ args = {
9
+ :csrf => true
10
+ }.merge(args)
6
11
 
7
12
  req = ActionDispatch::Request.new(env)
8
13
 
9
- if not args[:skip_csrf] and env['rack.session']['_csrf_token'] != req.headers["X-CSRF-Token"]
14
+ if args[:csrf] and env['rack.session']['_csrf_token'] != req.headers["X-CSRF-Token"]
10
15
  return [
11
16
  403,
12
17
  {'Content-Type' => 'text/html', 'Content-Length' => '3'},
@@ -35,7 +40,8 @@ def _proxy_request(env,path,args = {})
35
40
  [
36
41
  @response.status,
37
42
  {
38
- 'Content-Type' => @response.header.contenttype
43
+ 'Content-Type' => @response.header.contenttype,
44
+ 'X-Proxy-Runtime' => (elapsed_time/1000.0).to_s
39
45
  },
40
46
  [@response.body.content]
41
47
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-31 00:00:00.000000000 Z
12
+ date: 2012-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient