Don't URL encode payloads anymore
This commit is contained in:
parent
50b5fb5a34
commit
4e17e2ddd5
1 changed files with 4 additions and 9 deletions
13
notify.c
13
notify.c
|
@ -5,6 +5,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define NOTIFICATION_PREFIX "[h/nest-sanity-checks] "
|
#define NOTIFICATION_PREFIX "[h/nest-sanity-checks] "
|
||||||
|
/* No longer URL encoding payloads. TODO: remove later */
|
||||||
|
#pragma GCC poison urlencoded_report
|
||||||
/* #define NOTIFICATION_PREFIX_LEN sizeof(NOTIFICATION_PREFIX) */
|
/* #define NOTIFICATION_PREFIX_LEN sizeof(NOTIFICATION_PREFIX) */
|
||||||
/* notify_init() initializes curl.
|
/* notify_init() initializes curl.
|
||||||
If this fails, exiting is the only option, as curl must be usable,
|
If this fails, exiting is the only option, as curl must be usable,
|
||||||
|
@ -71,17 +73,10 @@ int send_alarm(const char *report) {
|
||||||
const char *prefixed_report;
|
const char *prefixed_report;
|
||||||
prefixed_report = build_prefixed_report(report);
|
prefixed_report = build_prefixed_report(report);
|
||||||
assert(prefixed_report!=NULL);
|
assert(prefixed_report!=NULL);
|
||||||
const char *urlencoded_report;
|
|
||||||
urlencoded_report = curl_easy_escape(curl, prefixed_report, 0);
|
|
||||||
/* assert(urlencoded_report!=NULL); */
|
|
||||||
if(urlencoded_report == NULL) {
|
|
||||||
fprintf(stderr, "[E] Failed to send report, curl_easy_escape failed.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
CURLcode post_field_set_result;
|
CURLcode post_field_set_result;
|
||||||
post_field_set_result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, urlencoded_report);
|
post_field_set_result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, prefixed_report);
|
||||||
if(post_field_set_result != CURLE_OK) {
|
if(post_field_set_result != CURLE_OK) {
|
||||||
fprintf(stderr, "[E] Failed to send report, setting CURLOPT_POSTFIELDS to %s failed.\n", urlencoded_report);
|
fprintf(stderr, "[E] Failed to send report, setting CURLOPT_POSTFIELDS to %s failed.\n", prefixed_report);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
Loading…
Reference in a new issue