phrender 0.0.3 → 0.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: 2c071fb71537894c6506cda8fdf3107307aff153
4
- data.tar.gz: 1db4ff01dbba039dd67fce848435dfbfc82c8f9e
3
+ metadata.gz: b96308369f23f0406077cd841d61a9684bcf6234
4
+ data.tar.gz: 74d56dfdabc690a2264bf0908325540479714267
5
5
  SHA512:
6
- metadata.gz: 6706612f43d4d98a2eca5f8d5479aef880a933cd90a03b2309ad251c52896afbf3e4e1e4aef6730a9edea83fe8e312ab817a74bb4aadefdbe9f679d0710802e4
7
- data.tar.gz: 7d7d8093472e1b8d49a6be861a900458072129fae8789672f2f13056ccb334ef35ec178ce5a23f1a7a17339412c28d5994934548a576df4b5ed0cd5240fe5933
6
+ metadata.gz: 60db2ffcb552290277c03a2b925ca00665a42d59f7d4612eb5c8285b899715a8bd0e603bdfe3f417cfa33ca585ddfa13e42bca39b254bbd3d0362491a6991145
7
+ data.tar.gz: 80c930f11873323c67443f697810b3aeb37e7991f0b5cafa79ab45786f69cbe26b91b359d631fb8df6f0362ea792a8426e6d70eefe4fde979bef830fd372609d
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.0.4
2
+ - Don't blow up if there is no user-agent string when using rack middleware.
3
+ - Pass a 'phrender_request' header to upstream middleware.
@@ -14,16 +14,18 @@ class Phrender::RackMiddleware
14
14
  def call(env)
15
15
  @req = Rack::Request.new(env)
16
16
 
17
+ @req.update_param :phrender_request, 'true'
18
+
17
19
  # Check if the next middleware can handle the request
18
20
  status, headers, body = @app.call(@req.env)
19
21
 
20
22
  # If it can't, or if it's just the index file delivered via aliasing for
21
23
  # pushstate, do phrender stuff.
22
- if (status == 404 || headers['Push-State-Redirect'])
24
+ if status == 404 || headers['Push-State-Redirect']
23
25
  # If it's phantom making the request, then the phrender index file has
24
26
  # a request that the upstream server can't resolve, so catch it, instead
25
27
  # of recursively invoking the index
26
- if (@req.user_agent.match(/PhantomJS/))
28
+ if @req.user_agent && @req.user_agent.match(/PhantomJS/)
27
29
  [ 500, { 'Content-Type' => 'text/html' }, [
28
30
  'Server Error: HTML file contains recursive lookup' ] ]
29
31
  else
@@ -1,3 +1,3 @@
1
1
  class Phrender
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - M Smart, theScore Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -144,6 +144,7 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
+ - CHANGELOG.md
147
148
  - Gemfile
148
149
  - LICENSE
149
150
  - README.md