-
Notifications
You must be signed in to change notification settings - Fork 8
/
demo.html
163 lines (160 loc) · 5.99 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demonstration - Debian mirrors HTTP redirector</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="no-email-collection" content="http://www.unspam.com/noemailcollection" />
</head>
<body onload="sendAjaxGET();">
<h1>Demonstration</h1>
<script type="text/javascript">
//<![CDATA[
function createRequest() {
var request;
try {
request = new XMLHttpRequest();
} catch (exception) {
request = false;
}
if (!request)
alert("Could not create ajax object. Are you running IE?");
return request;
}
function sendAjaxGET() {
var req = createRequest();
var url = document.getElementById('mirror_selector').value;
if (!req)
return false;
document.getElementById('mirror_path').textContent = url;
req.open("GET", '/demo'+url, true);
req.onreadystatechange = ajaxResponse;
document.getElementById('loading').innerHTML = 'Loading...';
req.send();
return false;
}
function ajaxResponse() {
if (this.readyState == 4) {
document.getElementById('loading').innerHTML = '';
if (this.status != 200) {
alert("Oops, the server failed with '"+this.statusText+"'");
return;
}
var ip = this.getResponseHeader("X-IP"),
as = this.getResponseHeader("X-AS"),
continent = this.getResponseHeader("X-Continent"),
country = this.getResponseHeader("X-Country"),
region = this.getResponseHeader("X-Region"),
city = this.getResponseHeader("X-City"),
links = this.getResponseHeader("Link"),
type = this.getResponseHeader("X-Match-Type"),
popu = this.getResponseHeader("X-Population");
document.getElementById('ip').textContent = 'IP: '+ip;
document.getElementById('as').textContent = 'AS: '+as;
document.getElementById('country').textContent = 'Country: '+country;
document.getElementById('continent').textContent = 'Continent: '+continent;
document.getElementById('region').textContent = 'Region: '+region;
document.getElementById('city').textContent = 'City: '+city;
links = links.replace(/; rel=duplicate; pri=[0-9]+; depth=[0-9]+/g,'');
links = links.replace(/(\u003C|\u003E)/g, '');
links = links.replace(/,/g, '</li><li>');
document.getElementById('mirrors').innerHTML = '<ul><li>'+links+'</li></ul>';
document.getElementById('type').textContent = 'Matched by: '+type;
document.getElementById('population').textContent = 'Out of a population of: '+popu+' mirrors';
document.getElementById('allheaders').value = this.getAllResponseHeaders();
}
}
//]]>
</script>
<noscript>Sorry, the demo is javascript based. You can see what this
demo shows by running (or other paths):
<pre>GET -e http://httpredir.debian.org/demo/debian/</pre>
</noscript>
<div>
<p>
Your details, as seen by the redirector:
</p>
<noscript>
unavailable
</noscript>
<div id="loading"></div>
<div id="ip"></div>
<div id="as"></div>
<div id="continent"></div>
<div id="country"></div>
<div id="region"></div>
<div id="city"></div>
<p>
Had you requested a file to <span id="mirror_path">/debian/</span>,
you would have been sent to one of the following mirrors:
</p>
<noscript>
unavailable
</noscript>
<div id="mirrors"></div>
<div id="population"></div>
<div id="type"></div>
</div>
<button type="button" onclick="return sendAjaxGET();">Retry</button> |
<select id="mirror_selector" onchange="return sendAjaxGET();">
<option value="/debian/" selected="selected">/debian/</option>
<option value="/debian-backports/">/debian-backports/</option>
<option value="/debian-ports/">/debian-ports/</option>
<option value="/debian-security/">/debian-security/</option>
<option value="/debian-archive/">/debian-archive/</option>
</select>
<div id="explanation">
<h2>Explanation</h2>
<p>
The destination mirrors depends on many factors, from those mentioned
above, to the reachability, freshness, etc.<br/>
The <i>population</i> may be bigger than the number of mirrors listed
above, meaning there were other candidates but they were not considered
because of their distance to you.
</p>
</div>
<div id="issues">
<h2>Corrections and issue reporting</h2>
<p>
If any of the fields of the <i>your details</i> section is incorrect,
please refer to <a
href="http://www.maxmind.com/app/locate_my_ip">maxmind.com</a>. If your
details are correct there, then it might be a limitation of the free
version of their database. Otherwise, feel free to send them a <a
href="http://www.maxmind.com/app/correction">correction</a>.<br/>
If you believe there's another mirror that could serve you better,
other than those listed above, please check the following before
contacting me (it's not mandatory, but you would save me some time):
</p>
<ol>
<li>Make sure it is part of the official <a
href="https://www.debian.org/mirrors/list">Debian mirrors
network</a></li>
<li>It is up to date (the main archive is updated several times a day)</li>
<li>There's a file with the same name as the mirror's host name in the
project/trace/ directory (e.g.
http://mirror.tld/debian/project/trace/mirror.tld)</li>
</ol>
<p>
All three points can be fixed by the mirror administrators, and only by
them.<br/>
At some point there will be a page where you can check why a mirror is
disabled in the redirector.<br/>
If after all that, there's a mirror that would serve you better and it
isn't listed, please do send me an email along with the <a href="#"
onclick="document.getElementById('allheaders').style.display='block';return false;">
response headers</a> to the email address at the bottom of this page.
<textarea id="allheaders" style="display:none;" rows="8" cols="73">
</textarea>
</p>
</div>
<div id="footer">
<a href="/">Back to main page</a>
<center>
<p>Please send feedback to <a href="mailto:[email protected]">Raphael
Geissert</a></p>
<img class="logo" src="https://www.debian.org/logos/openlogo-nd-25.png"
alt="Small Debian logo" />
</center>
</div>
</body>
</html>