Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for ticket #1036: Add proxy-style (absolute-url) requests support #1089

Closed
wants to merge 0 commits into from
Closed

Conversation

sjtubinlong
Copy link

Add absolute-url support as described in ticket #1036.

  1. Simply parse the uri startswith 'http' or 'https' via urlparse.urlparse and convert it into relative-path
  2. add several test cases in httpserver_test

@sjtubinlong
Copy link
Author

py3.2 DEPS=true

ERROR: test_malformed_first_line (tornado.test.httpserver_test.HTTPServerRawTest)

Traceback (most recent call last):
File "/home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages/tornado-4.0b1-py3.2-linux-x86_64.egg/tornado/testing.py", line 118, in call
result = self.orig_method()
File "/home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages/tornado-4.0b1-py3.2-linux-x86_64.egg/tornado/test/httpserver_test.py", line 400, in test_malformed_first_line
self.wait()
File "/home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages/tornado-4.0b1-py3.2-linux-x86_64.egg/tornado/testing.py", line 603, in exit
raise Exception("did not get expected log message")
Exception: did not get expected log message

Ran 1014 tests in 16.726s
FAILED (errors=1, skipped=40)
Some tests were skipped because: CaresResolver doesn't recognize fake
NXDOMAIN, PEP 380 not available, dual-stack servers often have port
conflicts on travis, localhost does not resolve to ipv6, needs fix, no
testable future imports, timing tests unreliable on travis, twisted
module not present
[E 140627 04:54:30 testing:687] FAIL

# support request absolute-uri
# according to http://tools.ietf.org/html/rfc2616#section-5.1.2
if uri.startswith(('http', 'https')):
parsed_url = urlparse(uri)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do something to make the rest of the parsed url available. RFC 2616 section 5.2 says that the Host header should be ignored when an absolute url is given and the host from this url should be used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants