mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Error handling, added data submission for connect.
This commit is contained in:
@@ -213,13 +213,24 @@ function GuacamoleHTTPTunnel(tunnelURL) {
|
||||
|
||||
}
|
||||
|
||||
function connect() {
|
||||
function connect(data) {
|
||||
|
||||
// Start tunnel and connect synchronously
|
||||
var connect_xmlhttprequest = new XMLHttpRequest();
|
||||
connect_xmlhttprequest.open("POST", TUNNEL_CONNECT, false);
|
||||
connect_xmlhttprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
connect_xmlhttprequest.send(null);
|
||||
connect_xmlhttprequest.send(data);
|
||||
|
||||
// If failure, throw error
|
||||
if (connect_xmlhttprequest.status != 200) {
|
||||
|
||||
var message = connect_xmlhttprequest.getResponseHeader("X-Guacamole-Error-Message");
|
||||
if (!message)
|
||||
message = "Internal error";
|
||||
|
||||
throw new Error(message);
|
||||
|
||||
}
|
||||
|
||||
// Get UUID from response
|
||||
tunnel_uuid = connect_xmlhttprequest.responseText;
|
||||
|
Reference in New Issue
Block a user