add helper function for accessing connection method

This commit is contained in:
Jamiras 2021-07-27 21:02:14 -06:00
parent c9ca0489ed
commit 5ac432026a
3 changed files with 10 additions and 1 deletions

View File

@ -46,6 +46,8 @@ void net_http_connection_set_user_agent(struct http_connection_t* conn, const ch
const char *net_http_connection_url(struct http_connection_t *conn);
const char* net_http_connection_method(struct http_connection_t* conn);
struct http_t *net_http_new(struct http_connection_t *conn);
/* You can use this to call net_http_update

View File

@ -682,6 +682,11 @@ const char *net_http_connection_url(struct http_connection_t *conn)
return conn->urlcopy;
}
const char* net_http_connection_method(struct http_connection_t* conn)
{
return conn->methodcopy;
}
struct http_t *net_http_new(struct http_connection_t *conn)
{
bool error = false;

View File

@ -282,11 +282,13 @@ static void* task_push_http_transfer_generic(
{
retro_task_t *t = NULL;
http_handle_t *http = NULL;
const char *method = NULL;
if (!conn)
return NULL;
if (conn->methodcopy && (conn->methodcopy[0] == 'P' || conn->methodcopy[0] == 'p'))
method = net_http_connection_method(conn);
if (method && (method[0] == 'P' || method[0] == 'p'))
{
/* POST requests usually mutate the server, so assume multiple calls are
* intended, even if they're duplicated. Additionally, they may differ