Commit ac0f454c authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

connectivity: conclude the check as soon as we see the magic header

No need to read the rest of the reponse.
parent 71b8d16e
......@@ -204,7 +204,6 @@ typedef struct {
size_t msg_size;
char *msg;
struct curl_slist *request_headers;
gboolean online_header;
} ConCheckCbData;
static void
......@@ -276,12 +275,6 @@ curl_check_connectivity (CURLM *mhandle, CURLMcode ret)
goto cleanup;
}
if (cb_data->online_header) {
_LOGD ("check for uri '%s' with Status header successful.", cb_data->uri);
new_state = NM_CONNECTIVITY_FULL;
goto cleanup;
}
/* Check response */
if (cb_data->msg && g_str_has_prefix (cb_data->msg, cb_data->response)) {
_LOGD ("Check for uri '%s' successful.", cb_data->uri);
......@@ -414,7 +407,9 @@ easy_header_cb (char *buffer, size_t size, size_t nitems, void *userdata)
if ( len >= sizeof (HEADER_STATUS_ONLINE) - 1
&& !g_ascii_strncasecmp (buffer, HEADER_STATUS_ONLINE, sizeof (HEADER_STATUS_ONLINE) - 1)) {
cb_data->online_header = TRUE;
_LOGD ("check for uri '%s' with Status header successful.", cb_data->uri);
finish_cb_data (cb_data, NM_CONNECTIVITY_FULL);
return 0;
}
return len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment