Bug 385280. should send proxy settings to the breakpad reporter(For Linux/Solaris). r=ted.mielczarek,a=dsicore.

This commit is contained in:
alfred.peng@sun.com 2008-04-29 00:37:12 -07:00
Родитель 92e628614e
Коммит 5620458e8c
2 изменённых файлов: 56 добавлений и 5 удалений

Просмотреть файл

@ -83,8 +83,8 @@ LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \ $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
LOCAL_INCLUDES += -I$(srcdir) LOCAL_INCLUDES += -I$(srcdir)
OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS) OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GCONF_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS) OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GCONF_LIBS) $(MOZ_GTHREAD_LIBS)
CPPSRCS += http_upload.cc CPPSRCS += http_upload.cc
FORCE_USE_PIC=1 FORCE_USE_PIC=1
endif endif
@ -95,8 +95,8 @@ LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \ $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
LOCAL_INCLUDES += -I$(srcdir) LOCAL_INCLUDES += -I$(srcdir)
OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS) OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GCONF_CFLAGS) $(MOZ_GTHREAD_CFLAGS)
OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS) OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GCONF_LIBS) $(MOZ_GTHREAD_LIBS)
CPPSRCS += http_upload.cc CPPSRCS += http_upload.cc
FORCE_USE_PIC=1 FORCE_USE_PIC=1
endif endif

Просмотреть файл

@ -50,6 +50,7 @@
#include <signal.h> #include <signal.h>
#include <gconf/gconf-client.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
@ -78,6 +79,8 @@ static bool gDidTrySend = false;
static string gDumpFile; static string gDumpFile;
static StringTable gQueryParameters; static StringTable gQueryParameters;
static string gSendURL; static string gSendURL;
static string gHttpProxy;
static string gAuth;
static vector<string> gRestartArgs; static vector<string> gRestartArgs;
static string gURLParameter; static string gURLParameter;
@ -93,6 +96,8 @@ static void* gnomeuiLib = NULL;
static const char kIniFile[] = "crashreporter.ini"; static const char kIniFile[] = "crashreporter.ini";
#define HTTP_PROXY_DIR "/system/http_proxy"
static void LoadSettings() static void LoadSettings()
{ {
StringTable settings; StringTable settings;
@ -188,15 +193,61 @@ static gboolean ReportCompleted(gpointer success)
return FALSE; return FALSE;
} }
static void LoadProxyinfo()
{
GConfClient *conf = gconf_client_get_default();
if (!getenv ("http_proxy") &&
gconf_client_get_bool(conf, HTTP_PROXY_DIR "/use_http_proxy", NULL)) {
gint port;
gchar *host = NULL, *httpproxy = NULL;
host = gconf_client_get_string(conf, HTTP_PROXY_DIR "/host", NULL);
port = gconf_client_get_int(conf, HTTP_PROXY_DIR "/port", NULL);
if (port && host && host != '\0') {
httpproxy = g_strdup_printf("http://%s:%d/", host, port);
gHttpProxy = httpproxy;
}
g_free(host);
g_free(httpproxy);
if(gconf_client_get_bool(conf, HTTP_PROXY_DIR "/use_authentication", NULL)) {
gchar *user, *password, *auth;
user = gconf_client_get_string(conf,
HTTP_PROXY_DIR "/authentication_user",
NULL);
password = gconf_client_get_string(conf,
HTTP_PROXY_DIR
"/authentication_password",
NULL);
if (user != "\0") {
auth = g_strdup_printf("%s:%s", user, password);
gAuth = auth;
}
g_free(user);
g_free(password);
g_free(auth);
}
}
g_object_unref(conf);
}
static gpointer SendThread(gpointer args) static gpointer SendThread(gpointer args)
{ {
string response, error; string response, error;
LoadProxyinfo();
bool success = google_breakpad::HTTPUpload::SendRequest bool success = google_breakpad::HTTPUpload::SendRequest
(gSendURL, (gSendURL,
gQueryParameters, gQueryParameters,
gDumpFile, gDumpFile,
"upload_file_minidump", "upload_file_minidump",
"", "", gHttpProxy, gAuth,
&response, &response,
&error); &error);
if (success) { if (success) {