Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Support 'never indexed' headers. #110

@Lukasa

Description

@Lukasa

Turns out our built in HPACK support does not correctly handle 'Literal Header Field never Indexed' headers, as mentioned in section 6.2.3 of the HPACK spec.

I found this when testing hyper's command line tool against https://docs.trafficserver.apache.org/en/latest/. As we can see in the output below, hyper gets thoroughly confused about the header table.

I suspect the fix is is a simple one: extend the 'not indexed' handling to handle 'never indexed', as both header types are identical for clients.

$ hyper --debug https://docs.trafficserver.apache.org/en/latest/
url info: {'path': '/en/latest/', 'port': 443, 'scheme': 'https', 'netloc': 'docs.trafficserver.apache.org', 'fragment': None, 'host': 'docs.trafficserver.apache.org', 'query': None}
Commandline Argument: Namespace(_url='https://docs.trafficserver.apache.org/en/latest/', body=None, debug=True, headers={}, items=[], method='GET', url=<hyper.cli.set_url_info.<locals>.UrlInfo object at 0x02BC5FF0>)
Sending frame SettingsFrame on stream 0
Received frame SettingsFrame on stream 0
Setting header table size to 4096 from 4096
Sending frame SettingsFrame on stream 0
HPACK encoding [(':method', 'GET'), (':scheme', 'https'), (':authority', 'docs.trafficserver.apache.org'), (':path', '/en/latest/')]
Adding (b':method', b'GET') to the header table
Encoding 2 with 7 bits.
Adding (b':scheme', b'https') to the header table
Encoding 7 with 7 bits.
Adding (b':authority', b'docs.trafficserver.apache.org') to the header table
Encoding 1 with 4 bits.
Encoding 20 with 7 bits.
Adding (b':path', b'/en/latest/') to the header table
Encoding 4 with 4 bits.
Encoding 8 with 7 bits.
Encoded header block to b'\x82\x87\x01\x94\x90\xe4B\xe9\xb0r\xcab \xb6w-\x8b\x8e\xb1\x92r\xae{&\x04\x88`\xb51@\xd2T%\x8f'
Sending frame HeadersFrame on stream 1
Received frame SettingsFrame on stream 0
Received frame HeadersFrame on stream 1
Decoding b'\x10\x07:status\x03200@\x06server\tATS/6.0.0@\x04date\x1dTue, 31 Mar2015 08:09:51 GMT@\x0ccontent-type\ttext/html@\x0econtent-length\x0542468@\rlast-modified\x1dTue, 31 Mar 2015 01:55:51 GMT@\x04vary\x0fAccept-Encoding@\x04etag\x0f"5519fea7-a5e4"@\x08x-served\x05Nginx@\x14x-subdomain-tryfiles\x04True@\x07x-deity\thydra-lts@\raccept-ranges\x05bytes@\x03age\x010@\x19strict-transport-security\rmax-age=86400@\x03via2https/1.1 ATS (ApacheTrafficServer/6.0.0 [cSsNfU])'
Decoded 0 consuming 1 bytes.
Decoded 7 consuming 1 bytes.
Decoded (b'www-authenticate', b':status'), consumed 1, indexed False
Decoded 3 consuming 1 bytes.
Decoded 50 consuming 1 bytes.
Decoded (b':method', b'00@\x06server\tATS/6.0.0@\x04date\x1dTue, 31 Mar 2015 08:
09:'), consumed 1, indexed False
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 4096
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 7 consuming 1 bytes.
Decoded 77 consuming 1 bytes.
Evicting b':scheme': b'T@\x0ccontent-type\ttext/html@\x0econtent-length\x0542468
@\rlast-modified\x1dTue, 31 Mar 20' from the header table
Decoded (b':scheme', b'T@\x0ccontent-type\ttext/html@\x0econtent-length\x0542468
@\rlast-modified\x1dTue, 31 Mar 20'), consumed 1, indexed True
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 7 consuming 1 bytes.
Decoded 77 consuming 1 bytes.
Evicting b':scheme': b'T@\x04vary\x0fAccept-Encoding@\x04etag\x0f"5519fea7-a5e4"@\x08x-served\x05Nginx@\x14x-subdomain-tr' from the header table
Decoded (b':scheme', b'T@\x04vary\x0fAccept-Encoding@\x04etag\x0f"5519fea7-a5e4"@\x08x-served\x05Nginx@\x14x-subdomain-tr'), consumed 1, indexed True
Decoded 57 consuming 1 bytes.
Decoded 102 consuming 1 bytes.
Evicting b'transfer-encoding': b'iles\x04True@\x07x-deity\thydra-lts@\raccept-ranges\x05bytes@\x03age\x010@\x19strict-transport-security\rmax-age=86400@\x03via' from the header table
Decoded (b'transfer-encoding', b'iles\x04True@\x07x-deity\thydra-lts@\raccept-ranges\x05bytes@\x03age\x010@\x19strict-transport-security\rmax-age=86400@\x03via'), consumed 1, indexed True
Decoded 16 consuming 1 bytes.
Resizing decoder header table to 16 from 16
Decoded 40 consuming 1 bytes.
Decoded 116 consuming 1 bytes.
Evicting b'if-modified-since': b'tps/1.1 ATS (ApacheTrafficServer/6.0.0 [cSsNfU]
)' from the header table
Decoded (b'if-modified-since', b'tps/1.1 ATS (ApacheTrafficServer/6.0.0 [cSsNfU]
)'), consumed 1, indexed True
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Received frame DataFrame on stream 1
Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\hyper.exe\__main__.py", line 9, in <module>
  File "C:\Python34\lib\site-packages\hyper\cli.py", line 231, in main
    data = request(args)
  File "C:\Python34\lib\site-packages\hyper\cli.py", line 219, in request
    response = conn.getresponse()
  File "C:\Python34\lib\site-packages\hyper\http20\connection.py", line 171, in getresponse
    return HTTP20Response(stream.getheaders(), stream)
  File "C:\Python34\lib\site-packages\hyper\http20\response.py", line 108, in __init__
    self.status = int(status)
TypeError: int() argument must be a string or a number, not 'NoneType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions