mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-20 01:50:26 -05:00
Implement URI encoding quirk for iTunes and Roku
iTunes and Roku devices do not encode + as %2B in the query string and do not encode space as + either in the query string (though at least the Roku encode space as %20 everywhere). This needs to be worked around or browse queries fail to parse because + was decoded as space when the query really needs a + character.
This commit is contained in:
@@ -1782,7 +1782,6 @@ static struct uri_map daap_handlers[] =
|
||||
void
|
||||
daap_request(struct evhttp_request *req)
|
||||
{
|
||||
const char *req_uri;
|
||||
char *full_uri;
|
||||
char *uri;
|
||||
char *ptr;
|
||||
@@ -1796,23 +1795,27 @@ daap_request(struct evhttp_request *req)
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
req_uri = evhttp_request_uri(req);
|
||||
|
||||
full_uri = strdup(req_uri);
|
||||
full_uri = httpd_fixup_uri(req);
|
||||
if (!full_uri)
|
||||
{
|
||||
evhttp_send_error(req, HTTP_BADREQUEST, "Bad Request");
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = strchr(full_uri, '?');
|
||||
if (ptr)
|
||||
*ptr = '\0';
|
||||
|
||||
uri = strdup(full_uri);
|
||||
if (!uri)
|
||||
{
|
||||
evhttp_send_error(req, HTTP_BADREQUEST, "Bad Request");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr)
|
||||
*ptr = '?';
|
||||
|
||||
ptr = full_uri;
|
||||
full_uri = evhttp_decode_uri(full_uri);
|
||||
free(ptr);
|
||||
|
||||
ptr = uri;
|
||||
uri = evhttp_decode_uri(uri);
|
||||
free(ptr);
|
||||
|
||||
Reference in New Issue
Block a user