def http_connect_raw(ipaddr, port, method, path, headers=None, query_string=None, ssl=False):
 if (not port):
  port = (443 if ssl else 80)
 if ssl:
  conn = HTTPSConnection(('%s:%s' % (ipaddr, port)))
 else:
  conn = BufferedHTTPConnection(('%s:%s' % (ipaddr, port)))
 if query_string:
  path += ('?' + query_string)
 conn.path = path
 conn.putrequest(method, path, skip_host=(headers and ('Host' in headers)))
 if headers:
  for (header, value) in headers.items():
   conn.putheader(header, str(value))
 conn.endheaders()
 return conn

def http_connect_raw ( ipaddr , port , method , path , headers = None , query_string = None , ssl = False ) : if ( not port ) : port = ( 443 if ssl else 80 ) if ssl : conn = HTTPSConnection ( ( '%s:%s' % ( ipaddr , port ) ) ) else : conn = BufferedHTTPConnection ( ( '%s:%s' % ( ipaddr , port ) ) ) if query_string : path += ( '?' + query_string ) conn . path = path conn . putrequest ( method , path , skip_host = ( headers and ( 'Host' in headers ) ) ) if headers : for ( header , value ) in headers . items ( ) : conn . putheader ( header , str ( value ) ) conn . endheaders ( ) return conn
helper function to create an httpconnection object .