[issue38863] Improve is_cgi() in http.server

2019-12-04 Thread Siwon Kang


Siwon Kang  added the comment:

Obviously, I should have taken back what I added to cgi_directories. Thank you 
Pablo and Victor!

--

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] Improve is_cgi() in http.server

2019-11-20 Thread Siwon Kang


Siwon Kang  added the comment:

Hi Donghee,
Since you said this is not a bug, I changed the title describing this is a 
matter of improvement.

For your comment, I would say sorry first that I have made you confused. My 
mention about apache is just to give you an example for the other module that 
does similar thing(HTTP request handler with cgi support). I would never say 
the Python server shall support the sub-directory parsing for cgi scripts 
because apache does but I am saying good is good.

>> Yes, IMHO, but this code is related to the http.server.CGIHTTPRequestHandler.
This code looks like to be executed on the http.server.CGIHTTPRequestHandler 
not the apache server.

So you may see the PR changes the CGIHTTPRequestHandler class. Please refer to 
the code.

>> According to docs,
This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as 
containing CGI scripts.

This is the one I was looking at. As described, I added '/sub/dir/cgi-bin' into 
the cgi_directories expecting it to be treated the directory is for CGI scripts 
but the CGIHTTPRequestHandler does not process it. That is the reason for this 
issue report. Again, there is no note that restrict the path in cgi_directories 
shall be a single depth, so I think this will definitely give a benefit to 
handle the multi-level directories just like https://bugs.python.org/issue21323 
enables processing the sub directories of /cgi-bin.
Does this make sense to you now?

--
title: http.server is_cgi() does not correctly separate dir -> Improve is_cgi() 
in http.server
type: behavior -> enhancement

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
pull_requests:  -16785

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
pull_requests: +16800
pull_request: https://github.com/python/cpython/pull/17312

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Siwon Kang  added the comment:

Thank you for your message and the info about 21323. I agree with the idea that 
cgi files are conventionally placed at the cgi-bin of the root but there is no 
explicit regulation so other servers, apache for example, handle this kind of 
sub directories successfully. In short, there is no violation in the form of 
/subdir/cgi-bin so this is nice to have if the http.server processes this case 
correctly. By the way, I didn't consider the case of continuous slashes so PR 
must be modified.

--

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
keywords: +patch
pull_requests: +16785
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17292

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


New submission from Siwon Kang :

is_cgi() in CGIHTTPRequestHandler class separates given path into (dir, rest) 
then checks if dir is in cgi_directories. However, it divides based on the 
first seen '/', multi-level directories like /sub/dir/cgi-bin/hello.py is 
divided into head=/sub, rest=dir/cgi-bin/hello.py then check whether '/sub' 
exists in cgi_directories = [..., '/sub/dir/cgi-bin'].
If the function divides by last seen '/', it works correctly as 
head=/sub/dir/cgi-bin, rest=hello.py

--
components: Library (Lib)
files: sample.tar.xz
messages: 357074
nosy: kkangshawn
priority: normal
severity: normal
status: open
title: http.server is_cgi() does not correctly separate dir
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48725/sample.tar.xz

___
Python tracker 
<https://bugs.python.org/issue38863>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com