Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplusorg/files/adblockplus.org

Issue 9160083: Put both requested and actual browser page in the HTML (Closed)
Patch Set: Created Jan. 9, 2013, 12:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 server { 1 server {
2 root /var/www/adblockplus.org/httpdocs; 2 root /var/www/adblockplus.org/httpdocs;
3 3
4 location / { 4 location / {
5 index index.php index index.html; 5 index index.php index index.html;
6 6
7 if ($arg_a = "view") { 7 if ($arg_a = "view") {
8 rewrite ^(.*) $1? permanent; 8 rewrite ^(.*) $1? permanent;
9 } 9 }
10 10
11 set $preferredLang en; 11 set $preferredLang en;
12 if ($http_accept_language ~ ^(\w\w)\b) { 12 if ($http_accept_language ~ ^(\w\w)\b) {
13 set $preferredLang $1; 13 set $preferredLang $1;
14 } 14 }
15 if (!-f $document_root/static/$preferredLang/index) { 15 if (!-f $document_root/static/$preferredLang/index) {
16 set $preferredLang en; 16 set $preferredLang en;
17 } 17 }
18 18
19 set $browser "firefox"; 19 set $user_agent "firefox";
20 if ($http_user_agent ~ \bChrome/\d+) { 20 if ($http_user_agent ~ \bChrome/\d+) {
21 set $browser "chrome"; 21 set $user_agent "chrome";
22 } 22 }
23 if ($http_user_agent ~ \bPresto/\d+) { 23 if ($http_user_agent ~ \bPresto/\d+) {
24 set $browser "opera"; 24 set $user_agent "opera";
25 } 25 }
26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) { 26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
27 set $browser "android"; 27 set $user_agent "android";
28 } 28 }
29 29
30 if ($arg_a ~ ^(view|show)?$) { 30 if ($arg_a ~ ^(view|show)?$) {
31 rewrite ^/(index\.html)?$ /$preferredLang/$browser redirect; 31 rewrite ^/(index\.html)?$ /$preferredLang/$user_agent redirect;
32 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$browser redirect; 32 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$user_agent redirect;
33 } 33 }
34 34
35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; 35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
36 rewrite ^/anwiki/(.*) /$1 permanent; 36 rewrite ^/anwiki/(.*) /$1 permanent;
37 37
38 if (-f $request_filename) { 38 if (-f $request_filename) {
39 break; 39 break;
40 } 40 }
41 if (-d $request_filename) { 41 if (-d $request_filename) {
42 break; 42 break;
43 } 43 }
44 44
45 set $static_uri $uri; 45 set $static_uri $uri;
46 set $platform $user_agent;
46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) { 47 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) {
47 set $static_uri "/$1/"; 48 set $static_uri "/$1/";
48 set $browser $3; 49 set $platform $3;
49 } 50 }
50 set $static ""; 51 set $static "";
51 if (-f "$document_root/static$static_uri") { 52 if (-f "$document_root/static$static_uri") {
52 set $static "ok"; 53 set $static "ok";
53 } 54 }
54 if (-d "$document_root/static$static_uri") { 55 if (-d "$document_root/static$static_uri") {
55 set $static "ok"; 56 set $static "ok";
56 } 57 }
57 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; 58 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode";
58 if ($static ~ ^ok!(view|show)?!$) { 59 if ($static ~ ^ok!(view|show)?!$) {
59 rewrite ^ /static$static_uri?browser=$browser last; 60 rewrite ^ /static$static_uri?platform=$platform&user_agent=$user_agent las t;
60 } 61 }
61 62
62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$ /index.php?p=$1&b rowser=$3 last; 63 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$ /index.php?p=$1&p latform=$3&user_agent=$user_agent last;
63 rewrite ^/(.*) /index.php?p=$1 last; 64 rewrite ^/(.*) /index.php?p=$1 last;
64 } 65 }
65 66
66 location /static/ { 67 location /static/ {
67 index index; 68 index index;
68 internal; 69 internal;
69 types { 70 types {
70 image/png png; 71 image/png png;
71 text/xml xml; 72 text/xml xml;
72 text/css css; 73 text/css css;
73 } 74 }
74 default_type text/html; 75 default_type text/html;
75 charset utf-8; 76 charset utf-8;
76 77
77 if ($arg_browser) { 78 if ($arg_platform) {
78 set $browser_class ' class="$arg_browser"'; 79 set $platform_class ' class="$arg_platform ua-$arg_user_agent"';
79 } 80 }
80 sub_filter ' id="content"' ' id="content"$browser_class'; 81 sub_filter ' id="content"' ' id="content"$platform_class';
81 } 82 }
82 83
83 84
84 location ~ \.php$ { 85 location ~ \.php$ {
85 client_max_body_size 8m; 86 client_max_body_size 8m;
86 87
87 if ($arg_browser) { 88 if ($arg_platform) {
88 set $browser_class ' class="$arg_browser"'; 89 set $platform_class ' class="$arg_platform ua-$arg_user_agent"';
89 } 90 }
90 sub_filter ' id="content"' ' id="content"$browser_class'; 91 sub_filter ' id="content"' ' id="content"$platform_class';
91 92
92 fastcgi_pass unix:/tmp/php-fastcgi.sock; 93 fastcgi_pass unix:/tmp/php-fastcgi.sock;
93 fastcgi_index index.php; 94 fastcgi_index index.php;
94 95
95 fastcgi_param SCRIPT_FILENAME /var/www/adblockplus.org/phproot$fastcgi_scrip t_name; 96 fastcgi_param SCRIPT_FILENAME /var/www/adblockplus.org/phproot$fastcgi_scrip t_name;
96 97
97 fastcgi_param QUERY_STRING $query_string; 98 fastcgi_param QUERY_STRING $query_string;
98 fastcgi_param REQUEST_METHOD $request_method; 99 fastcgi_param REQUEST_METHOD $request_method;
99 fastcgi_param CONTENT_TYPE $content_type; 100 fastcgi_param CONTENT_TYPE $content_type;
100 fastcgi_param CONTENT_LENGTH $content_length; 101 fastcgi_param CONTENT_LENGTH $content_length;
101 102
102 fastcgi_param SCRIPT_NAME $fastcgi_script_name; 103 fastcgi_param SCRIPT_NAME $fastcgi_script_name;
103 fastcgi_param REQUEST_URI $request_uri; 104 fastcgi_param REQUEST_URI $request_uri;
104 fastcgi_param DOCUMENT_URI $document_uri; 105 fastcgi_param DOCUMENT_URI $document_uri;
105 fastcgi_param DOCUMENT_ROOT $document_root; 106 fastcgi_param DOCUMENT_ROOT $document_root;
106 fastcgi_param SERVER_PROTOCOL $server_protocol; 107 fastcgi_param SERVER_PROTOCOL $server_protocol;
107 108
108 fastcgi_param GATEWAY_INTERFACE CGI/1.1; 109 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
109 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 110 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
110 111
111 fastcgi_param REMOTE_ADDR $remote_addr; 112 fastcgi_param REMOTE_ADDR $remote_addr;
112 fastcgi_param REMOTE_PORT $remote_port; 113 fastcgi_param REMOTE_PORT $remote_port;
113 fastcgi_param SERVER_ADDR $server_addr; 114 fastcgi_param SERVER_ADDR $server_addr;
114 fastcgi_param SERVER_PORT $server_port; 115 fastcgi_param SERVER_PORT $server_port;
115 fastcgi_param SERVER_NAME $server_name; 116 fastcgi_param SERVER_NAME $server_name;
116 } 117 }
117 } 118 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld