integ/python/python-requests/centos/patches/0001-close-connection-on-HTTP-413-Request-Entit.patch
chendongqi be8e0dfa61 CentOS 8: Upgrade python-requests to version 2.20.0
(1)Release Version Upgrade
(2)Matching code changes with el7 to el8

This package actually comes from the openstack package repo [0]
and the correct version is 2.21.0-3.
Since the CentOS folks have not created a cloud repo yet.
Ultimately this will need to be a python3 version.
We will need to rename the package to python3-requests.

[0] http://vault.centos.org/7.7.1908/cloud/Source/openstack-stein/

Story: 2006729
Task: 37659
Depends-On: https://review.opendev.org/#/c/696481/
Depends-On: https://review.opendev.org/#/c/696050/
Change-Id: I8544995320fa440074554c6fdf0e1143bf68b582
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
2019-12-16 15:56:07 +08:00

48 lines
1.8 KiB
Diff

From 268a1f179e554027637bd2951b24ad44ecb4a1ee Mon Sep 17 00:00:00 2001
From: Daniel Badea <daniel.badea@windriver.com>
Date: Wed, 7 Sep 2016 09:10:10 +0000
Subject: [PATCH] close connection on HTTP 413 Request Entity Too
Large
Allow low_conn to retrieve/handle unread response data buffers
in case ProtocolError or socket.error are raised while sending
request data.
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
---
requests/adapters.py | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/requests/adapters.py b/requests/adapters.py
index fd46325..087258a 100644
--- a/requests/adapters.py
+++ b/requests/adapters.py
@@ -466,12 +466,18 @@ class HTTPAdapter(BaseAdapter):
low_conn.endheaders()
- for i in request.body:
- low_conn.send(hex(len(i))[2:].encode('utf-8'))
- low_conn.send(b'\r\n')
- low_conn.send(i)
- low_conn.send(b'\r\n')
- low_conn.send(b'0\r\n\r\n')
+ try:
+ for i in request.body:
+ low_conn.send(hex(len(i))[2:].encode('utf-8'))
+ low_conn.send(b'\r\n')
+ low_conn.send(i)
+ low_conn.send(b'\r\n')
+ low_conn.send(b'0\r\n\r\n')
+ except (ProtocolError, socket.error) as err:
+ # allow low_conn to retrieve/handle unread response
+ # data buffers in case ProtocolError or socket.error
+ # are raised while sending request data
+ pass
# Receive the response from the server
try:
--
1.8.3.1