From 581f65918a5d54a1806bbaccda2044e9466543af Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Mon, 9 Mar 2015 17:17:47 +0100 Subject: [PATCH] Getting the Server Reply code and content Getting the Server Reply code and content --- server/core/load_utils.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/core/load_utils.c b/server/core/load_utils.c index b8c9c5fb5..d8a735ecd 100644 --- a/server/core/load_utils.c +++ b/server/core/load_utils.c @@ -676,7 +676,9 @@ module_feedback_send(void* data) { curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* some servers don't like requests that are made without a user-agent field, so we provide one */ - curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0"); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "MaxScale-agent/http-1.0"); + /* Force HTTP/1.0 */ + curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_easy_setopt(curl, CURLOPT_URL, feedback_config->feedback_url); curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); @@ -718,8 +720,13 @@ module_feedback_send(void* data) { curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); } - if (http_code == 200) { - last_action = _NOTIFICATION_SEND_OK; + if (http_code == 302) { + char *from = strstr(chunk.data, "

ok

"); + if (from) { + last_action = _NOTIFICATION_SEND_OK; + } else { + last_action = _NOTIFICATION_SEND_ERROR; + } } else { last_action = _NOTIFICATION_SEND_ERROR; LOGIF(LE, (skygw_log_write_flush(