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;
|
||||
struct keyval *output_headers;
|
||||
char *output_body;
|
||||
const char *output_body;
|
||||
|
||||
/* A keyval/evbuf to store response headers and body.
|
||||
* Can be set to NULL to ignore that part of the response.
|
||||
@ -37,10 +37,6 @@ struct http_client_ctx
|
||||
|
||||
/* HTTP Response code */
|
||||
int response_code;
|
||||
|
||||
/* Private */
|
||||
int ret;
|
||||
void *evbase;
|
||||
};
|
||||
|
||||
struct http_icy_metadata
|
||||
|
@ -233,6 +233,7 @@ static int
|
||||
request_post(const char *url, struct keyval *kv, char **errmsg)
|
||||
{
|
||||
struct http_client_ctx ctx;
|
||||
char *request_body;
|
||||
int ret;
|
||||
|
||||
// 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));
|
||||
|
||||
ctx.output_body = http_form_urlencode(kv);
|
||||
if (!ctx.output_body)
|
||||
request_body = http_form_urlencode(kv);
|
||||
if (!request_body)
|
||||
{
|
||||
DPRINTF(E_LOG, L_LASTFM, "Aborting request, http_form_urlencode failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx.output_body = request_body;
|
||||
ctx.url = url;
|
||||
ctx.input_body = evbuffer_new();
|
||||
|
||||
@ -262,7 +264,7 @@ request_post(const char *url, struct keyval *kv, char **errmsg)
|
||||
ret = response_process(&ctx, errmsg);
|
||||
|
||||
out_free_ctx:
|
||||
free(ctx.output_body);
|
||||
free(request_body);
|
||||
evbuffer_free(ctx.input_body);
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user