Re: [PATCH v3 2/7] src:(proxy): A new Object NMProxyConfig with Proxy Parameters



On Tue, 2016-08-02 at 02:01 +0530, Atul Anand wrote:


+             for (i = 0; priv->proxies->len; i++) {
+                     tmp = g_ptr_array_index (priv->proxies, i);
+
+                     if (strstr (tmp, "http://";)) {
+                             tmp = tmp + 7;

this is wrong for tmp = "foohttp://";.

Should be "if (g_str_has_prefix (tmp, "http://";))"

+                             str = g_strndup (tmp, strchr (tmp,
':') - tmp);

+                             g_object_set (s_proxy,
NM_SETTING_PROXY_HTTP_PROXY, str, NULL);
+                             g_free (str);
+
+                             tmp = strchr (tmp, ':') + 1;
+                             str = g_strndup (tmp, strchr (tmp,
'/') - tmp);
+                             port = (guint32) atoi (str);

let's not use atoi() but _nm_utils_ascii_str_to_int64().

+                             g_object_set (s_proxy,
NM_SETTING_PROXY_HTTP_PORT, port, NULL);
+                             g_free (str);
+

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]