mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
allow concurrent POST requests to same URL
This commit is contained in:
parent
bb2cf59a12
commit
c9ca0489ed
@ -280,25 +280,34 @@ static void* task_push_http_transfer_generic(
|
|||||||
const char *url, bool mute, const char *type,
|
const char *url, bool mute, const char *type,
|
||||||
retro_task_callback_t cb, void *user_data)
|
retro_task_callback_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
task_finder_data_t find_data;
|
|
||||||
retro_task_t *t = NULL;
|
retro_task_t *t = NULL;
|
||||||
http_handle_t *http = 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)
|
if (!conn)
|
||||||
return NULL;
|
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));
|
http = (http_handle_t*)malloc(sizeof(*http));
|
||||||
|
|
||||||
if (!http)
|
if (!http)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user