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
SimpleHTTPServer serves files even if the URL has a trailing slash #61526
Comments
To reproduce:
Reproduced with 2.7.3, 3.2.3, and 3.3.0. I assume it's still there in trunk. |
I thought this was fixed (recently). Shall look again. Having the tests is the only hard part here. |
orsenthil, would that test work? Here the result of the test which is FAIL as planned (given the current issue). → ./python.exe Lib/test/test_httpservers.py test_header_buffering_of_send_error (main.BaseHTTPRequestHandlerTestCase) ... ok test_get (main.SimpleHTTPServerTestCase) ... FAIL […] test_start_with_double_slash (main.SimpleHTTPRequestHandlerTestCase) ... ok ====================================================================== Traceback (most recent call last):
File "Lib/test/test_httpservers.py", line 254, in test_get
self.check_status_and_reason(response, 404, data=self.data)
File "Lib/test/test_httpservers.py", line 243, in check_status_and_reason
self.assertEqual(response.status, status)
AssertionError: 200 != 404 Ran 39 tests in 4.382s FAILED (failures=1)
Traceback (most recent call last):
File "Lib/test/test_httpservers.py", line 686, in <module>
test_main()
File "Lib/test/test_httpservers.py", line 680, in test_main
SimpleHTTPRequestHandlerTestCase,
File "/Users/karl/Documents/2011/cpython/Lib/test/support.py", line 1589, in run_unittest
_run_suite(suite)
File "/Users/karl/Documents/2011/cpython/Lib/test/support.py", line 1564, in _run_suite
raise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
File "Lib/test/test_httpservers.py", line 254, in test_get
self.check_status_and_reason(response, 404, data=self.data)
File "Lib/test/test_httpservers.py", line 243, in check_status_and_reason
self.assertEqual(response.status, status)
AssertionError: 200 != 404 [141593 refs] |
The attached test (issue-17324-test-1) reproduces the issue for me on 3.4.0alpha. |
Attached the fix and the unit test for this problem. |
New changeset a58b620e4dc9 by Senthil Kumaran in branch '2.7': New changeset 1fcccbbe15e2 by Senthil Kumaran in branch '3.3': New changeset b85c9d2a5227 by Senthil Kumaran in branch 'default': |
Thanks for the patches, Vajrasky and Karl. Fixed in currently active (3.4,3.3 and 2.7) versions of python. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: