[3.3] bpo-22928: Disabled HTTP header injections in http.client. by serhiy-storchaka · Pull Request #2817 · python/cpython

@serhiy-storchaka

@serhiy-storchaka

…lient.

Original patch by Demian Brecht..
(cherry picked from commit a112a8a)

@mention-bot

@vstinner

@serhiy-storchaka

vstinner


# the patterns for both name and value are more leniant than RFC
# definitions to allow for backwards compatibility
_is_legal_header_name = re.compile(rb'[^:\s][^:\r\n]*\Z').match

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 2.7 regex starts with \A. Is it useful?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. match() always matches from the start.

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.