mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-10 21:28:09 -05:00
[http] Make output_body (request body) in http_client_ctx "const" and delete unused fields
This commit is contained in:
parent
f6ffa321bb
commit
9283d0c3c2
@ -21,7 +21,7 @@ struct http_client_ctx
|
|||||||
*/
|
*/
|
||||||
const char *url;
|
const char *url;
|
||||||
struct keyval *output_headers;
|
struct keyval *output_headers;
|
||||||
char *output_body;
|
const char *output_body;
|
||||||
|
|
||||||
/* A keyval/evbuf to store response headers and body.
|
/* A keyval/evbuf to store response headers and body.
|
||||||
* Can be set to NULL to ignore that part of the response.
|
* Can be set to NULL to ignore that part of the response.
|
||||||
@ -37,10 +37,6 @@ struct http_client_ctx
|
|||||||
|
|
||||||
/* HTTP Response code */
|
/* HTTP Response code */
|
||||||
int response_code;
|
int response_code;
|
||||||
|
|
||||||
/* Private */
|
|
||||||
int ret;
|
|
||||||
void *evbase;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct http_icy_metadata
|
struct http_icy_metadata
|
||||||
|
@ -233,6 +233,7 @@ static int
|
|||||||
request_post(const char *url, struct keyval *kv, char **errmsg)
|
request_post(const char *url, struct keyval *kv, char **errmsg)
|
||||||
{
|
{
|
||||||
struct http_client_ctx ctx;
|
struct http_client_ctx ctx;
|
||||||
|
char *request_body;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// API requires that we MD5 sign sorted param (without "format" param)
|
// API requires that we MD5 sign sorted param (without "format" param)
|
||||||
@ -245,13 +246,14 @@ request_post(const char *url, struct keyval *kv, char **errmsg)
|
|||||||
|
|
||||||
memset(&ctx, 0, sizeof(struct http_client_ctx));
|
memset(&ctx, 0, sizeof(struct http_client_ctx));
|
||||||
|
|
||||||
ctx.output_body = http_form_urlencode(kv);
|
request_body = http_form_urlencode(kv);
|
||||||
if (!ctx.output_body)
|
if (!request_body)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_LASTFM, "Aborting request, http_form_urlencode failed\n");
|
DPRINTF(E_LOG, L_LASTFM, "Aborting request, http_form_urlencode failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.output_body = request_body;
|
||||||
ctx.url = url;
|
ctx.url = url;
|
||||||
ctx.input_body = evbuffer_new();
|
ctx.input_body = evbuffer_new();
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ request_post(const char *url, struct keyval *kv, char **errmsg)
|
|||||||
ret = response_process(&ctx, errmsg);
|
ret = response_process(&ctx, errmsg);
|
||||||
|
|
||||||
out_free_ctx:
|
out_free_ctx:
|
||||||
free(ctx.output_body);
|
free(request_body);
|
||||||
evbuffer_free(ctx.input_body);
|
evbuffer_free(ctx.input_body);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user