mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
get info on unhandled POST/action items
This commit is contained in:
@@ -408,31 +408,65 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
goto post_action_error;
|
goto post_action_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plist_t req_params_node = NULL;
|
||||||
|
|
||||||
/* three possible types are known */
|
/* three possible types are known */
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
int action_type = 0;
|
|
||||||
plist_get_string_val(req_type_node, &type);
|
plist_get_string_val(req_type_node, &type);
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "action type is %s", type);
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "action type is %s", type);
|
||||||
if (strstr(type, "unhandledURLResponse")) {
|
if (strstr(type, "unhandledURLResponse")) {
|
||||||
action_type = 1;
|
goto unhandledURLResponse;
|
||||||
} else if (strstr(type, "playlistInsert")) {
|
|
||||||
action_type = 2;
|
|
||||||
} else if (strstr(type, "playlistRemove")) {
|
} else if (strstr(type, "playlistRemove")) {
|
||||||
action_type = 3;
|
|
||||||
}
|
|
||||||
free (type);
|
|
||||||
|
|
||||||
plist_t req_params_node = NULL;
|
|
||||||
switch (action_type) {
|
|
||||||
case 1:
|
|
||||||
goto unhandledURLResponse;
|
|
||||||
case 2:
|
|
||||||
logger_log(conn->raop->logger, LOGGER_INFO, "unhandled action type playlistInsert (add new playback)");
|
|
||||||
goto finish;
|
|
||||||
case 3:
|
|
||||||
logger_log(conn->raop->logger, LOGGER_INFO, "unhandled action type playlistRemove (stop playback)");
|
logger_log(conn->raop->logger, LOGGER_INFO, "unhandled action type playlistRemove (stop playback)");
|
||||||
|
req_params_node = plist_dict_get_item(req_root_node, "params");
|
||||||
|
if (!req_params_node || !PLIST_IS_DICT (req_params_node)) {
|
||||||
|
goto post_action_error;
|
||||||
|
}
|
||||||
|
plist_t req_params_item_node = plist_dict_get_item(req_params_node, "item");
|
||||||
|
if (!req_params_item_node) {
|
||||||
|
goto post_action_error;
|
||||||
|
} else {
|
||||||
|
if (!PLIST_IS_DICT (req_params_item_node)) {
|
||||||
|
goto post_action_error;
|
||||||
|
}
|
||||||
|
plist_t req_params_item_uuid_node = plist_dict_get_item(req_params_item_node, "uuid");
|
||||||
|
char* remove_uuid = NULL;
|
||||||
|
plist_get_string_val(req_params_item_uuid_node, &remove_uuid);
|
||||||
|
const char *playback_uuid = get_playback_uuid(conn->raop->airplay_video);
|
||||||
|
if (strcmp(remove_uuid, playback_uuid)) {
|
||||||
|
logger_log(conn->raop->logger, LOGGER_ERR, "uuid of playlist removal action request did not match current playlist:\n"
|
||||||
|
" current: %s\n remove: %s", playback_uuid, remove_uuid);
|
||||||
|
} else {
|
||||||
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "removal_uuid matches playback_uuid\n");
|
||||||
|
}
|
||||||
|
free (remove_uuid);
|
||||||
|
}
|
||||||
|
logger_log(conn->raop->logger, LOGGER_ERR, "FIXME: playlist removal not yet implemented");
|
||||||
goto finish;
|
goto finish;
|
||||||
default:
|
} else if (strstr(type, "playlistInsert")) {
|
||||||
|
logger_log(conn->raop->logger, LOGGER_INFO, "unhandled action type playlistInsert (add new playback)");
|
||||||
|
printf("\n***************FIXME************************\nPlaylist insertion needs more information for it to be implemented:\n"
|
||||||
|
"please report following output as an \"Issue\" at http://github.com/FDH2/UxPlay:\n");
|
||||||
|
char *header_str = NULL;
|
||||||
|
http_request_get_header_string(request, &header_str);
|
||||||
|
printf("\n\n%s\n", header_str);
|
||||||
|
bool is_plist = (bool) strstr(header_str,"apple-binary-plist");
|
||||||
|
free(header_str);
|
||||||
|
if (is_plist) {
|
||||||
|
int request_datalen;
|
||||||
|
const char *request_data = http_request_get_data(request, &request_datalen);
|
||||||
|
plist_t req_root_node = NULL;
|
||||||
|
plist_from_bin(request_data, request_datalen, &req_root_node);
|
||||||
|
char * plist_xml;
|
||||||
|
uint32_t plist_len;
|
||||||
|
plist_to_xml(req_root_node, &plist_xml, &plist_len);
|
||||||
|
plist_xml = utils_strip_data_from_plist_xml(plist_xml);
|
||||||
|
printf("%s", plist_xml);
|
||||||
|
free(plist_xml);
|
||||||
|
plist_free(req_root_node);
|
||||||
|
}
|
||||||
|
assert(0);
|
||||||
|
} else {
|
||||||
logger_log(conn->raop->logger, LOGGER_INFO, "unknown action type (unhandled)");
|
logger_log(conn->raop->logger, LOGGER_INFO, "unknown action type (unhandled)");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
@@ -449,45 +483,45 @@ http_handler_action(raop_conn_t *conn, http_request_t *request, http_response_t
|
|||||||
int fcup_response_datalen = 0;
|
int fcup_response_datalen = 0;
|
||||||
|
|
||||||
if (logger_debug) {
|
if (logger_debug) {
|
||||||
plist_t plist_fcup_response_statuscode_node = plist_dict_get_item(req_params_node,
|
plist_t req_params_fcup_response_statuscode_node = plist_dict_get_item(req_params_node,
|
||||||
"FCUP_Response_StatusCode");
|
"FCUP_Response_StatusCode");
|
||||||
if (plist_fcup_response_statuscode_node) {
|
if (req_params_fcup_response_statuscode_node) {
|
||||||
plist_get_uint_val(plist_fcup_response_statuscode_node, &uint_val);
|
plist_get_uint_val(req_params_fcup_response_statuscode_node, &uint_val);
|
||||||
fcup_response_statuscode = (int) uint_val;
|
fcup_response_statuscode = (int) uint_val;
|
||||||
uint_val = 0;
|
uint_val = 0;
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_StatusCode = %d",
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_StatusCode = %d",
|
||||||
fcup_response_statuscode);
|
fcup_response_statuscode);
|
||||||
}
|
}
|
||||||
|
|
||||||
plist_t plist_fcup_response_requestid_node = plist_dict_get_item(req_params_node,
|
plist_t req_params_fcup_response_requestid_node = plist_dict_get_item(req_params_node,
|
||||||
"FCUP_Response_RequestID");
|
"FCUP_Response_RequestID");
|
||||||
if (plist_fcup_response_requestid_node) {
|
if (req_params_fcup_response_requestid_node) {
|
||||||
plist_get_uint_val(plist_fcup_response_requestid_node, &uint_val);
|
plist_get_uint_val(req_params_fcup_response_requestid_node, &uint_val);
|
||||||
request_id = (int) uint_val;
|
request_id = (int) uint_val;
|
||||||
uint_val = 0;
|
uint_val = 0;
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_RequestID = %d", request_id);
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_RequestID = %d", request_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plist_t plist_fcup_response_url_node = plist_dict_get_item(req_params_node, "FCUP_Response_URL");
|
plist_t req_params_fcup_response_url_node = plist_dict_get_item(req_params_node, "FCUP_Response_URL");
|
||||||
if (!PLIST_IS_STRING(plist_fcup_response_url_node)) {
|
if (!PLIST_IS_STRING(req_params_fcup_response_url_node)) {
|
||||||
goto post_action_error;
|
goto post_action_error;
|
||||||
}
|
}
|
||||||
char *fcup_response_url = NULL;
|
char *fcup_response_url = NULL;
|
||||||
plist_get_string_val(plist_fcup_response_url_node, &fcup_response_url);
|
plist_get_string_val(req_params_fcup_response_url_node, &fcup_response_url);
|
||||||
if (!fcup_response_url) {
|
if (!fcup_response_url) {
|
||||||
goto post_action_error;
|
goto post_action_error;
|
||||||
}
|
}
|
||||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_URL = %s", fcup_response_url);
|
logger_log(conn->raop->logger, LOGGER_DEBUG, "FCUP_Response_URL = %s", fcup_response_url);
|
||||||
|
|
||||||
plist_t plist_fcup_response_data_node = plist_dict_get_item(req_params_node, "FCUP_Response_Data");
|
plist_t req_params_fcup_response_data_node = plist_dict_get_item(req_params_node, "FCUP_Response_Data");
|
||||||
if (!PLIST_IS_DATA(plist_fcup_response_data_node)){
|
if (!PLIST_IS_DATA(req_params_fcup_response_data_node)){
|
||||||
goto post_action_error;
|
goto post_action_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint_val = 0;
|
uint_val = 0;
|
||||||
char *fcup_response_data = NULL;
|
char *fcup_response_data = NULL;
|
||||||
plist_get_data_val(plist_fcup_response_data_node, &fcup_response_data, &uint_val);
|
plist_get_data_val(req_params_fcup_response_data_node, &fcup_response_data, &uint_val);
|
||||||
fcup_response_datalen = (int) uint_val;
|
fcup_response_datalen = (int) uint_val;
|
||||||
|
|
||||||
if (!fcup_response_data) {
|
if (!fcup_response_data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user