def clean_headers_client(header):
    """
    Only allows through headers which are safe to pass to the server
    """
    valid = ['user_agent', 'x-mining-extensions', 'x-mining-hashrate']
    for name, value in header.items():
        if name.lower() not in valid:
            del header[name]
        else:
            del header[name]
            header[name.lower()] = value
        if name.lower() == 'x-mining-extensions':
            allowed_extensions=['midstate', 'rollntime']
            header[name.lower()] = ' '.join([
                x for x in header[name.lower()].split(' ') if
                x in allowed_extensions])
    return header
dataset/ETHPy150Open c00w/bitHopper/bitHopper/Mining_Site/headers.py/clean_headers_client/original