tornadoweb / tornadoweb/tornado

wsgi: Uncaught exception

Open
#3,055 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wsgi
Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

when i send a request like this:HTTPServerRequest(protocol='https', host=': localhost', method='GET', uri='/', version='HTTP/1.1', remote_ip='127.0.0.1')
there is a exception as follow:

ERROR:tornado.application:Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tornado/http1connection.py", line 273, in _read_message
delegate.finish()
File "/usr/local/lib/python3.8/site-packages/tornado/httpserver.py", line 280, in finish
self.request_callback(self.request)
File "/usr/local/lib/python3.8/site-packages/tornado/wsgi.py", line 114, in call
WSGIContainer.environ(request), start_response
File ERROR:tornado.application:Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tornado/http1connection.py", line 273, in _read_message
delegate.finish()
File "/usr/local/lib/python3.8/site-packages/tornado/httpserver.py", line 280, in finish
self.request_callback(self.request)
File "/usr/local/lib/python3.8/site-packages/tornado/wsgi.py", line 114, in call
WSGIContainer.environ(request), start_response
File "/usr/local/lib/python3.8/site-packages/tornado/wsgi.py", line 154, in environ
port = int(hostport[1])
ValueError: invalid literal for int() with base 10: ' localhost'
/wsgi.py", line 154, in environ
port = int(hostport[1])
ValueError: invalid literal for int() with base 10: ' localhost'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read tornado/wsgi.py around WSGIContainer.environ(), especially the host and port parsing near line 154. Reproduce the reported request and inspect existing WSGI tests for related host formatting cases. Done means the reported input has defined behavior without the uncaught ValueError and is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.