bowtie-io 1.0.3 → 1.0.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: 06825f50c585d382ab43e57dc49a26e881775652
4
- data.tar.gz: 0fbf2972cc4a8fdaa6a42b6311a69ab6e43e1fa6
3
+ metadata.gz: 76ff84184ca2e50f02a42c5dc8cfe8f161dc6eee
4
+ data.tar.gz: 288772ac304aea183f0c6c95be6adea13def9040
5
5
  SHA512:
6
- metadata.gz: 9aee6df265518cd2329c95a6c3da313ba6f5d0255bcdab3bbb23d7a46f85cd9cec49028d81b587885c1a030cbda704a02b6f60ba31f07db3d4d2fa1b5186a14c
7
- data.tar.gz: 79a641b7745c6a179db00ca996c098145921cab5137e9f03e278cdb36e2ef4595a9df3286244a611255126b6c7195484297301d0bacfcf0b21eb1e072f62f660
6
+ metadata.gz: abca3ab762ce01164ba01f5eb76fc0c3e032b66ba4e031971a4561f9bf546f86827eddaf9d6e350deaae650c9f48e320c8d770b4afd0b8a8aea9358e92c2d2d4
7
+ data.tar.gz: 1090e2fec10c582df360349e5c679d2dc8d5c7c5aae896f50fd7a249d2448db0612dbf150aa16ea47d5b3dea758a76e845417ae9fa290e66bcf092742f26c384
@@ -1,5 +1,31 @@
1
1
  module Bowtie::Middleware
2
- class Proxy < Rack::StreamingProxy::Proxy
2
+ class Proxy
3
+ def initialize(*args)
4
+ @platform = Platform.new(*args)
5
+ @backend = Backend.new(*args)
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, body = @platform.call(env)
10
+
11
+ if status.to_i == 305
12
+ env[:proxy_addon_headers] = JSON.load(headers['X-Bowtie-Client-Proxy-Headers'])
13
+ env[:proxy_location] = headers['Location']
14
+ @backend.call(env)
15
+ else
16
+ [status, headers, body]
17
+ end
18
+ end
19
+ end
20
+
21
+ private
22
+ class Backend < Rack::StreamingProxy::Proxy
23
+ def destination_uri(rack_request)
24
+ rack_request.env[:proxy_location]
25
+ end
26
+ end
27
+
28
+ class Platform < Rack::StreamingProxy::Proxy
3
29
  def destination_uri(rack_request)
4
30
  fqdn = Bowtie::Settings['project']['fqdn']['development']
5
31
  base_url = "https://#{fqdn}"
@@ -1,3 +1,3 @@
1
1
  module Bowtie
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowtie-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Kassemi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll