예제 #1
0
                       parties_from_candidates,
                       gamma_decode_to_party_ballot,
                       FormatError)

from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlparse, parse_qsl
from urllib import urlencode, unquote
from os.path import exists
from sys import argv, stderr
from json import loads, dumps, load, dump
from Queue import Queue, Empty
from threading import Thread
from random import choice, shuffle, randint
from base64 import b64encode

p, g, q, x, y = c2048()

def get_http_connection(url):
    parsed = urlparse(url)
    kwargs = {}
    if parsed.scheme == 'https':
            default_port = '443'
            Conn = HTTPSConnection
            kwargs['context'] = ssl._create_unverified_context()
    else:
            default_port = '80'
            Conn = HTTPConnection
    host, sep, port = parsed.netloc.partition(':')
    if not port:
        port = default_port
    netloc = host + ':' + port
예제 #2
0
파일: client.py 프로젝트: gchatzip/zeus
                       mix_ciphers,
                       parties_from_candidates,
                       gamma_decode_to_party_ballot,
                       FormatError)
                        
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlparse, parse_qsl
from urllib import urlencode, unquote
from os.path import exists
from sys import argv, stderr
from json import loads, dumps, load, dump
from Queue import Queue, Empty
from threading import Thread
from random import choice, shuffle, randint

p, g, q, x, y = c2048()

def get_http_connection(url):
    parsed = urlparse(url)
    if parsed.scheme == 'https':
            default_port = '443'
            Conn = HTTPSConnection
    else:
            default_port = '80'
            Conn = HTTPConnection
    host, sep, port = parsed.netloc.partition(':')
    if not port:
        port = default_port
    netloc = host + ':' + port
    conn = Conn(netloc)
    conn.path = parsed.path