aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/general.yml-example2
-rw-r--r--config/httpd.conf17
-rw-r--r--config/initializers/single_quote_escape_workaround.rb31
-rw-r--r--config/routes.rb2
4 files changed, 48 insertions, 4 deletions
diff --git a/config/general.yml-example b/config/general.yml-example
index 019eb7ada..33e3ad5bf 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -37,7 +37,7 @@ FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
# URLs of themes to download and use (when running rails-post-deploy
# script). Earlier in the list means the templates have a higher
# priority.
-THEME_URLS:
+THEME_URLS:
- 'git://github.com/sebbacon/adminbootstraptheme.git'
- 'git://github.com/sebbacon/alavetelitheme.git'
diff --git a/config/httpd.conf b/config/httpd.conf
index 3bbe50fb3..36f567964 100644
--- a/config/httpd.conf
+++ b/config/httpd.conf
@@ -5,7 +5,7 @@
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org
-#
+#
# $Id: httpd.conf,v 1.31 2009-09-02 13:05:48 matthew Exp $
# This is needed for the PHP spell checker
@@ -25,13 +25,26 @@ RewriteEngine On
# it.
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule . - [E=RU:%1]
-RequestHeader add X-Forwarded-User %{RU}e
+RequestHeader add X-Forwarded-User %{RU}e
# Old /files URL to new subdomain (as can't use Alias with passenger,
# so we do it on its own domain). This is for custom admin upload
# files for archiving.
RewriteRule /files/(.+) http://files.whatdotheyknow.com/$1
+# Serve attachments directly from the cache, if possible.
+#
+# The file names are URL-encoded on disk, and sharded by the first
+# three digits of the request id, which is why this is as complicated
+# as it is. The RewriteMap directive makes the URL-escaping function
+# available to use in the other directives.
+#
+# The condition means that the rule will fire only if the cached
+# file exists.
+RewriteMap escape int:escape
+RewriteCond %{DOCUMENT_ROOT}/views_cache/request/$2/$1/${escape:$3} -f
+RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/\d+/.+) /views_cache/request/$2/$1/${escape:$3} [L]
+
<IfModule mod_passenger.c>
# Set this to something like 100 if you have memory leak issues
PassengerMaxRequests 20
diff --git a/config/initializers/single_quote_escape_workaround.rb b/config/initializers/single_quote_escape_workaround.rb
new file mode 100644
index 000000000..2e713b982
--- /dev/null
+++ b/config/initializers/single_quote_escape_workaround.rb
@@ -0,0 +1,31 @@
+class ERB
+ module Util
+
+ if "html_safe exists".respond_to?(:html_safe)
+ def html_escape(s)
+ s = s.to_s
+ if s.html_safe?
+ s
+ else
+ Rack::Utils.escape_html(s).html_safe
+ end
+ end
+ else
+ def html_escape(s)
+ s = s.to_s
+ Rack::Utils.escape_html(s).html_safe
+ end
+ end
+
+ remove_method :h
+ alias h html_escape
+
+ class << self
+ remove_method :html_escape
+ remove_method :h
+ end
+
+ module_function :html_escape
+ module_function :h
+ end
+end
diff --git a/config/routes.rb b/config/routes.rb
index a9c2c889a..34232b55b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -80,7 +80,7 @@ ActionController::Routing::Routes.draw do |map|
# Use /profile for things to do with the currently signed in user.
# Use /user/XXXX for things that anyone can see about that user.
- # Note that /profile isn't indexe by search (see robots.txt)
+ # Note that /profile isn't indexed by search (see robots.txt)
map.with_options :controller => 'user' do |user|
user.signin '/profile/sign_in', :action => 'signin'
user.signup '/profile/sign_up', :action => 'signup'