james@CNU352DG8J ~]$ cd /tmp/SRV [james@CNU352DG8J SRV]$ python3 -m http.server --cgi & [1] 6006 [james@CNU352DG8J SRV]$ Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... [james@CNU352DG8J SRV]$ curl -sv http://localhost:8000/cgi-bin/demo.py | grep -A7 h1.cgi * Trying ::1:8000... * TCP_NODELAY set * connect to ::1 port 8000 failed: Connection refused * Trying 127.0.0.1:8000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8000 (#0) > GET /cgi-bin/demo.py HTTP/1.1 > Host: localhost:8000 > User-Agent: curl/7.66.0 > Accept: */* > 127.0.0.1 - - [22/Feb/2020 23:27:03] "GET /cgi-bin/demo.py HTTP/1.1" 200 - * Mark bundle as not supporting multiuse * HTTP 1.0, assume close after body < HTTP/1.0 200 Script output follows < Server: SimpleHTTP/0.6 Python/3.7.6 < Date: Sun, 23 Feb 2020 05:27:03 GMT < Status: 200 OK < Content-type: text/html; charset=utf-8 < { [610 bytes data] * Closing connection 0

cgi.parse()

{}
[james@CNU352DG8J SRV]$ curl -sv http://localhost:8000/cgi-bin/demo.py\?foo=inline | grep -A7 h1.cgi * Trying ::1:8000... * TCP_NODELAY set * connect to ::1 port 8000 failed: Connection refused * Trying 127.0.0.1:8000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8000 (#0) > GET /cgi-bin/demo.py?foo=inline HTTP/1.1 > Host: localhost:8000 > User-Agent: curl/7.66.0 > Accept: */* > 127.0.0.1 - - [22/Feb/2020 23:27:23] "GET /cgi-bin/demo.py?foo=inline HTTP/1.1" 200 - * Mark bundle as not supporting multiuse * HTTP 1.0, assume close after body < HTTP/1.0 200 Script output follows < Server: SimpleHTTP/0.6 Python/3.7.6 < Date: Sun, 23 Feb 2020 05:27:23 GMT < Status: 200 OK < Content-type: text/html; charset=utf-8 < { [627 bytes data] * Closing connection 0

cgi.parse()

{'foo': ['inline']}
[james@CNU352DG8J SRV]$ curl -sv http://localhost:8000/cgi-bin/demo.py -d foo=-d | grep -A7 h1.cgi * Trying ::1:8000... * TCP_NODELAY set * connect to ::1 port 8000 failed: Connection refused * Trying 127.0.0.1:8000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8000 (#0) > POST /cgi-bin/demo.py HTTP/1.1 > Host: localhost:8000 > User-Agent: curl/7.66.0 > Accept: */* > Content-Length: 6 > Content-Type: application/x-www-form-urlencoded > } [6 bytes data] * upload completely sent off: 6 out of 6 bytes 127.0.0.1 - - [22/Feb/2020 23:27:39] "POST /cgi-bin/demo.py HTTP/1.1" 200 - * Mark bundle as not supporting multiuse * HTTP 1.0, assume close after body < HTTP/1.0 200 Script output follows < Server: SimpleHTTP/0.6 Python/3.7.6 < Date: Sun, 23 Feb 2020 05:27:39 GMT < Status: 200 OK < Content-type: text/html; charset=utf-8 < { [623 bytes data] * Closing connection 0

cgi.parse()

{'foo': ['-d']}
[james@CNU352DG8J SRV]$ curl -sv http://localhost:8000/cgi-bin/demo.py -F foo=-F | grep -A7 h1.cgi * Trying ::1:8000... * TCP_NODELAY set * connect to ::1 port 8000 failed: Connection refused * Trying 127.0.0.1:8000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8000 (#0) > POST /cgi-bin/demo.py HTTP/1.1 > Host: localhost:8000 > User-Agent: curl/7.66.0 > Accept: */* > Content-Length: 140 > Content-Type: multipart/form-data; boundary=------------------------39a0c1df4849d8ab > } [140 bytes data] * We are completely uploaded and fine 127.0.0.1 - - [22/Feb/2020 23:27:46] "POST /cgi-bin/demo.py HTTP/1.1" 200 - * Mark bundle as not supporting multiuse * HTTP 1.0, assume close after body < HTTP/1.0 200 Script output follows < Server: SimpleHTTP/0.6 Python/3.7.6 < Date: Sun, 23 Feb 2020 05:27:46 GMT < Status: 200 OK < Content-type: text/html; charset=utf-8 < { [600 bytes data]

cgi.parse()


 --> -->
      
127.0.0.1 - - [22/Feb/2020 23:27:46] CGI script exit status 0x100 * Closing connection 0 [james@CNU352DG8J SRV]$