Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wine support #6

Open
takerukoushirou opened this issue Jul 21, 2018 · 11 comments
Open

Wine support #6

takerukoushirou opened this issue Jul 21, 2018 · 11 comments

Comments

@takerukoushirou
Copy link

I am using foobar2000 under Wine (on MacOS, with WineBottler and Wine 2.0) and it seems to be unable to connect to the last.fm service at all. The problem starts when trying to request the authorisation:
foo_scrobble: Failed to get auth token. (error: -2, <unknown error>)

Looking at the source, this appears to happen in WebService::GetAuthToken() which seemingly ends up in the generic exception handler.

Originally I tried to authorise on a Windows system and copy the configuration to my Wine setup, which led to the following issue when scrobbling the cached tracks:
foo_scrobble: Scrobbling (Internal foo_scrobble error)

All in all the impression is that there's probably an issue with cpprest on Wine.

Using the latest stable Wine package 3.0.2, authorisation also fails but with a different error:
foo_scrobble: Failed to get auth token. (error: 11, The service is temporarily offline.)

On each event, Wine doesn't log any errors or warnings (using debug mode warn+all) that would hint on missing or incomplete API support.

@gix
Copy link
Owner

gix commented Jul 21, 2018

The embedded cpprest SDK uses WinHTTP as backend. Looking at the Wine source this should be supported. I've added a new 1.2.0 release with improved error reporting. Maybe this yields more information.

@apometron
Copy link

Show!!! =DDD I did loved the news. =DDD Thanks!!! =))) Keep up the Excellent Work!!!! =)))

@takerukoushirou
Copy link
Author

@gix thank you very much for quickly adding extra logging. Now I get the following when I try to authorise:

foo_scrobble: Requesting auth token
foo_scrobble: Failed to get auth token (Open failed)

@gix
Copy link
Owner

gix commented Jul 22, 2018

Can you please try running with tracing enabled? WINEDEBUG=+winhttp should work. You might also check whether a broken IE proxy is configured (see HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings values ProxyEnable and ProxyServer in the Wine registry).

@takerukoushirou
Copy link
Author

Sure, gladly. Proxy is none configured, other web request such as the search for component updates also works. With tracing enabled, the foobar console now shows:

foo_scrobble: Requesting auth token
foo_scrobble: Failed to get auth token (WinHttpSendRequest: 12007: Unable to get an error message for error code: 12007.)

This error interestingly translates to "The server name cannot be resolved."

Full Wine WinHTTP trace after clicking the request authorisation button:

005e:trace:winhttp:WinHttpGetDefaultProxyConfiguration 0x675fcb0
005e:trace:winhttp:WinHttpGetDefaultProxyConfiguration http proxy (from environment) = L""
005e:trace:winhttp:WinHttpOpen (null), 0, (null), (null), 0x10000000
005e:trace:winhttp:WinHttpGetDefaultProxyConfiguration 0x675fa48
005e:trace:winhttp:WinHttpGetDefaultProxyConfiguration http proxy (from environment) = L""
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpOpen returning 0x1
005e:trace:winhttp:WinHttpSetTimeouts 0x1, 30000, 30000, 30000, 30000
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpSetOption 0x1, 84, 0x675faa0, 4
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:session_set_option 0xaa0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpSetStatusCallback 0x1, 0x3bd60c0, 0x017f0c00, 0x0
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpConnect 0x1, L"ws.audioscrobbler.com", 80, 0
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 3
005e:trace:winhttp:addref_object 0x1cd43b0 -> refcount = 2
005e:trace:winhttp:send_callback 0x1e9b0b0, 0x00000400, 0x675fa64, 4
005e:trace:winhttp:send_callback returning from 0x00000400 callback
005e:trace:winhttp:release_object object 0x1cd43b0 refcount = 1
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 2
005e:trace:winhttp:WinHttpConnect returning 0x2
005e:trace:winhttp:WinHttpOpenRequest 0x2, L"POST", L"/2.0/", (null), (null), 0x0, 0x00000040
005e:trace:winhttp:addref_object 0x1cd43b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x2 -> 0x1cd43b0
005e:trace:winhttp:addref_object 0x1cd43b0 -> refcount = 3
005e:trace:winhttp:addref_object 0x1e93a78 -> refcount = 2
005e:trace:winhttp:send_callback 0x1e93a78, 0x00000400, 0x675f908, 4
005e:trace:winhttp:send_callback returning from 0x00000400 callback
005e:trace:winhttp:release_object object 0x1e93a78 refcount = 1
005e:trace:winhttp:release_object object 0x1cd43b0 refcount = 2
005e:trace:winhttp:WinHttpOpenRequest returning 0x3
005e:trace:winhttp:WinHttpAddRequestHeaders 0x3, L"Content-Length:114\r\nContent-Type:application/x-www-form-urlencoded\r\nUser-Agent:cpprestsdk/2.10.2\r\n", 98, 0x20000000
005e:trace:winhttp:addref_object 0x1e93a78 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x3 -> 0x1e93a78
005e:trace:winhttp:process_header L"Content-Length": L"114" 0x20000000
005e:trace:winhttp:get_header_index L"Content-Length"
005e:trace:winhttp:get_header_index returning -1
005e:trace:winhttp:process_header L"Content-Type": L"application/x-www-form-urlencoded" 0x20000000
005e:trace:winhttp:get_header_index L"Content-Type"
005e:trace:winhttp:get_header_index returning -1
005e:trace:winhttp:process_header L"User-Agent": L"cpprestsdk/2.10.2" 0x20000000
005e:trace:winhttp:get_header_index L"User-Agent"
005e:trace:winhttp:get_header_index returning -1
005e:trace:winhttp:release_object object 0x1e93a78 refcount = 1
005e:trace:winhttp:WinHttpSendRequest 0x3, (null), 0, 0, 114, 1cd2ee8
005e:trace:winhttp:addref_object 0x1e93a78 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x3 -> 0x1e93a78
005e:trace:winhttp:addref_object 0x1e93a78 -> refcount = 3
005e:trace:winhttp:queue_task queueing task 0x1cd4698
005e:trace:winhttp:release_object object 0x1e93a78 refcount = 2
0068:trace:winhttp:dequeue_task 1 tasks queued
0068:trace:winhttp:dequeue_task returning task 0x1cd4698
0068:trace:winhttp:process_header L"Host": L"ws.audioscrobbler.com" 0x10000000
0068:trace:winhttp:get_header_index L"Host"
0068:trace:winhttp:get_header_index returning -1
0068:trace:winhttp:process_header L"Content-Length": L"114" 0x10000000
0068:trace:winhttp:get_header_index L"Content-Length"
0068:trace:winhttp:get_header_index returning 0
0068:trace:winhttp:process_header L"Connection": L"Keep-Alive" 0x10000000
0068:trace:winhttp:get_header_index L"Connection"
0068:trace:winhttp:get_header_index returning -1
0069:trace:winhttp:resolve_hostname failed to get IPv4 address of L"" (nodename nor servname provided, or not known), retrying with IPv6
0069:trace:winhttp:resolve_hostname failed to get address of L"" (nodename nor servname provided, or not known)
0068:trace:winhttp:send_callback 0x1e93a78, 0x00200000, 0x9a9f6b8, 8
0068:trace:winhttp:WinHttpCloseHandle 0x3
0068:trace:winhttp:addref_object 0x1e93a78 -> refcount = 3
0068:trace:winhttp:grab_object handle 0x3 -> 0x1e93a78
0068:trace:winhttp:release_object object 0x1e93a78 refcount = 2
0068:trace:winhttp:free_handle destroying handle 0x3 for object 0x1e93a78
0068:trace:winhttp:release_object object 0x1e93a78 refcount = 1
0068:trace:winhttp:send_callback returning from 0x00200000 callback
0068:trace:winhttp:release_object object 0x1e93a78 refcount = 0
0068:trace:winhttp:send_callback 0x1e93a78, 0x00000800, 0x1e93a7c, 4
0068:trace:winhttp:send_callback returning from 0x00000800 callback
0068:trace:winhttp:release_object destroying object 0x1e93a78
0068:trace:winhttp:request_destroy 0x1e93a78
0068:trace:winhttp:dequeue_task 0 tasks queued
0068:trace:winhttp:dequeue_task returning task 0x0
0068:trace:winhttp:task_proc exiting
0068:trace:winhttp:request_destroy 0x1e93a78
0068:trace:winhttp:release_object object 0x1cd43b0 refcount = 1
005e:trace:winhttp:WinHttpCloseHandle 0x2
005e:trace:winhttp:addref_object 0x1cd43b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x2 -> 0x1cd43b0
005e:trace:winhttp:release_object object 0x1cd43b0 refcount = 1
005e:trace:winhttp:free_handle destroying handle 0x2 for object 0x1cd43b0
005e:trace:winhttp:release_object object 0x1cd43b0 refcount = 0
005e:trace:winhttp:send_callback 0x1cd43b0, 0x00000800, 0x1cd43b4, 4
005e:trace:winhttp:send_callback returning from 0x00000800 callback
005e:trace:winhttp:release_object destroying object 0x1cd43b0
005e:trace:winhttp:connect_destroy 0x1cd43b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpSetStatusCallback 0x1, 0x0, 0xffffffff, 0x0
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:WinHttpCloseHandle 0x1
005e:trace:winhttp:addref_object 0x1e9b0b0 -> refcount = 2
005e:trace:winhttp:grab_object handle 0x1 -> 0x1e9b0b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 1
005e:trace:winhttp:free_handle destroying handle 0x1 for object 0x1e9b0b0
005e:trace:winhttp:release_object object 0x1e9b0b0 refcount = 0
005e:trace:winhttp:release_object destroying object 0x1e9b0b0
005e:trace:winhttp:session_destroy 0x1e9b0b0

Also here, the hostname resolver fails. I can resolve ws.audioscrobbler.com without any issues on the host machine.

@gix
Copy link
Owner

gix commented Jul 24, 2018

0069:trace:winhttp:resolve_hostname failed to get IPv4 address of L"" (nodename nor servname provided, or not known), retrying with IPv6 looks weird. Somehow no hostname is passed into resolve which would explain why it can't connect.

I tried reproducing this myself with Wine 3.0.2 (on Ubuntu, with the package directly from WineHQ) but it crashes when I request authorization due to an unimplemented function in the standard library. So I wonder why it runs further for you.

@takerukoushirou
Copy link
Author

It's indeed weird. I'm also running this on Wine 3.0.2 but on macOS, using Homebrew as a package manager. Looking at the formula, it builds from WineHQ sources and only applies one patch against screen flickering.

Could possibly a library override cause the different behaviour? I have a bunch of runtime packages installed for fb2k and all the plugins I'm using.

@ghost
Copy link

ghost commented Jul 24, 2018

I have a component for foobar2000 which utilises Windows Script Host and while I can get it working under WINE, I can't connect to the Last.fm API via https. http works fine so I guess it's some security/certificate issue. Apparently Last.fm has something called SNI on their servers which Windows XP does not support - anything newer than Vista does. I guess that shows how far behind WINE is when implementing windows APIs.

https://en.wikipedia.org/wiki/Server_Name_Indication

AFAIK, winetricks only supports the XP version of IE8 and there isn't much hope of getting anything newer working.

@gix
Copy link
Owner

gix commented Jul 25, 2018

https isn't used to scrobble (I wasn't even aware that the endpoint supports it) so this shouldn't be the problem. On another note I tried with the latest Wine development release and it works fine.

@ghost
Copy link

ghost commented Jul 25, 2018

I thought https was a requirement for all POST requests but now I can't find any reference to that in the API docs at all - all examples are using http. Sorry for the noise!

@viniciusferrao
Copy link

Hello, as today this issue still persist, I'm with the following errors:

foo_scrobble: Requesting auth token
foo_scrobble: Failed to get auth token (Setting max automatic redirects: 12009: Unable to get an error message for error code: 12009. [error code: 12009, Unable to get an error message for error code: 12009.])

Anyone have a workaround for this?

My environment is PlayOnMac 4.4.2 with the shipped Wine version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants