# Path: lib/settings.py
# CONF_PATH = os.path.join(ROOT, 'conf/')
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):


import re
import ssl
import socket
import warnings
import requests
import threading
from lib.settings import CONF_PATH
from lib.redisopt import conn, content_deal
from lib import config

            if not https:
                uri = url
            else:
                uri = "https://%s%s" % (host, url)
            print uri
            content_deal(headers, host, method, postdata='', uri=uri, packet=data)

            if 'Host' in headers.keys():
                del headers['Host']

            res = requests.get(uri, headers=headers, verify=False)
            response = get_str(res)
            connstream.sendall(response)
            connstream.close()
            return

        elif method == 'POST':
            body = data.split('\r\n\r\n')[1]
            head = data.split('\r\n\r\n')[0].split('\r\n')[1:]
            for h in head:
                if ': ' in h[2:]:
                    headers[h.split(': ')[0]] = h.split(': ')[1]
            host = headers['Host'].replace(' ', '')

            if not https:
                uri = url
            else:
                uri = "https://%s%s" % (host, url)
            print uri

# Path: lib/settings.py
# CONF_PATH = os.path.join(ROOT, 'conf/')
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):


# Path: proxy/mix_proxy.py
import re
import ssl
import socket
import warnings
import requests
import threading
from lib.settings import CONF_PATH
from lib.redisopt import conn, content_deal
from lib import config


            if not https:
                uri = url
            else:
                uri = "https://%s%s" % (host, url)
            print uri
            content_deal(headers, host, method, postdata='', uri=uri, packet=data)

            if 'Host' in headers.keys():
                del headers['Host']

            res = requests.get(uri, headers=headers, verify=False)
            response = get_str(res)
            connstream.sendall(response)
            connstream.close()
            return

        elif method == 'POST':
            body = data.split('\r\n\r\n')[1]
            head = data.split('\r\n\r\n')[0].split('\r\n')[1:]
            for h in head:
                if ': ' in h[2:]:
                    headers[h.split(': ')[0]] = h.split(': ')[1]
            host = headers['Host'].replace(' ', '')

            if not https:
                uri = url
            else:
                uri = "https://%s%s" % (host, url)
            print uri

            content_deal(headers, host, method, postdata=body, uri=uri, packet=data)