使用python

时间:2017-01-25 00:30:39

标签: apache python-2.7 mod-wsgi siteminder

我正在使用siteminder运行apache 2.4。我可以使用perl cgi脚本访问siteminder设置的某些变量。这些变量的示例是HTTP_SMUNIVERSALID,HTTP_SMUSERDN,HTTP_SMSERVERSESSIONID等。这是我的perl cgi脚本:

#!/usr/bin/perl
use CGI;
print CGI::header();

foreach my $key (sort(keys(%ENV))) {
    print "$key = $ENV{$key}<br>\n";
    }

我将我的apache配置为使用mod_wsgi运行python并且我的hello world应用程序按照说明here工作。我可以看到它通过它设置的cookie通过siteminder。但是我的脚本下面没有输出我能通过上面的PERL cgi脚本看到的siteminder变量。

import os

def application(environ, start_response):
    status = '200 OK'
    output = b'Hello World!\n'
    envs = ''
    for k, v in os.environ.items():
        envs = envs + str(k) + "=" + str(v) + "\n";
    output = output + envs
    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

0 个答案:

没有答案
相关问题