Skip to content

Commit 2126500

Browse files
committed
Using OkHttp Credentials util
1 parent 06bc73a commit 2126500

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

lib/src/main/java/xyz/gianlu/librespot/core/Session.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,13 +1229,8 @@ static ConnectionHolder create(@NotNull String addr, @NotNull Configuration conf
12291229
DataInputStream in = new DataInputStream(sock.getInputStream());
12301230

12311231
out.write(String.format("CONNECT %s:%d HTTP/1.0\n", apAddr, apPort).getBytes());
1232-
if (conf.proxyAuth) {
1233-
String auth1 = "Proxy-Authorization: Basic";
1234-
String auth2 = String.format("%s:%s",conf.proxyUsername, conf.proxyPassword);
1235-
String auth2coded = Base64.getEncoder().encodeToString(auth2.getBytes());
1236-
String authFinal = String.format("%s %s\n",auth1, auth2coded);
1237-
out.write(authFinal.getBytes());
1238-
}
1232+
if (conf.proxyAuth)
1233+
out.write(String.format("Proxy-Authorization: %s\n", Credentials.basic(conf.proxyUsername, conf.proxyPassword)).getBytes());
12391234

12401235
out.write('\n');
12411236
out.flush();

0 commit comments

Comments
 (0)