请教 eurasia3 的 webserver 们可以支持ssl吗

23 views
Skip to first unread message

ChuangBo

unread,
Jan 3, 2011, 10:58:49 AM1/3/11
to eurasia-users
打算使用 eurasia3 的 wsgiserver 直接处理请求,看了 3.1 的文档,没有看到有 https 相关部分,又翻了一下代码,也
没有看到,请问怎样使用呢?

Wilhelm Shen

unread,
Jan 4, 2011, 3:52:46 AM1/4/11
to eurasi...@googlegroups.com
3.1 中还没有实现 https 。

Cat

unread,
Jan 4, 2011, 4:53:01 AM1/4/11
to eurasi...@googlegroups.com
沈大侠有支持的计划吗?
我们打算在4月份上线的一个项目中使用 eurasia3 的 webserver,如果不能支持 https 就不可能使用了
看到 sock2 里面有 fakesslwrap ,不知道在 wsgiserver 里支持 https 复杂吗?
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“eurasia-users”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 eurasi...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 eurasia-user...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/eurasia-users?hl=zh-CN 访问此网上论坛。
>

沈崴

unread,
Jan 4, 2011, 8:52:31 AM1/4/11
to eurasia-users
3.1 在推出时并没有立即支持 HTTPS 的短期计划,主要原因是(除银行外)HTTPS 一般主要
用于登录的加密验证。在此情况下,可以自己通过诸如 RSA 加密等方式完成轻量级的加密验证。
感觉一般应用并不需要费事去购买 SSL 证书(直接使用 HTTPS 浏览器则会弹出安全警告)。

考虑短期内此类需求基本不大,因此将 HTTPS 作为中期目标。在 3.0 中实现的 HTTPS
(使用 pyOpenSSL)感觉还有较大改进空间,准备进一步完善以后加入 3.1 版。

目前的 sslwrap 主要是用于 socket 客户端,比如 urllib 等。在 3.1 中,如果需要在服务器端对所有
通讯做 HTTPS 加密,可以使用 apache 这样的服务器做 HTTPS 反向代理(这样无法得到 eurasia
的并发性能)。

欢迎大家继续提供意见,如果 HTTPS 在我们的项目中广泛应用,对大家普遍非常重要,我考虑将
这一功能提前(试验性提供)。

On Jan 4, 5:53 pm, Cat <i...@chuangbo.li> wrote:
> 沈大侠有支持的计划吗?
> 我们打算在4月份上线的一个项目中使用 eurasia3 的 webserver,如果不能支持 https 就不可能使用了
> 看到 sock2 里面有 fakesslwrap ,不知道在 wsgiserver 里支持 https 复杂吗?
>
> 在 2011-1-4,下午4:52, Wilhelm Shen 写道:
>
> > 3.1 中还没有实现 https 。
>

bawbaw hu

unread,
Jan 4, 2011, 7:34:40 PM1/4/11
to eurasi...@googlegroups.com
我也覺得HTTPS在項目中用到的不多,像沈大說的在登入時,我們自已使用 xxtea 及 Diffie-Hellman做為輕量的加密驗證。


Chuangbo Li

unread,
Jan 4, 2011, 8:53:23 PM1/4/11
to eurasi...@googlegroups.com
我们使用ssl的原因很简单,避免链接被重置,你们懂的

发自我的 iPhone

在 2011-1-5,8:35,bawbaw hu <bawb...@gmail.com> 写到:

沈崴

unread,
Jan 5, 2011, 3:00:38 AM1/5/11
to eurasia-users
我下周抽时间争取先发一个 https 服务器出来,大家一起评估一下,多提些意见,
等成熟以后合并到 eurasia 3.1 中吧 :)

On 1月5日, 上午1时53分, Chuangbo Li <i...@chuangbo.li> wrote:
> 我们使用ssl的原因很简单,避免链接被重置,你们懂的
>
> 发自我的 iPhone
>

> 在 2011-1-5,8:35,bawbaw hu <bawbaw...@gmail.com> 写到:


>
> 我也覺得HTTPS在項目中用到的不多,像沈大說的在登入時,我們自已使用 xxtea 及 Diffie-Hellman做為輕量的加密驗證。
>

Cat

unread,
Jan 5, 2011, 3:05:02 AM1/5/11
to eurasi...@googlegroups.com
感谢 :)

Wilhelm Shen

unread,
Jan 10, 2011, 1:21:01 AM1/10/11
to eurasia-users
这里实现了一个 https 服务器(见附件),类似于 eurasia.web.httpserver:

from https import httpserver, mainloop
#from eurasia.web import httpserver, mainloop

keyfile, certfile = 'server.key', 'server.crt'
#keyfile, certfile = 'server.pem', None
headers = [('Content-Type', 'text/plain')]

def handler(httpfile):
httpfile.start_response('200 OK', headers)
httpfile.sendall('hello world!')
httpfile.close()

httpd = httpserver(':8043', handler, keyfile, certfile)
httpd.start()
mainloop()

兼容 python2.6 以上版本,需要标准库 _ssl 模块。
欢迎大家使用,并提供意见,帮助完善 ssl 功能。

Tips: 使用标准库 _ssl 模块,每次建立 ssl 连接都需要读取 keyfile 和
certfile,因此有必要把这两个文件放到 /dev/shm 目录下。

在 2011年1月5日上午8:00,沈崴 <wile...@gmail.com> 寫道:
> 我下周抽时间争取先发一个 https 服务器出来,大家一起评估一下,多提些意见,
> 等成熟以后合并到 eurasia 3.1 中吧 :)

--
沈崴

https.py

ChuangBo

unread,
Apr 21, 2011, 4:38:55 AM4/21/11
to eurasi...@googlegroups.com
用 eurasia3 搭了个 sock server,因为有 ssl 的需求,仿照 https server 写了个 sslserver,同见附件,使用方法如下

from https import sslserver

...
tcpd = sslserver(':19571', handler, KEY, CERT)
...
https.py
Reply all
Reply to author
Forward
0 new messages