为什么 URLLib2 不支持持久连接? [英] Why aren't persistent connections supported by URLLib2?

查看:32
本文介绍了为什么 URLLib2 不支持持久连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

扫描urllib2源后,似乎即使您指定了keep-alive,连接也会自动关闭.

After scanning the urllib2 source, it seems that connections are automatically closed even if you do specify keep-alive.

这是为什么?

现在我只使用 httplib 作为我的持久连接......但想知道为什么在 urllib2 中禁用(或者可能只是模棱两可).

As it is now I just use httplib for my persistent connections... but wonder why this is disabled (or maybe just ambiguous) in urllib2.

推荐答案

这是众所周知的 urllib2(以及 urllib)限制.恕我直言,迄今为止修复它并使其正确的最佳尝试是 Garry Bodsworth 的 coda_network for Python 2.6或 2.7 -- urllib2(和一些其他模块)的替换、修补版本以支持保持活动(以及其他一些较小但非常受欢迎的修复).

It's a well-known limit of urllib2 (and urllib as well). IMHO the best attempt so far to fix it and make it right is Garry Bodsworth's coda_network for Python 2.6 or 2.7 -- replacement, patched versions of urllib2 (and some other modules) to support keep-alive (and a bunch of other smaller but quite welcome fixes).

这篇关于为什么 URLLib2 不支持持久连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆