Python3.9的http.client.py下的HTTPMessage类中的方法getallmatchingheaders的bug修复建议
在官方网站已经提交相关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.
3
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.
9
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
Python3.9的http.client.py下的HTTPMessage类中的方法getallmatchingheaders的bug修复建议的更多相关文章
- VC++下封装ADO类以及使用方法
操作系统:windows 7软件环境:visual studio 2008 .Microsoft SQL 2005本次目的:介绍一个已经封装的ADO类,简单说明怎么导入使用 首先声明一下,这个封装的A ...
- .Net core 下的ConfigurationManager类正确引用方法
大家在项目中经常会用到需要引用配置文件的情况,这也是我偶然间遇到的问题,菜鸟一枚,如有需纠正多谢指点. 正题 在不先引用using的情况下直接写 ConfigurationManager.AppSet ...
- python client.py
vi /Library/Frameworks/Python.framework/Versions//http/client.py vi /Library/Frameworks/Python.frame ...
- python3 安装scrapy Exception: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1006, in check_if_exists解决方法
错误代码: Exception: Traceback (most recent call last): File , in check_if_exists self.satisfied_by = pk ...
- Python3实现ICMP远控后门(下)之“Boss”出场
ICMP后门 前言 第一篇:Python3实现ICMP远控后门(上) 第二篇:Python3实现ICMP远控后门(上)_补充篇 第三篇:Python3实现ICMP远控后门(中)之"嗅探&qu ...
- client模式下对应接口加入桥接出错
client模式下,响应的接口wlan0 加入桥接时出现如下错误: root@root:~# brctl addif br-lan wlan0brctl: bridge br-lan: Operati ...
- 一、在windows环境下修改pip镜像源的方法(以python3为例)
在windows环境下修改pip镜像源的方法(以python3为例) 1.在windows文件管理器中,输入 %APPDATA% 2.会定位到一个新的目录下,在该目录下新建pip文件夹,然后到pip文 ...
- httprunner3源码解读(3)client.py
源码目录结构 ApiResponse 这个类没啥好说的 class ApiResponse(Response): """ 继承了requests模块中的Response类 ...
- MAC下 mysql不能插入中文和中文乱码的问题总结
MAC下 mysql不能插入中文和中文乱码的问题总结 前言 本文中所提到的问题解决方案,都是基于mac环境下的,但其他环境,比如windows应该也适用. 问题描述 本文解决下边两个问题: 往mysq ...
随机推荐
- Java带Body内容的Http请求
使用Java进行Http请求: package test2; import com.mashape.unirest.http.HttpResponse; import com.mashape.unir ...
- 2020年3月16日第一天,今天计划学习:K8S Kubeadm 1.14的完美部署
------------恢复内容开始------------ 一.部署docker 1. 部署docker容器虚拟化平台并配置docker的环境 下载新的yum配置文件 wget http://m ...
- Spark的RPC
Spark 的 RPC 什么是RPC 在Spark中很多地方都涉及网络通信,比如Spark各个组件间的消息互通.用户文件与Jar包的上传.节 点间的Shuffle过程.Block数据的复制与备份等. ...
- 网站开发学习Python实现-Django项目部署-介绍(6.2.1)
@ 目录 1.第一步:找源码 2.第二步:在windows中更改代码 2.第三步:同步到linux中 3.第三步:部署 4.第四步:运行 关于作者 1.第一步:找源码 从github上找一个djang ...
- 安装nodejs 版本控制器
安装下载地址: https://pan.baidu.com/s/1Ed_IPDTOHxR9NShUEau-ZA 下载好后,放在安装nodejs的文件夹下 然后敲cmd,进入安装nodejs的文件夹下. ...
- FFmpeg 初级使用
ffmpeg来处理多种媒体文件,对帧进行操作的时候非常的复杂,下面介绍下使用FFmpeg对视频文件的操作. 1,安装 windows安装ffmpeg: 下载ffmpeg文件解压文件到c盘配置环境变量C ...
- 配置redis服务器允许远程连接
说明 默认情况下,redis只允许本机访问.如果需要外部访问,需要修改下配置文件. 配置修改 redis.windows.conf 将bind 127.0.0.1 注释 将protected-mode ...
- mybatis实现MySQL数据库的增删改查之二
这里直接附上代码: 1 package com.qijian.pojo; 2 3 import org.apache.ibatis.type.Alias; 4 5 6 public class Use ...
- [LeetCode]42. Trapping Rain Water雨水填坑
这个题难点在于无法保证右边是不是有更高的墙可以保证挡住水 双指针可以解决 /* 两边指针保证,保证另外一边肯定有能挡住水的地方. 如果从一边开始,不考虑另一边,是无法保证右边肯定有挡水的墙,如果右边只 ...
- [leetcode] Add to List 74. Search a 2D Matrix
/** * Created by lvhao on 2017/8/1. * Write an efficient algorithm that searches for a value in an m ...