Skip to content

bpo-28707: Add the directory parameter to http.server.SimpleHTTPRequestHandler and http.server module #1776

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

Merged
merged 2 commits into from
May 24, 2017

Conversation

matrixise
Copy link
Member

We can specify a directory when we call http.server as a script with --directory
python -m http.server --directory /tmp

@mention-bot
Copy link

@matrixise, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @orsenthil and @benjaminp to be potential reviewers.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, but it seems like tests fail at least on Windows.

@vstinner
Copy link
Member

Test failed on Windows (Appveyor):

======================================================================
ERROR: test_windows_colon (test.test_httpservers.SimpleHTTPRequestHandlerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_httpservers.py", line 1079, in test_windows_colon
    path = self.handler.translate_path('c:c:c:foo/filename')
  File "C:\projects\cpython\lib\http\server.py", line 816, in translate_path
    path = self.directory
AttributeError: 'SocketlessRequestHandler' object has no attribute 'directory'
----------------------------------------------------------------------```

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, there is just a dummy doc warning that has to be fixed.

@@ -139,6 +139,11 @@ If-Modified-Since header. The server returns the 304 response status if the
target file was not modified after the time specified in the header.
(Contributed by Pierre Quentel in :issue:`29654`.)

Add the parameter `directory` to the :class:`~http.server.SimpleHTTPRequestHandler`
Copy link
Member

Choose a reason for hiding this comment

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

It seems like the docs job failed because of a warning on this line.

@vstinner vstinner merged commit a17a2f5 into python:master May 24, 2017
@vstinner
Copy link
Member

test_site failed on AppVeyor. I hopz that it's unrelated ;-)

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

Successfully merging this pull request may close these issues.

4 participants