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

XMLRPC call doesn't work for last.fm #1

Open
palfrey opened this issue Mar 23, 2010 · 1 comment
Open

XMLRPC call doesn't work for last.fm #1

palfrey opened this issue Mar 23, 2010 · 1 comment

Comments

@palfrey
Copy link

palfrey commented Mar 23, 2010

last.fm uses the XMLRPC server at ws.audioscrobbler.com. Using the example Python code for accessing this server works fine, but using the equivalent for Erlang didn't work. Studying the output with Wireshark, I noticed that Erlang wasn't outputting a Host header, and started digging into the XMLRPC code. Hacking a Host header manually into the POST fixed the basic bug, but other issues cropped up (the request comes back as "HTTP/1.0 200 OK" not HTTP/1.1), and they all appeared to come back to being a result of manually building/parsing the HTTP request as opposed to using the inets http client, which would seems the sensible option to me!

Problem with rewriting the xmlrpc module like that is that call/3 and call/5 wouldn't work as inets won't let you specify the socket to use AFAIK, and I can't seem to figure out how to set KeepAlive with that, but it still seems like a sensible option.

Example code used for testing:

-module(lastfm).
-export([start/0]).

start() -> 
    io:format("~p~n", [artist()]).

artist() ->
    case xmlrpc:call("ws.audioscrobbler.com", 80, "/2.0/", {call, artist.search, [{struct,[{artist,"blah"}]}]}, false,
             10000) of
    {error, Reason} ->
        {error, Reason};
    {ok, Result} ->
        Result
    end.
@rwbr
Copy link
Owner

rwbr commented Mar 23, 2010

Thank you for this report. I will investigate that issue soon. But the time I'm able to invest into that project is very limited right now. In the meantime you are welcome to submit a patch for that problem.

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

2 participants