Doesn't appear to work on proxy (Fedora 36)
Closed this issue · 10 comments
Hi, I'm trying to scrobble from behind a proxy, and have obtained a key and shared secret from last.fm.
On starting the application, I am prompted for a username and password. Entering these, sometimes the application hangs, sometimes I get the following message:
Failed to authenticate with Last.fm
Caused by:
Authentication failed: Connection Failed: Network is unreachable (os error 101)
Warning: no scrobbling services defined
Looking for an active MPRIS player...
Strace output, if it helps:
....
socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("130.211.19.189")}, 16) = 0
getsockname(3, {sa_family=AF_INET, sin_port=htons(41452), sin_addr=inet_addr("172.xxx")}, [28 => 16]) = 0
close(3) = 0
socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2600:1901:0:2fd6::", &sin6_addr), sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable)
close(3) = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("130.211.19.189")}, 16) = -1 EHOSTUNREACH (No route to host)
close(3) = 0
socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(443), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "2600:1901:0:2fd6::", &sin6_addr), sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable)
close(3) = 0
write(2, "Failed to authenticate with Last"..., 35Failed to authenticate with Last.fm) = 35
write(2, "\n\nCaused by:", 12
....
Unfortunately I can't test off-proxy due to my network setup.
Any help would be appreciated. Thank you.
That's weird. Have you been able to authenticate with Last.fm using other programs? Would it possible for you to share some details on your proxy setup?
I'm not sure what could be causing this, rescrobbled uses rustfm-scrobble to scrobble to Last.fm, so the issue could very well be in that library.
That's weird. Have you been able to authenticate with Last.fm using other programs? Would it possible for you to share some details on your proxy setup?
I'm not sure what could be causing this, rescrobbled uses rustfm-scrobble to scrobble to Last.fm, so the issue could very well be in that library.
I can authenticate fine using mpris-scrobbler
, but I'm having quite a few problems getting that to work reliably.
My proxy is in the form http://proxy.addr:port
for both HTTP and HTTPS, and there's also a SOCKS proxy for things like SSH. I have both the upper- and lower-case HTTP(S)_PROXY
environment variables set, as well as the GNOME gsettings
proxy values.
I'll have a look into rustfm-scrobble. It seems that it is maybe not reading (or failing to get) the proxy values, but I didn't see anything that tried to read them in the strace
output.
Thanks.
@C-Lunn This is a shot in the dark, but I've created a fork of rustfm-scrobble that uses a different HTTP client library. A rescrobbled version that uses this fork is on the use-rustfm-scrobble-fork
branch. If you're able to build Rust projects, could you give that a try? (I can also send over a binary)
Thanks!
@C-Lunn This is a shot in the dark, but I've created a fork of rustfm-scrobble that uses a different HTTP client library. A rescrobbled version that uses this fork is on the
use-rustfm-scrobble-fork
branch. If you're able to build Rust projects, could you give that a try? (I can also send over a binary)Thanks!
Username: MY_USERNAME
Password: <pw>, prints plaintext to terminal (bug?)
Failed to authenticate with Last.fm
Caused by:
Authentication failed: Status code 411 Length Required indicates failure
Warning: no scrobbling services defined
So, looks like it's connecting but a malformed request?
So, looks like it's connecting but a malformed request?
Yes, sorry, this is a mistake on my part while modifying rustfm-scrobble. I've fixed it and it seems to work for me, could you please try again? (You might have to make sure deps of rescrobbled are re-downloaded, eg. cargo clean
before running)
Password: <pw>, prints plaintext to terminal (bug?)
This can and should be fixed with a dependency, I'll make a separate issue.
@InputUsername
I have authenticated and now playing is updating correctly, and I've just seen it submit a scrobble. I'll leave my music playing and make sure it's working over time before closing, but I think you've got it.
Thanks!
@C-Lunn
Awesome! Thanks for your help debugging. I'll try to get this fix into rustfm-scrobble proper, so you won't have to use the fork.
For posterity: the issue seems to be in ureq (current HTTP library in rustfm-scrobble). Ureq either doesn't pick up proxy settings, or if it does, doesn't support HTTPS proxies. The fix is to replace it with attohttpc, which does pick up proxy settings.
@InputUsername
Do you want me to leave the issue open until you've done that, then? Or shall I close it for now?
@C-Lunn
Keep it open for now, I'll post an update when/if those changes are merged.
@C-Lunn
The developer did not respond to my issue, and I'm going to move forward with the fork. I've released this in v0.6.0, so hopefully scrobbling behind a proxy works now! 😄