allow concurrent POST requests to same URL

This commit is contained in:
Jamiras 2021-07-23 22:04:42 -06:00
parent bb2cf59a12
commit c9ca0489ed

View File

@ -280,25 +280,34 @@ static void* task_push_http_transfer_generic(
const char *url, bool mute, const char *type,
retro_task_callback_t cb, void *user_data)
{
task_finder_data_t find_data;
retro_task_t *t = NULL;
http_handle_t *http = NULL;
find_data.func = task_http_finder;
find_data.userdata = (void*)url;
/* Concurrent download of the same file is not allowed */
if (task_queue_find(&find_data))
{
if (conn)
net_http_connection_free(conn);
return NULL;
}
if (!conn)
return NULL;
if (conn->methodcopy && (conn->methodcopy[0] == 'P' || conn->methodcopy[0] == 'p'))
{
/* POST requests usually mutate the server, so assume multiple calls are
* intended, even if they're duplicated. Additionally, they may differ
* only by the POST data, and task_http_finder doesn't look at that, so
* unique requests could be misclassified as duplicates.
*/
}
else
{
task_finder_data_t find_data;
find_data.func = task_http_finder;
find_data.userdata = (void*)url;
/* Concurrent download of the same file is not allowed */
if (task_queue_find(&find_data))
{
net_http_connection_free(conn);
return NULL;
}
}
http = (http_handle_t*)malloc(sizeof(*http));
if (!http)