This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: http.client not allowing non-ascii in headers
Type: Stage:
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: xtreak, yellalena
Priority: normal Keywords:

Created on 2020-08-28 21:04 by yellalena, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg376047 - (view) Author: Aliona Matveeva (yellalena) Date: 2020-08-28 21:04
http.client trying to decode any header with 'latin-1', which fails when there is any non-ascii symbols in it, for example, Cyrillic. 

I propose to check if it's non-ascii and then decode it with 'utf-8', works perfectly.
msg376060 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-08-29 12:51
Can you please add a short script explaining the problem? There were some recent security issues fixed in http.client disallowing non-ascii headers issue39603
msg376066 - (view) Author: Aliona Matveeva (yellalena) Date: 2020-08-29 14:45
hi Karthikeyan Singaravelan!
I'm working with a russian database called 1C. it's pretty popular here in Russia, and its 'twist' is that everything there (I mean code) is written in Russian, i.e. cyrillic. So it's obvious and normal that the request/response coming from 1C base could contain non-ascii characters in its parts. Particularly, my case was that the header has a header containing info on called method, which value was "http://www.1c-bitrix.ru#SVD_ВебСервис:GetEmployee". which causes the "'latin-1' codec cant encode characters in position 29-37: ordinal not in range(256)" exception every time I try to send a request there. I tested locally, and same happening if I'm trying to add a Cyrillic header when creating a request/response in Python.
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85824
2020-08-29 14:45:16yellalenasetmessages: + msg376066
2020-08-29 12:51:35xtreaksetnosy: + xtreak
messages: + msg376060
2020-08-28 21:04:14yellalenacreate