Skip to content

Commit 6fed318

Browse files
authored
proxy authentification fix (#274)
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
2 parents f69d3ed + 2126500 commit 6fed318

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,10 +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-
out.write("Proxy-Authorization: Basic ".getBytes());
1234-
out.write(Base64.getEncoder().encodeToString(String.format("%s:%s\n", conf.proxyUsername, conf.proxyPassword).getBytes()).getBytes());
1235-
}
1232+
if (conf.proxyAuth)
1233+
out.write(String.format("Proxy-Authorization: %s\n", Credentials.basic(conf.proxyUsername, conf.proxyPassword)).getBytes());
12361234

12371235
out.write('\n');
12381236
out.flush();

0 commit comments

Comments
 (0)