summaryrefslogtreecommitdiff
path: root/src/plugins/relay/relay-http.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/relay/relay-http.c')
-rw-r--r--src/plugins/relay/relay-http.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/plugins/relay/relay-http.c b/src/plugins/relay/relay-http.c
index 591ae4ad8..5069eabdd 100644
--- a/src/plugins/relay/relay-http.c
+++ b/src/plugins/relay/relay-http.c
@@ -1243,25 +1243,19 @@ relay_http_send_json (struct t_relay_client *client,
const char *headers,
const char *json_string)
{
- int num_bytes, length;
+ int num_bytes;
char *headers2;
if (!client || !message)
return -1;
- num_bytes = -1;
- headers2 = NULL;
-
- length = 128 + ((headers) ? strlen (headers) : 0);
- headers2 = malloc (length);
- if (headers2)
- {
- snprintf (headers2, length,
- "%s%s%s",
- (headers) ? headers : "",
- (headers && headers[0]) ? "\r\n" : "",
- "Content-Type: application/json; charset=utf-8");
- }
+ weechat_asprintf (
+ &headers2,
+ "%s%s%s",
+ (headers) ? headers : "",
+ (headers && headers[0]) ? "\r\n" : "",
+ "Access-Control-Allow-Origin: *\r\n"
+ "Content-Type: application/json; charset=utf-8");
num_bytes = relay_http_send (client,
return_code,