Reading a client's header from Python CGI script?

前端 未结 4 655
南旧
南旧 2021-02-12 20:17

I\'m writing a very simple web service, written in Python and run as CGI on an Apache server.

According to Python docs (somewhere... I forgot where), I can use sys.stdin

4条回答
  •  醉话见心
    2021-02-12 20:24

    As this page explains, most HTTP request headers are made available to your CGI script via environment variables. Run cgi.test() instead of your script to see the environment (including HTTP request headers) shown back to your visiting browser.

提交回复
热议问题