1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 22:56:15 +01:00

Merge pull request #1106 from M0ses/fix_resend_files_on_failure

reset "file current position" on errors
This commit is contained in:
Adrian Schröter 2022-08-18 14:10:07 +02:00 committed by GitHub
commit 04ffd0727c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -296,6 +296,9 @@ def http_request(method, url, headers=None, data=None, file=None):
# prompt user if we should trust the certificate
pool.trusted_cert_store.prompt_trust(cert, reason=e.reason)
if hasattr(data, 'seek'):
data.seek(0)
response = pool.urlopen(
method, urlopen_url, body=data, headers=headers,
preload_content=False, assert_same_host=assert_same_host
@ -307,6 +310,8 @@ def http_request(method, url, headers=None, data=None, file=None):
success = handler.set_request_headers_after_401(url, headers, response)
if success:
break
if hasattr(data, 'seek'):
data.seek(0)
response = pool.urlopen(method, urlopen_url, body=data, headers=headers, preload_content=False)
if response.status / 100 != 2: