FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-159044: Restore string conversion for HTTP tunnel headers by SomSamantray · Pull Request #159167 · python/cpython · GitHub

Repository navigation

gh-159044: Restore string conversion for HTTP tunnel headers - #159167

Closed
SomSamantray wants to merge 1 commit into
python:mainfrom
SomSamantray:issue-159044-tunnel-header-values
Closed

SomSamantray wants to merge 1 commit into
python:mainfrom
SomSamantray:issue-159044-tunnel-header-values

Conversation

SomSamantray commented Oct 11, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

HTTPSConnection.set_tunnel() regressed when it began calling .encode() directly on header names and values. Previously, formatting converted these values to strings, so values such as None and integers were accepted. Convert both names and values to strings before Latin-1 encoding, preserving that behavior and the existing CR/LF validation.

Fixes #159044

Tests

  • ./python -m test test_httplib -m test_tunnel_headers_are_converted_to_strings — passed.
  • ./python -m test test_httplib — passed (153 tests, 5 skipped).
  • ./python Tools/patchcheck/patchcheck.py — passed.
  • Full ./python -m test run: 449 test files passed, 96 skipped; failures were in test_os and test_pathlib mount/device assertions, test_socket VSOCK without a device, test_profiling (passed when rerun alone), and a shared-environment change reported by test_httpservers (passed alone).

AI tools assisted with investigation, implementation, and review. I reviewed the resulting changes.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35071091 | 📁 Comparing 2311723 against main (c6c0608)

  🔍 Preview build  

2 files changed
± library/http.client.html
± whatsnew/changelog.html

Copy link
Copy Markdown
Member

It is extremely rude to submit a PR after someone else has already done all the discussion, research, and asked to author the fix, especially if that someone is a first-time contributor. I'm closing this to give @bielpieroli a chance to work on a patch first.

Copy link
Copy Markdown
Contributor

Thank you, @ZeroIntensity, I really appreciate it.

Sorry for the late reply. To be honest, when I woke up and saw a PR was already open I felt a bit discouraged, so I stayed away and only saw the notifications now.

I'll start working on the patch right now with my partner @LorenaMBorges :D

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http.client.HTTPSConnection._tunnel raises AttributeError: 'NoneType' object has no attribute 'encode' when header value is None

3 participants


Back | FazBrowse Home | New Git URL