Commit 85c8328f authored by Claes Sjöfors's avatar Claes Sjöfors

Websocket server, replaced DatatypeConverter with Base64

parent 764118a5
...@@ -42,7 +42,8 @@ import java.nio.*; ...@@ -42,7 +42,8 @@ import java.nio.*;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.xml.bind.DatatypeConverter; //import javax.xml.bind.DatatypeConverter;
import java.util.Base64;
import java.security.MessageDigest; import java.security.MessageDigest;
//for test //for test
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -549,9 +550,8 @@ public class GdhWebSocketServer ...@@ -549,9 +550,8 @@ public class GdhWebSocketServer
+ "Connection: Upgrade\r\n" + "Connection: Upgrade\r\n"
+ "Upgrade: websocket\r\n" + "Upgrade: websocket\r\n"
+ "Sec-WebSocket-Accept: " + "Sec-WebSocket-Accept: "
+ DatatypeConverter.printBase64Binary( + Base64.getEncoder().encodeToString(
MessageDigest MessageDigest.getInstance("SHA-1")
.getInstance("SHA-1")
.digest((match.group(1) + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11") .digest((match.group(1) + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
.getBytes("UTF-8"))) .getBytes("UTF-8")))
+ "\r\n\r\n") + "\r\n\r\n")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment