forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Google Chrome Frame was a plugin for Internet Explorer, but is no longer supported. And it was included with http and not https which triggered a warning on most pods. Also set the minimum version to 9 to support diaspora#6557
- Loading branch information
1 parent
b9972b5
commit 8a489da
Showing
5 changed files
with
95 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# Copyright (c) 2010-2011, Diaspora Inc. This file is | ||
# Copyright (c) 2010-2011, Diaspora Inc. This file is | ||
# licensed under the Affero General Public License version 3 or later. See | ||
# the COPYRIGHT file. | ||
|
||
# This file is used by Rack-based servers to start the application. | ||
|
||
require ::File.expand_path('../config/environment', __FILE__) | ||
require ::File.expand_path('../lib/unicorn_killer', __FILE__) | ||
require ::File.expand_path('../lib/rack/chrome_frame', __FILE__) | ||
require ::File.expand_path("../config/environment", __FILE__) | ||
require ::File.expand_path("../lib/unicorn_killer", __FILE__) | ||
require ::File.expand_path("../lib/rack/internet_explorer_version", __FILE__) | ||
|
||
# Kill unicorn workers really agressively (at 300mb) | ||
# Kill unicorn workers really aggressively (at 300mb) | ||
if defined?(Unicorn) | ||
use UnicornKiller::Oom, 300 * 1024 | ||
end | ||
use Rack::Deflater | ||
use Rack::ChromeFrame, :minimum => 8 | ||
use Rack::InternetExplorerVersion, minimum: 9 | ||
use Rack::Protection::FrameOptions | ||
|
||
run Diaspora::Application |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2010-2011, Diaspora Inc. This file is | ||
# licensed under the Affero General Public License version 3 or later. See | ||
# the COPYRIGHT file. | ||
|
||
module Rack | ||
class InternetExplorerVersion | ||
def initialize(app, options={}) | ||
@app = app | ||
@options = options | ||
end | ||
|
||
def call(env) | ||
if env["HTTP_USER_AGENT"] =~ /MSIE/ && ie_version(env["HTTP_USER_AGENT"]) < @options[:minimum] | ||
html = <<-HTML | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | ||
<title>Diaspora doesn't support your version of Internet Explorer. Try Firefox, Chrome or Opera!</title> | ||
</head> | ||
<body> | ||
<h1>Diaspora doesn't support your version of Internet Explorer.</h1> | ||
You can use one of these browsers (and many more): | ||
<ul> | ||
<li><a href="https://www.mozilla.org/firefox/">Firefox</a></li> | ||
<li><a href="https://www.google.com/chrome/">Chrome</a></li> | ||
<li><a href="https://www.opera.com/">Opera</a></li> | ||
</ul> | ||
</body> | ||
</html> | ||
HTML | ||
return [200, {"Content-Type" => "text/html", "Content-Length" => html.size.to_s}, Rack::Response.new([html])] | ||
end | ||
@app.call(env) | ||
end | ||
|
||
def ie_version(ua_string) | ||
ua_string.match(/MSIE ?(\S+)/)[1].to_f | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) 2010-2011, Diaspora Inc. This file is | ||
# licensed under the Affero General Public License version 3 or later. See | ||
# the COPYRIGHT file. | ||
require "spec_helper" | ||
|
||
describe Rack::InternetExplorerVersion do | ||
before :all do | ||
@app = Rack::Builder.parse_file(Rails.root.join("config.ru").to_s).first | ||
end | ||
|
||
subject { get_response_for_user_agent(@app, ua_string) } | ||
|
||
context "non-IE browser" do | ||
let(:ua_string) { "another browser chromeframe" } | ||
|
||
it "shouldn't complain about the browser and shouldn't have chrome frame" do | ||
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/) | ||
end | ||
end | ||
|
||
context "new IE" do | ||
let(:ua_string) { "MSIE 9" } | ||
|
||
it "shouldn't complain about the browser" do | ||
expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/) | ||
end | ||
end | ||
|
||
context "old IE" do | ||
let(:ua_string) { "MSIE 7" } | ||
|
||
it "should complain about the browser" do | ||
expect(subject.body).to match(/Diaspora doesn't support your version of Internet Explorer/) | ||
end | ||
|
||
it "should have the correct content-length header" do | ||
expect(subject.headers["Content-Length"]).to eq(subject.body.length.to_s) | ||
end | ||
end | ||
|
||
context "Specific case with no space after MSIE" do | ||
let(:ua_string) { "Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.0) .NET CLR 2.0.50727" } | ||
|
||
it "should complain about the browser" do | ||
expect(subject.body).to match(/Diaspora doesn't support your version of Internet Explorer/) | ||
end | ||
end | ||
end |