symlinks with python3 http.server.CGIHTTPRequestHandler

Kirill Ratkin kvratkin at yandex.ru
Tue Jan 11 06:43:51 EST 2022


Hi

Maybe you have some restrictions on file system level. Some selinux for 
example.


I try similar steps on my local 'linux mint' and ... linked script is 
called my http.server without errors.


Here is my 'tree':

├── cgi-bin
│   └── test.py -> ../orig.py
└── orig.py

All files are executable and test.py is link to orig.py which is in one 
directory level up:

$ ls -Rla
.:
total 16
drwxrwxr-x  3 kirill kirill 4096 Jan 11 14:04 .
drwxrwxrwt 23 root   root   4096 Jan 11 14:11 ..
drwxrwxr-x  2 kirill kirill 4096 Jan 11 14:03 cgi-bin
-rwxrwxr-x  1 kirill kirill   31 Jan 11 14:04 orig.py

./cgi-bin:
total 8
drwxrwxr-x 2 kirill kirill 4096 Jan 11 14:03 .
drwxrwxr-x 3 kirill kirill 4096 Jan 11 14:04 ..
lrwxrwxrwx 1 kirill kirill   10 Jan 11 14:03 test.py -> ../orig.py

I do 'curl' request:

curl -v http://0.0.0.0:8000/cgi-bin/test.py

And http.server get log:

$ python3 -m http.server --cgi 8000
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [11/Jan/2022 14:40:19] "GET /cgi-bin/test.py HTTP/1.1" 200 -


On 1/10/22 22:10, Nat Taylor wrote:
> python3 -m http.server --cgi 8090


More information about the Python-list mailing list