CFLAGS := -O2 -g -fstack-protector -D_FORTIFY_SOURCE=2 -Wall -W -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wformat -Wformat-security -Werror=format-security
-MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0`
+MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0 libproxy-1.0`
#
# pkg-config tends to make programs pull in a ton of libraries, not all
# are needed. -Wl,--as-needed tells the linker to just drop unused ones,
#
LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0`
LDF_C := -Wl,--as-needed `pkg-config --libs glib-2.0`
-LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now"
+LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1 libproxy-1.0` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now"
all: corewatcher corewatcher-config corewatcher-applet corewatcher.8.gz
@(cd po/ && $(MAKE) $@)
#include <asm/unistd.h>
+#include <proxy.h>
#include <curl/curl.h>
#include "corewatcher.h"
return size * nmemb;
}
-void submit_queue_with_url(struct oops *queue, char *wsubmit_url)
+void submit_queue_with_url(struct oops *queue, char *wsubmit_url, char *proxy)
{
int result;
struct oops *oops;
handle = curl_easy_init();
curl_easy_setopt(handle, CURLOPT_URL, wsubmit_url);
+ if (proxy)
+ curl_easy_setopt(handle, CURLOPT_PROXY, proxy);
oops = queue;
while (oops) {
void submit_queue(void)
{
- int i;
+ int i, n;
struct oops *queue, *oops, *next;
CURL *handle;
+ pxProxyFactory *pf;
+ char **proxies = NULL;
+ char *proxy = NULL;
memset(result_url, 0, 4096);
queued_backtraces = NULL;
barrier();
+ pf = px_proxy_factory_new();
handle = curl_easy_init();
curl_easy_setopt(handle, CURLOPT_NOBODY, 1);
curl_easy_setopt(handle, CURLOPT_TIMEOUT, 5);
for (i = 0; i < url_count; i++) {
curl_easy_setopt(handle, CURLOPT_URL, submit_url[i]);
+ if (pf)
+ proxies = px_proxy_factory_get_proxies(pf, submit_url[i]);
+ if (proxies) {
+ proxy = proxies[0];
+ curl_easy_setopt(handle, CURLOPT_PROXY, proxy);
+ } else {
+ proxy = NULL;
+ }
if (!curl_easy_perform(handle)) {
- submit_queue_with_url(queue, submit_url[i]);
+ submit_queue_with_url(queue, submit_url[i], proxy);
break;
}
+ for (n = 0; proxies[n]; n++)
+ free(proxies[n]);
+ free(proxies);
}
-
+ px_proxy_factory_free(pf);
oops = queue;
while (oops) {