summaryrefslogtreecommitdiff
path: root/classes/tinderclient.bbclass
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2009-05-25 16:48:40 +0400
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2009-05-25 16:48:40 +0400
commitfb657b18aa1733ee5145ba7e6a4e20391bdcdf2d (patch)
treea0844102ce0853f0901a95a5a8a40ab97f9aa756 /classes/tinderclient.bbclass
parent9da5f51503ce6a0c9b8a0f5e6068c6fa19d44049 (diff)
tinderclient: support sitting behind proxy
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'classes/tinderclient.bbclass')
-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:]