Hi,
I am in the process of finishing the migration of my LMS emacs controller to use HTTP requests instead of a telnet connection.
It's working smoothly, the code is simpler and more beautiful, but I've found a problem when making requests passing UTF-8 encoded data, the `url-retrieve` library in emacs does not accept multibyte parameters.
I've tried to replicate the requests using curl:
Case (a) works both with curl and with the equivalent elisp (emacs lisp) code, (b) works with curl but not in elisp code (i.e., my issue).
So I tried "hexifying" the search parameter, as in (c) or (d), but LMS doesn't like the query and does not return the proper answer, even with curl.
Is there a way to indicate LMS HTTP server that data is hexifyed and it needs to unhex before handling? f.e. using any special header in the request or something?
I'm using LMS v7.9.2 in a Sinology DS215j
Thanks,
Iñigo
WORKS:
(a)
(b)
DOES NOT WORK:
(c)
(d)
I am in the process of finishing the migration of my LMS emacs controller to use HTTP requests instead of a telnet connection.
It's working smoothly, the code is simpler and more beautiful, but I've found a problem when making requests passing UTF-8 encoded data, the `url-retrieve` library in emacs does not accept multibyte parameters.
I've tried to replicate the requests using curl:
Case (a) works both with curl and with the equivalent elisp (emacs lisp) code, (b) works with curl but not in elisp code (i.e., my issue).
So I tried "hexifying" the search parameter, as in (c) or (d), but LMS doesn't like the query and does not return the proper answer, even with curl.
Is there a way to indicate LMS HTTP server that data is hexifyed and it needs to unhex before handling? f.e. using any special header in the request or something?
I'm using LMS v7.9.2 in a Sinology DS215j
Thanks,
Iñigo
WORKS:
(a)
Code:
$ curl -s -H "Content-Type: application/json" -X POST -d '{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX", ["artists",0,10,"search:\'Bob Dylan\'"]]}' http://nas:9002/jsonrpc.js
{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bob Dylan'"]],"result":{"artists_loop":[{"artist":"Bob Dylan","id":19929},{"artist":"Bob Dylan & The Band","id":19930},{"artist":"Bob Dylan & Neil Young","id":19931}],"count":3}}
Code:
$ curl -s -H "Content-Type: application/json" -X POST -d '{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX", ["artists",0,10,"search:\'Björk\'"]]}' http://nas:9002/jsonrpc.js
{"params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Björk'"]],"result":{"count":1,"artists_loop":[{"id":19753,"artist":"Björk"}]},"method":"slim.request"}
DOES NOT WORK:
(c)
Code:
$ curl -s -H "Content-Type: application/json" -X POST -d '{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX", ["artists",0,10,"search:\'Bob%20Dylan\'"]]}' http://nas:9002/jsonrpc.js
{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bob%20Dylan'"]],"result":{"count":0}}
Code:
$ curl -s -H "Content-Type: application/json" -X POST -d '{"method":"slim.request","params":["XX:XX:XX:XX:XX:XX", ["artists",0,10,"search:\'Bj%C3%B6rk\'"]]}' http://nas:9002/jsonrpc.js
{"result":{"count":0},"params":["XX:XX:XX:XX:XX:XX",["artists","0",10,"search:'Bj%C3%B6rk'"]],"method":"slim.request"}