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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/phrender/rack_middleware.rb +4 -2
- data/lib/phrender/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b96308369f23f0406077cd841d61a9684bcf6234
|
4
|
+
data.tar.gz: 74d56dfdabc690a2264bf0908325540479714267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60db2ffcb552290277c03a2b925ca00665a42d59f7d4612eb5c8285b899715a8bd0e603bdfe3f417cfa33ca585ddfa13e42bca39b254bbd3d0362491a6991145
|
7
|
+
data.tar.gz: 80c930f11873323c67443f697810b3aeb37e7991f0b5cafa79ab45786f69cbe26b91b359d631fb8df6f0362ea792a8426e6d70eefe4fde979bef830fd372609d
|
data/CHANGELOG.md
ADDED
@@ -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
|
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
|
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
|
data/lib/phrender/version.rb
CHANGED
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.
|
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
|
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
|