CreatCodeBuild/hyper2web

http.Response.headers implementation issue

CreatCodeBuild opened this issue · 1 comments

self.headers = {
	':status': '200',
	'content-length': '0',  # 不知用户是否应该自己计算这个
	'server': 'hyper2web'
}

The current implementation doesn't support Python3.5 because dict is unordered in all Pythons prior to 3.6.

But HTTP requires certain order of headers.

A list implementation has order but can not do fast update of headers.

An ordered dict is probably the best choice. However, I can either achieve this by support Python3.6 only or by use the OrderedDict

The concern is what will happen when users do headers.update(some_new_headers).

If the old headers and new headers have common fields and these common fields have different orders, which order will the result dict retain?

If the behavior is obviously better in Python3.6, then I will get rid of Python3.5 support.

If not, I will keep support both versions of Python.

Now I fixed the issue. But I have not written test code against it yet.

Will close this issue after passing the test.