python / psf-infra-meta

Meta-repository for PSF backed or managed systems. Created mainly for the issue tracker :)
10 stars 9 forks source link

http.client bug when using SSLContext + transfer-encoding: chunked #101

Closed DiegoEPaez closed 3 years ago

DiegoEPaez commented 3 years ago

When using http.client such as in the following way:

`import http.client import json import ssl

certificate_file = 'file.pem' certificate_secret= 'pwd' host = 'hostname.mx'

context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain(certfile=certificate_file, password=certificate_secret)

connection = http.client.HTTPSConnection(host, port=443, context=context)

connection.request(method="POST", url=start_session, headers=headers, body=json.dumps(data))

response = connection.getresponse() print(response.status, response.reason) data = response.read() print(data)`

The first answer from the server is a response with the parameter " transfer-encoding: chunked". After which http.client sends a request to get the rest of the message but fails to obtain it, I believe because it is no longer applying the SSLContext.

matrixise commented 3 years ago

@pablogsal I don't have the access to this tracker, but this issue is unrelated to the PSF infra. Do you think you could close this one? Thanks

pablogsal commented 3 years ago

Unfortunately I don't have access either to close the issue.

pradyunsg commented 3 years ago

@ewdurbin should be able to.