[issue25433] whitespace in strip()/lstrip()/rstrip()

2018-04-11 Thread Oliver Urs Lenz
Oliver Urs Lenz <oliver.urs.l...@gmail.com> added the comment: Slightly tangential, but it would be great if the documentation of lstrip() and rstrip() could include an equivalent definition in terms of re.sub(), e.g.: lstrip(foo) == re.sub(r'(?u)\A\s*', '', foo) rstrip(foo) == re.sub(r'

[issue33181] SimpleHTTPRequestHandler shouldn't redirect to directories with code 301

2018-03-30 Thread Oliver Urs Lenz
Oliver Urs Lenz <oliver.urs.l...@gmail.com> added the comment: Yes, but Apache's redirect can be turned off, whereas this can't, so it seems unnecessarily limiting to force this on users. Note that most of the motivation given by Apache doesn't apply here: with my proposed simplification

[issue33181] SimpleHTTPRequestHandler shouldn't redirect to directories with code 301

2018-03-30 Thread Oliver Urs Lenz
Oliver Urs Lenz <oliver.urs.l...@gmail.com> added the comment: In fact, since we use os.path.join, we could remove that condition altogether: if os.path.isdir(path): for index in "index.html", "index.htm": index = os.path.join(path, index)

[issue33181] SimpleHTTPRequestHandler shouldn't redirect to directories with code 301

2018-03-30 Thread Oliver Urs Lenz
Oliver Urs Lenz <oliver.urs.l...@gmail.com> added the comment: That would definitely take the sting out of that permanent redirect. But I am still wondering why we redirect at all. Why not leave redirects to the user and do: if os.path.isdir(path): if not path.endswith('/'):

[issue33181] SimpleHTTPRequestHandler shouldn't redirect to directories with code 301

2018-03-29 Thread Oliver Urs Lenz
New submission from Oliver Urs Lenz <oliver.urs.l...@gmail.com>: SimpleHTTPRequestHandler.send_head() has this bit: if os.path.isdir(path): parts = urllib.parse.urlsplit(self.path) if not parts.path.endswith('/'): # redirect browser -