Handle DAAP activity request

Reply to the DAAP /activity request with 204 / No content. Used by iTunes to
ping the server while streaming.
This commit is contained in:
Ace Jones 2009-12-20 14:43:28 +01:00 committed by Julien BLACHE
parent 3cb9e147fe
commit d231faff2d
1 changed files with 13 additions and 0 deletions

View File

@ -897,6 +897,13 @@ daap_reply_update(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
evhttp_send_reply(req, HTTP_OK, "OK", evbuf); evhttp_send_reply(req, HTTP_OK, "OK", evbuf);
} }
static void
daap_reply_activity(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query)
{
/* That's so nice, thanks for letting us know */
evhttp_send_reply(req, HTTP_NOCONTENT, "No Content", evbuf);
}
static void static void
daap_reply_dblist(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query) daap_reply_dblist(struct evhttp_request *req, struct evbuffer *evbuf, char **uri, struct evkeyvalq *query)
{ {
@ -1724,6 +1731,10 @@ static struct uri_map daap_handlers[] =
.regexp = "^/update$", .regexp = "^/update$",
.handler = daap_reply_update .handler = daap_reply_update
}, },
{
.regexp = "^/activity$",
.handler = daap_reply_activity
},
{ {
.regexp = "^/databases$", .regexp = "^/databases$",
.handler = daap_reply_dblist .handler = daap_reply_dblist
@ -1940,6 +1951,8 @@ daap_is_request(struct evhttp_request *req, char *uri)
return 1; return 1;
if (strcmp(uri, "/update") == 0) if (strcmp(uri, "/update") == 0)
return 1; return 1;
if (strcmp(uri, "/activity") == 0)
return 1;
if (strcmp(uri, "/logout") == 0) if (strcmp(uri, "/logout") == 0)
return 1; return 1;