http2_server_push_tests.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:http2-ddos 作者: bennettaur 项目源码 文件源码
def test_server_push(io_loop, host, port):
    c = H2Client(io_loop=io_loop)

    yield c.connect(host, port)

    print("Sending HTTP/2 request with Server Push")
    now = time.time()
    response = yield c.get_request("/")
    yield gen.sleep(1)

    total_time = c.last_time_data_recvd - now

    print(
        "Pushes Received: {}\nTotal data received: {} bytes\nDuration: {}s\nRate: {} Bps\n".format(
            len(c.pushes),
            c.data_received_size,
            total_time,
            c.data_received_size/total_time
        )
    )
    #print response
    c.close_connection()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号