python - centos 7.2 python 2.7.5 WSGIServer 无法传递 key 文件参数

标签 python ssl centos gevent

专家。

我正在使用 ssl 制作一个 python 服务器。 所以,我正在使用 gevent.pywsgi.WSGIServer。 但是当我尝试传递 key 文件时,它不会传递给 _ssl.c,它是 python 的 c 库。

我的代码在下面..

rack.append(WSGIServer(('', conf.ssl_port), application, backlog=2500,  
                    keyfile=conf.keyfile, certfile=conf.certfile))  

当然,keyfile 有正确的值。但是当在 _ssl.c 的代码中达到这一点时

load_cert_chain_args

在该函数的 PyString_Check for keyfile argumnet 上出现段错误。 (您可以确认/Python-2.7.5/Module/_ssl.c + 2695 行)。

当我确认 load_cert_chain_args 的 key 文件 arg 时,我可以看到这个日志。

keyfile=keyfile@entry=(远程 0xd231d4 未知)

但是当我确认这段内存的值(value)时。

x/s 0xd231d4L:“正确的字符串在这里”

我不知道为什么会这样......虽然在内存中有关于 key 文件的正确值。

如果这是可分页的问题..也许我无法使用 gdb 看到 key 文件值。

但我不知道为什么 _ssl.c 的 load_cert_chain 会产生 Segmemtation 错误(PyString_Check(keyfile))。

虽然我可以看到内存中的值,但我不知道为什么 gdb 在远程日志中仍然未知。

我在 Centos 7 上使用 Python 2.7.5 并使用 python-gevent 1.0-2.el7)。

谢谢。

最佳答案

终于找到答案了。

当我使用安装在 CentOS 7.2 中的 Python 2.7.5-34 时,

将纯字符串而不是 PyObject 传递给 _ssl.c python c 模块。

为了解决我的问题,下面的链接真的很有帮助。

https://github.com/gevent/gevent/issues/702

谢谢!

关于python - centos 7.2 python 2.7.5 WSGIServer 无法传递 key 文件参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36861051/

相关文章:

java - 使用 commons-mail 在 Java 中发送电子邮件

database - 使用 psql 安装并连接到数据库

linux - 我如何在Linux中为root设置假脱机电子邮件的读取权限

扫描 AWS S3 时,Python 线程池比 Go 例程更快?

python - 正则表达式进一步检查

python - 用python解析棘手的字符串

python - 查询中的 Django 问题

node.js - 在 Node/express 上安装 RapidSSL 证书

php - ssl 网站上的 WordPress 不安全内容

wordpress - 无法在 Wordpress 的 wp-content/uploads 中创建目录