apache-2.4 mod_wsgi とこの単純な wsgi スクリプトを使用してテストを行いました。
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
yield str(environ)
そして、少なくともこの mod_wsgi では、ポートを取得しますenviron['REMOTE_PORT']
。
の完全なコンテンツは次のenviron
とおりです。
{
'mod_wsgi.listener_port':'80',
'mod_wsgi.listener_host':'',
'CONTEXT_DOCUMENT_ROOT':'/usr/htdocs',
'SERVER_SOFTWARE':'Apache',
'SCRIPT_NAME':'',
'mod_wsgi.enable_sendfile':'0',
'mod_wsgi.handler_script':'',
'SERVER_SIGNATURE':'<address>Apache Server at 127.0.0.1 Port 80</address>\n',
'REQUEST_METHOD':'GET',
'PATH_INFO':'/',
'SERVER_PROTOCOL':'HTTP/1.1',
'QUERY_STRING':'',
'HTTP_USER_AGENT':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.58 Safari/537.36',
'HTTP_CONNECTION':'keep-alive',
'SERVER_NAME':'127.0.0.1',
'REMOTE_ADDR':'127.0.0.1',
'mod_wsgi.queue_start':'1409123400512619',
'mod_wsgi.request_handler':'wsgi-script',
'apache.version':(2, 4, 10),
'wsgi.url_scheme':'http',
'PATH_TRANSLATED':'/opt/wsgi/wsgi.py/',
'SERVER_PORT':'80',
'wsgi.multiprocess':True,
'mod_wsgi.input_chunked':'0',
'SERVER_ADDR':'127.0.0.1',
'DOCUMENT_ROOT':'/usr/htdocs',
'mod_wsgi.process_group':'wsgi_local',
'mod_wsgi.daemon_connects':'1',
'SCRIPT_FILENAME':'/opt/wsgi/wsgi.py',
'SERVER_ADMIN':'[no address given]',
'wsgi.input':<mod_wsgi.Input object at 0x7fd6fc5d24b0>,
'HTTP_HOST':'127.0.0.1',
'CONTEXT_PREFIX':'',
'wsgi.multithread':True,
'mod_wsgi.callable_object':'application',
'HTTP_CACHE_CONTROL':'max-age=0',
'mod_wsgi.daemon_restarts':'0',
'REQUEST_URI':'/',
'HTTP_ACCEPT':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'wsgi.file_wrapper':<type 'mod_wsgi.FileWrapper'>,
'wsgi.version':(1, 0),
'GATEWAY_INTERFACE':'CGI/1.1',
'wsgi.run_once':False,
'wsgi.errors':<mod_wsgi.Log object at 0x7fd6fc5e8930>,
'REMOTE_PORT':'32915',
'HTTP_ACCEPT_LANGUAGE':'fr,en-US;q=0.8,en;q=0.6',
'REQUEST_SCHEME':'http',
'mod_wsgi.version':(4,2,7),
'mod_wsgi.script_start':'1409123400512718',
'mod_wsgi.application_group':'127.0.0.1|',
'mod_wsgi.script_reloading':'1',
'mod_wsgi.request_start':'1409123400512528',
'HTTP_ACCEPT_ENCODING':'gzip,deflate,sdch',
'UNIQUE_ID':'U-2ESH8AAAEAACYQU@MAAABE',
'mod_wsgi.daemon_start':'1409123400512693'
}