Skip to content

Commit 06bc73a

Browse files
author
HK
authored
proxy authentification fix
using a proxy with username and password authentification needing the username:password being base64 encoded Syntax: Proxy-Authorization: <type> <credentials> example: Proxy-Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l this fix
1 parent f69d3ed commit 06bc73a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,8 +1230,11 @@ static ConnectionHolder create(@NotNull String addr, @NotNull Configuration conf
12301230

12311231
out.write(String.format("CONNECT %s:%d HTTP/1.0\n", apAddr, apPort).getBytes());
12321232
if (conf.proxyAuth) {
1233-
out.write("Proxy-Authorization: Basic ".getBytes());
1234-
out.write(Base64.getEncoder().encodeToString(String.format("%s:%s\n", conf.proxyUsername, conf.proxyPassword).getBytes()).getBytes());
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());
12351238
}
12361239

12371240
out.write('\n');

0 commit comments

Comments
 (0)