tornadoweb / tornadoweb/tornado
WSGIContainer does not support Keep-Alive
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
Apache Benchmark hangs when setting option -k if using FallbackHandler to a WSGIContainer.
I think the problem is that WSGIContainer does not set a Connection header when the request does not support HTTP 1.1.
Copying the code that sets the headers from RequestHandler.clear to WSGIContainer.__call__ fixes the issue:
if not request.supports_http_1_1():
if request.headers.get("Connection", '').lower() == "keep-alive":
headers.append(("Connection", "Keep-Alive"))
Btw, I have seen some clients sending a lowercase value for Keep-Alive, so I also suggest doing .lower() == "keep-alive" on RequestHandler.clear.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at WSGIContainer.call and RequestHandler.clear, comparing their handling of the Connection header for requests that do not support HTTP/1.1. Reproduce the Apache Benchmark case with the -k option and FallbackHandler, then verify that keep-alive requests receive the expected Connection behavior, including lowercase keep-alive values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100