Python3.9的http.client.py下的HTTPMessage类中的方法getallmatchingheaders的bug修复建议详解编程语言
2023-06-13 09:11:52 时间
在官方网站已经提交相关issue,不过目前看好像还没有修复。具体的bug位置为:
http文件夹下的client.py文件,代码位置为:类HTTPMessage下的方法getallmatchingheaders
源代码如下:
def getallmatchingheaders(self, name): """Find all header lines matching a given header name. Look through the list of headers and find all lines matching a given header name (and their continuation lines). A list of the lines is returned, without interpretation. If the header does not occur, an empty list is returned. If the header occurs multiple times, all occurrences are returned. Case is not important in the header name. """ name = name.lower() + : n = len(name) lst = [] hit = 0 for line in self.keys(): if line[:n].lower() == name: hit = 1 elif not line[:1].isspace(): hit = 0 if hit: lst.append(line) return lst
修改后代码如下:
1 def getallmatchingheaders(self, name): 2 """Find all header lines matching a given header name. 4 Look through the list of headers and find all lines matching a given 5 header name (and their continuation lines). A list of the lines is 6 returned, without interpretation. If the header does not occur, an 7 empty list is returned. If the header occurs multiple times, all 8 occurrences are returned. Case is not important in the header name. 10 """ 11 name = name.lower() 12 n = len(name) 13 lst = [] 14 hit = 0 15 for line,value in self.items(): 16 if line[:n].lower() == name: 17 hit = 1 18 elif not line[:1].isspace(): 19 hit = 0 20 if hit: 21 lst.append(line+:+value) 22 return lst
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19728.html
cjavapython相关文章
- 解决windowlocationhref不跳转的 BUG「建议收藏」
- 我和周鸿祎都发现了《三体》中计算机相关的bug!
- php中关于strtotime函数31日取前几个月日期的BUG
- PyTorch + NumPy这么做会降低模型准确率,这是bug还是预期功能?
- 因存在诸多BUG 微软暂停Edge浏览器“启动增强”功能
- Nginx 主线版 1.14.0 发布:Bug修复版本
- 谷歌修复了FFmpeg中上千个bug
- 攻击者入侵 Bugzilla 访问未公开 bug
- 每日安全资讯:Mozilla 为 Firefox 上周的 bug 致歉
- WordPress 插件 bug 允许攻击者远程重置网站内容
- Oracle临时表BUG 遭遇不测崩溃惊魂(oracle临时表bug)
- Oracle Bug深度剖析以及解决方案(oracle bug说明)
- Oracle Bug问题总结修复折中求取完美(oracle bug汇总)
- Oracle Bug查找新姿势终极突破(oracle bug查找)
- jQueryValidation插件remote验证方式的Bug解决
- jQuery在IE下使用未闭合的xml代码创建元素时的Bug介绍
- 关于在IE下的一个安全BUG--可用于跟踪用户的系统鼠标位置
- JQuery操作Select的Options的Bug(IE8兼容性视图模式)
- jQuery前端框架easyui使用Dialog时bug处理