var socks_test_server = null; var socks_listen_port = -1;
function getAvailableBytes(input) { var len = 0;
try {
len = input.available();
} catch (e) {}
return len;
}
function runScriptSubprocess(script, args) { var ds = new DirectoryService(); var bin = ds.get("XREExeF", Ci.nsIFile); if (!bin.exists()) {
do_throw("Can't find xpcshell binary");
}
var file = do_get_file(script); var proc = new Process(bin); var procArgs = [];
if (AppConstants.platform != "macosx") { var grebind = ds.get("GreBinD", Ci.nsIFile); if (!grebind.exists()) {
do_throw("Could not find binary dir");
}
var bin = new BinaryInputStream(input); var data = bin.readByteArray(len); this.inbuf = this.inbuf.concat(data);
switch (this.state) { case STATE_WAIT_GREETING: this.checkSocksGreeting(); break; case STATE_WAIT_SOCKS4_REQUEST: this.checkSocks4Request(); break; case STATE_WAIT_SOCKS4_USERNAME: this.checkSocks4Username(); break; case STATE_WAIT_SOCKS4_HOSTNAME: this.checkSocks4Hostname(); break; case STATE_WAIT_SOCKS5_GREETING: this.checkSocks5Greeting(); break; case STATE_WAIT_SOCKS5_REQUEST: this.checkSocks5Request(); break; case STATE_WAIT_PONG: this.checkPong(); break; default:
do_throw("server: read in invalid state!");
}
this.waitRead(input);
},
onOutputStreamReady(output) { var len = output.write(this.outbuf, this.outbuf.length); if (len != this.outbuf.length) { this.outbuf = this.outbuf.substring(len); this.waitWrite(output);
} else { this.outbuf = String();
}
},
function SocksTestServer() { this.listener = ServerSocket(-1, true, -1);
socks_listen_port = this.listener.port;
print("server: listening on", socks_listen_port); this.listener.asyncListen(this); this.test_cases = []; this.client_connections = []; this.client_subprocess = null; // port is used as the ID for test cases this.test_port_id = 8000; this.tests_completed = 0;
}
SocksTestServer.prototype = {
addTestCase(test) {
test.finished = false;
test.port = this.test_port_id++; this.test_cases.push(test);
},
pickTest(id) { for (var i in this.test_cases) { var test = this.test_cases[i]; if (test.port == id) { this.tests_completed++; return test;
}
}
do_throw("No test case with id " + id); returnnull;
},
testCompleted(client) { var port_id = buf2int(client.dest_port); var test = this.pickTest(port_id);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.33Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.