def tunnel_request_data(host, port, proxy_auth_header=None):
 host_value = ((to_bytes(host, encoding='ascii') + ':') + to_bytes(str(port)))
 tunnel_req = (('CONNECT ' + host_value) + ' HTTP/1.1\r\n')
 tunnel_req += (('Host: ' + host_value) + '\r\n')
 if proxy_auth_header:
  tunnel_req += (('Proxy-Authorization: ' + proxy_auth_header) + '\r\n')
 tunnel_req += '\r\n'
 return tunnel_req

def tunnel_request_data ( host , port , proxy_auth_header = None ) : host_value = ( ( to_bytes ( host , encoding = 'ascii' ) + ':' ) + to_bytes ( str ( port ) ) ) tunnel_req = ( ( 'CONNECT ' + host_value ) + ' HTTP/1.1\r\n' ) tunnel_req += ( ( 'Host: ' + host_value ) + '\r\n' ) if proxy_auth_header : tunnel_req += ( ( 'Proxy-Authorization: ' + proxy_auth_header ) + '\r\n' ) tunnel_req += '\r\n' return tunnel_req
return binary content of a connect request .