-
-
Notifications
You must be signed in to change notification settings - Fork 177
added support for more HTTP response headers #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
88e3eca
62e4fd9
aa64cc3
34fede7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,33 @@ | ||||||
/* | ||||||
Copyright 2015 - Hermes Center - GlobaLeaks project | ||||||
Author <giovanni.pellerano@evilaliv3.org> | ||||||
Javascript CheckTor library | ||||||
*/ | ||||||
|
||||||
function redirectIfOnTor(url, test_url) { | ||||||
// Test if the user is using Tor and in that case | ||||||
// redirects the user to provided url | ||||||
try { | ||||||
if (typeof(test_url) === 'undefined') { | ||||||
var test_url = 'https://antani.tor2web.org/checktor'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||
} | ||||||
if (window.XMLHttpRequest) { | ||||||
var xmlhttp = new XMLHttpRequest(); | ||||||
|
||||||
xmlhttp.onreadystatechange=function() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||
if (xmlhttp.readyState==4 && xmlhttp.status==200) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||
if (xmlhttp.getResponseHeader("x-check-tor")) { | ||||||
window.location.href = url; | ||||||
} | ||||||
} | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Insert
Suggested change
|
||||||
|
||||||
xmlhttp.open("GET", test_url, true); | ||||||
xmlhttp.send(); | ||||||
|
||||||
} | ||||||
} catch(err) { | ||||||
|
||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace
(test_url)·===·'undefined'
with·test_url·===·"undefined"