Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1242 Bytes
1 | require 'rack/utils' |
2 | |
3 | module Rack::Cache |
4 | class Key |
5 | include Rack::Utils |
6 | |
7 | # Implement .call, since it seems like the "Rack-y" thing to do. Plus, it |
8 | # opens the door for cache key generators to just be blocks. |
9 | def self.call(request) |
10 | new(request).generate |
11 | end |
12 | |
13 | def initialize(request) |
14 | @request = request |
15 | end |
16 | |
17 | # Generate a normalized cache key for the request. |
18 | def generate |
19 | parts = [] |
20 | parts << @request.scheme << "://" |
21 | parts << @request.host |
22 | |
23 | if @request.scheme == "https" && @request.port != 443 || |
24 | @request.scheme == "http" && @request.port != 80 |
25 | parts << ":" << @request.port.to_s |
26 | end |
27 | |
28 | parts << @request.script_name |
29 | parts << @request.path_info |
30 | |
31 | if qs = query_string |
32 | parts << "?" |
33 | parts << qs |
34 | end |
35 | |
36 | parts.join |
37 | end |
38 | |
39 | private |
40 | # Build a normalized query string by alphabetizing all keys/values |
41 | # and applying consistent escaping. |
42 | def query_string |
43 | return nil if @request.query_string.nil? |
44 | |
45 | @request.query_string.split(/[&;] */n). |
46 | map { |p| unescape(p).split('=', 2) }. |
47 | sort. |
48 | map { |k,v| "#{escape(k)}=#{escape(v)}" }. |
49 | join('&') |
50 | end |
51 | end |
52 | end |