Reading a client's header from Python CGI script?

前端 未结 4 2141
我在风中等你
我在风中等你 2021-02-12 20:21

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:32

    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.

提交回复
热议问题