当前位置: 首页>>代码示例>>Python>>正文


Python Encoder.header_table_size方法代码示例

本文整理汇总了Python中hpack.hpack.Encoder.header_table_size方法的典型用法代码示例。如果您正苦于以下问题:Python Encoder.header_table_size方法的具体用法?Python Encoder.header_table_size怎么用?Python Encoder.header_table_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hpack.hpack.Encoder的用法示例。


在下文中一共展示了Encoder.header_table_size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_resizing_header_table_sends_multiple_updates

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_resizing_header_table_sends_multiple_updates(self):
        e = Encoder()

        e.header_table_size = 40
        e.header_table_size = 100
        e.header_table_size = 40

        header_set = [(':method', 'GET')]
        out = e.encode(header_set, huffman=True)
        assert out == b'\x3F\x09\x3F\x45\x3F\x09\x82'
开发者ID:Stranger6667,项目名称:hpack,代码行数:12,代码来源:test_hpack.py

示例2: test_resizing_header_table_to_same_size_ignored

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_resizing_header_table_to_same_size_ignored(self):
        e = Encoder()

        # These size changes should be ignored
        e.header_table_size = 4096
        e.header_table_size = 4096
        e.header_table_size = 4096

        # These size changes should be encoded
        e.header_table_size = 40
        e.header_table_size = 100
        e.header_table_size = 40

        header_set = [(':method', 'GET')]
        out = e.encode(header_set, huffman=True)
        assert out == b'\x3F\x09\x3F\x45\x3F\x09\x82'
开发者ID:Stranger6667,项目名称:hpack,代码行数:18,代码来源:test_hpack.py

示例3: test_resizing_header_table

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_resizing_header_table(self):
        # We need to encode a substantial number of headers, to populate the
        # header table.
        e = Encoder()
        header_set = [
            (':method', 'GET'),
            (':scheme', 'https'),
            (':path', '/some/path'),
            (':authority', 'www.example.com'),
            ('custom-key', 'custom-value'),
            (
                "user-agent",
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) "
                "Gecko/20100101 Firefox/16.0",
            ),
            (
                "accept",
                "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;"
                "q=0.8",
            ),
            ('X-Lukasa-Test', '88989'),
        ]
        e.encode(header_set, huffman=True)

        # Resize the header table to a size so small that nothing can be in it.
        e.header_table_size = 40
        assert len(e.header_table.dynamic_entries) == 0
开发者ID:Coder206,项目名称:servo,代码行数:29,代码来源:test_hpack.py

示例4: test_evicting_header_table_objects

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_evicting_header_table_objects(self):
        e = Encoder()

        # Set the header table size large enough to include one header.
        e.header_table_size = 66
        header_set = [('a', 'b'), ('long-custom-header', 'longish value')]
        e.encode(header_set)

        assert len(e.header_table.dynamic_entries) == 1
开发者ID:Stranger6667,项目名称:hpack,代码行数:11,代码来源:test_hpack.py

示例5: test_indexed_header_field_from_static_table

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_indexed_header_field_from_static_table(self):
        e = Encoder()
        e.header_table_size = 0
        header_set = {':method': 'GET'}
        result = b'\x82'

        # Make sure we don't emit an encoding context update.
        e.header_table.resized = False

        assert e.encode(header_set, huffman=False) == result
        assert list(e.header_table.dynamic_entries) == []
开发者ID:Stranger6667,项目名称:hpack,代码行数:13,代码来源:test_hpack.py

示例6: test_setting_table_size_to_the_same_does_nothing

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_setting_table_size_to_the_same_does_nothing(self):
        e = Encoder()

        # Set the header table size to the default.
        e.header_table_size = 4096

        # Now encode a header set. Just a small one, with a well-defined
        # output.
        header_set = [(':method', 'GET')]
        out = e.encode(header_set, huffman=True)

        assert out == b'\x82'
开发者ID:Stranger6667,项目名称:hpack,代码行数:14,代码来源:test_hpack.py

示例7: test_resizing_header_table_sends_context_update

# 需要导入模块: from hpack.hpack import Encoder [as 别名]
# 或者: from hpack.hpack.Encoder import header_table_size [as 别名]
    def test_resizing_header_table_sends_context_update(self):
        e = Encoder()

        # Resize the header table to a size so small that nothing can be in it.
        e.header_table_size = 40

        # Now, encode a header set. Just a small one, with a well-defined
        # output.
        header_set = [(':method', 'GET')]
        out = e.encode(header_set, huffman=True)

        assert out == b'?\t\x82'
开发者ID:Stranger6667,项目名称:hpack,代码行数:14,代码来源:test_hpack.py


注:本文中的hpack.hpack.Encoder.header_table_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。