aboutsummaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2009-06-22 22:56:30 +0000
committerMarcin Juszkiewicz <marcin@juszkiewicz.com.pl>2009-07-01 16:08:25 +0200
commit3edfda6e5d72637c6746a25c462a7eaa11123879 (patch)
treecac6124620aa2791151d03d39655642c5ff273e1 /classes
parent5ec2bbfb55ff13807a6e91b458672b8795e33a32 (diff)
downloadopenembedded-3edfda6e5d72637c6746a25c462a7eaa11123879.tar.gz
tinderclient: support sitting behind proxy
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> Acked-by: Koen Kooi <koen@openembedded.org>
Diffstat (limited to 'classes')
-rw-r--r--classes/tinderclient.bbclass24
1 files changed, 17 insertions, 7 deletions
diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass
index 0b7fc1d843..d2b2b33898 100644
--- a/classes/tinderclient.bbclass
+++ b/classes/tinderclient.bbclass
@@ -1,10 +1,20 @@
-def tinder_http_post(server, selector, content_type, body):
+def tinder_http_post(d, server, selector, content_type, body):
import httplib
+ from bb import data
# now post it
for i in range(0,5):
try:
- h = httplib.HTTP(server)
- h.putrequest('POST', selector)
+ proxy = data.getVar('HTTP_PROXY', d, True )
+ if (proxy):
+ if (proxy.endswith('/')):
+ proxy = proxy[:-1]
+ if (proxy.startswith('http://')):
+ proxy = proxy[7:]
+ h = httplib.HTTP(proxy)
+ h.putrequest('POST', 'http://%s%s' % (server, selector))
+ else:
+ h = httplib.HTTP(server)
+ h.putrequest('POST', selector)
h.putheader('content-type', content_type)
h.putheader('content-length', str(len(body)))
h.endheaders()
@@ -12,8 +22,8 @@ def tinder_http_post(server, selector, content_type, body):
errcode, errmsg, headers = h.getreply()
#print errcode, errmsg, headers
return (errcode,errmsg, headers, h.file)
- except:
- print "Error sending the report!"
+ except Exception, e:
+ print "Error sending the report! ", e
# try again
pass
@@ -116,7 +126,7 @@ def tinder_build_start(d):
#print "selector %s and url %s" % (selector, url)
# now post it
- errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
+ errcode, errmsg, headers, h_file = tinder_http_post(d,server,selector,content_type, body)
#print errcode, errmsg, headers
report = h_file.read()
@@ -151,7 +161,7 @@ def tinder_send_http(d, status, _log):
new_log = _log
while len(new_log) > 0:
content_type, body = tinder_format_http_post(d,status,new_log[0:18000])
- errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
+ errcode, errmsg, headers, h_file = tinder_http_post(d,server,selector,content_type, body)
#print errcode, errmsg, headers
#print h.file.read()
new_log = new_log[18000:]