diff --git a/src/sendprofile b/src/sendprofile
old mode 100644
new mode 100755
index b836567..8c0603f
--- a/src/sendprofile
+++ b/src/sendprofile
@@ -73,10 +73,17 @@ def send_profile(profile):
 	request.add_header("User-Agent", "fireinfo/%s" % fireinfo.__version__)
 
 	# Set upstream proxy if we have one.
-	# XXX this cannot handle authentication
 	proxy = get_upstream_proxy()
+
 	if proxy["host"]:
-		request.set_proxy(proxy["host"], "http")
+                # handling upstream proxies with authentication is more tricky...
+		if proxy["user"] and proxy["pass"]:
+			proxy_handler = urllib2.ProxyHandler({'https': 'http://' + proxy["user"] + ':' + proxy["pass"] + '@' + proxy["host"] + '/'})
+			auth = urllib2.HTTPBasicAuthHandler()
+			opener = urllib2.build_opener(proxy_handler, auth, urllib2.HTTPHandler)
+			urllib2.install_opener(opener)
+		else:
+			request.set_proxy(proxy["host"], "https")
 
 	try:
 		urllib2.urlopen(request, timeout=60)
