Skip to content

Fix ResourceWarning on CONNECT with Python < 3.11.4 #3252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 14, 2024

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Dec 31, 2023

This PR backports the fix from python/cpython#103472 in 3.11.4 so that the last ignored ResourceWarnings are no longer issued by urllib3

Closes #3374

@graingert graingert force-pushed the backport-tunnel-from-3-11-4 branch from 15ad8cd to 7d5ee4b Compare January 3, 2024 14:15
@graingert graingert changed the title backport HTTPConnection._tunnel from 3.11.4 backport HTTPConnection._tunnel from 3.11.4 to unignore remaining ResourceWarnings Jan 3, 2024
@graingert graingert force-pushed the backport-tunnel-from-3-11-4 branch from 6b462dc to 42e444f Compare January 7, 2024 18:05
@graingert graingert marked this pull request as ready for review January 7, 2024 18:05
@sethmlarson
Copy link
Member

@graingert I would love to avoid bundling the _tunnel() implementation if possible, instead what do you think about a conditional filterwarnings for Python 3.11.3 or earlier so we're ensuring that all future versions continue to not emit those warnings?

@graingert
Copy link
Contributor Author

@sethmlarson but this is a warning emitted for users of urllib3 on 3.10 and I'd like the warning fixed for those people too

@pquentin pquentin changed the title backport HTTPConnection._tunnel from 3.11.4 to unignore remaining ResourceWarnings Fix ResourceWarning on CONNECT with Python < 3.11.4 Aug 13, 2024
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

@pquentin pquentin merged commit be24439 into urllib3:main Aug 14, 2024
36 checks passed
apereocas-bot referenced this pull request in apereo/cas Sep 13, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [urllib3](https://redirect.github.com/urllib3/urllib3) ([changelog](https://redirect.github.com/urllib3/urllib3/blob/main/CHANGES.rst)) | `==2.2.2` -> `==2.2.3` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>urllib3/urllib3 (urllib3)</summary>

### [`v2.2.3`](https://redirect.github.com/urllib3/urllib3/blob/HEAD/CHANGES.rst#223-2024-09-12)

[Compare Source](https://redirect.github.com/urllib3/urllib3/compare/2.2.2...2.2.3)

\==================

## Features

-   Added support for Python 3.13. (`#&#8203;3473 <https://github.com/urllib3/urllib3/issues/3473>`\__)

## Bugfixes

-   Fixed the default encoding of chunked request bodies to be UTF-8 instead of ISO-8859-1.
    All other methods of supplying a request body already use UTF-8 starting in urllib3 v2.0. (`#&#8203;3053 <https://github.com/urllib3/urllib3/issues/3053>`\__)
-   Fixed ResourceWarning on CONNECT with Python < 3.11.4 by backporting [https://github.com/python/cpython/issues/103472](https://redirect.github.com/python/cpython/issues/103472). (`#&#8203;3252 <https://github.com/urllib3/urllib3/issues/3252>`\__)
-   Adjust tolerance for floating-point comparison on Windows to avoid flakiness in CI (`#&#8203;3413 <https://github.com/urllib3/urllib3/issues/3413>`\__)
-   Fixed a crash where certain standard library hash functions were absent in restricted environments. (`#&#8203;3432 <https://github.com/urllib3/urllib3/issues/3432>`\__)
-   Fixed mypy error when adding to `HTTPConnection.default_socket_options`. (`#&#8203;3448 <https://github.com/urllib3/urllib3/issues/3448>`\__)

## HTTP/2 (experimental)

HTTP/2 support is still in early development.

-   Excluded Transfer-Encoding: chunked from HTTP/2 request body (`#&#8203;3425 <https://github.com/urllib3/urllib3/issues/3425>`\__)
-   Added version checking for `h2` (https://pypi.org/project/h2/) usage.

    Now only accepting supported h2 major version 4.x.x. (`#&#8203;3290 <https://github.com/urllib3/urllib3/issues/3290>`\__)
-   Added a probing mechanism for determining whether a given target origin
    supports HTTP/2 via ALPN. (`#&#8203;3301 <https://github.com/urllib3/urllib3/issues/3301>`\__)
-   Add support for sending a request body with HTTP/2 (`#&#8203;3302 <https://github.com/urllib3/urllib3/issues/3302>`\__)

## Deprecations and Removals

-   Note for downstream distributors: the `_version.py` file has been removed and is now created at build time by hatch-vcs. (`#&#8203;3412 <https://github.com/urllib3/urllib3/issues/3412>`\__)
-   Drop support for end-of-life PyPy3.8 and PyPy3.9. (`#&#8203;3475 <https://github.com/urllib3/urllib3/issues/3475>`\__)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 6am every weekday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/apereo/cas).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6WyJCb3QiLCJSZW5vdmF0ZSJdfQ==-->
lqiu96 referenced this pull request in googleapis/sdk-platform-java Sep 16, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [urllib3](https://redirect.github.com/urllib3/urllib3)
([changelog](https://redirect.github.com/urllib3/urllib3/blob/main/CHANGES.rst))
| `==2.2.2` -> `==2.2.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>urllib3/urllib3 (urllib3)</summary>

###
[`v2.2.3`](https://redirect.github.com/urllib3/urllib3/blob/HEAD/CHANGES.rst#223-2024-09-12)

[Compare
Source](https://redirect.github.com/urllib3/urllib3/compare/2.2.2...2.2.3)

\==================

## Features

- Added support for Python 3.13. (`#&#8203;3473
<https://github.com/urllib3/urllib3/issues/3473>`\__)

## Bugfixes

- Fixed the default encoding of chunked request bodies to be UTF-8
instead of ISO-8859-1.
All other methods of supplying a request body already use UTF-8 starting
in urllib3 v2.0. (`#&#8203;3053
<https://github.com/urllib3/urllib3/issues/3053>`\__)
- Fixed ResourceWarning on CONNECT with Python < 3.11.4 by backporting
[https://github.com/python/cpython/issues/103472](https://redirect.github.com/python/cpython/issues/103472).
(`#&#8203;3252 <https://github.com/urllib3/urllib3/issues/3252>`\__)
- Adjust tolerance for floating-point comparison on Windows to avoid
flakiness in CI (`#&#8203;3413
<https://github.com/urllib3/urllib3/issues/3413>`\__)
- Fixed a crash where certain standard library hash functions were
absent in restricted environments. (`#&#8203;3432
<https://github.com/urllib3/urllib3/issues/3432>`\__)
- Fixed mypy error when adding to
`HTTPConnection.default_socket_options`. (`#&#8203;3448
<https://github.com/urllib3/urllib3/issues/3448>`\__)

## HTTP/2 (experimental)

HTTP/2 support is still in early development.

- Excluded Transfer-Encoding: chunked from HTTP/2 request body
(`#&#8203;3425 <https://github.com/urllib3/urllib3/issues/3425>`\__)
- Added version checking for `h2` (https://pypi.org/project/h2/) usage.

Now only accepting supported h2 major version 4.x.x. (`#&#8203;3290
<https://github.com/urllib3/urllib3/issues/3290>`\__)
- Added a probing mechanism for determining whether a given target
origin
supports HTTP/2 via ALPN. (`#&#8203;3301
<https://github.com/urllib3/urllib3/issues/3301>`\__)
- Add support for sending a request body with HTTP/2 (`#&#8203;3302
<https://github.com/urllib3/urllib3/issues/3302>`\__)

## Deprecations and Removals

- Note for downstream distributors: the `_version.py` file has been
removed and is now created at build time by hatch-vcs. (`#&#8203;3412
<https://github.com/urllib3/urllib3/issues/3412>`\__)
- Drop support for end-of-life PyPy3.8 and PyPy3.9. (`#&#8203;3475
<https://github.com/urllib3/urllib3/issues/3475>`\__)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/googleapis/sdk-platform-java).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
ldetmer referenced this pull request in googleapis/sdk-platform-java Sep 17, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [urllib3](https://redirect.github.com/urllib3/urllib3)
([changelog](https://redirect.github.com/urllib3/urllib3/blob/main/CHANGES.rst))
| `==2.2.2` -> `==2.2.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/urllib3/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/urllib3/2.2.2/2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>urllib3/urllib3 (urllib3)</summary>

###
[`v2.2.3`](https://redirect.github.com/urllib3/urllib3/blob/HEAD/CHANGES.rst#223-2024-09-12)

[Compare
Source](https://redirect.github.com/urllib3/urllib3/compare/2.2.2...2.2.3)

\==================

## Features

- Added support for Python 3.13. (`#&#8203;3473
<https://github.com/urllib3/urllib3/issues/3473>`\__)

## Bugfixes

- Fixed the default encoding of chunked request bodies to be UTF-8
instead of ISO-8859-1.
All other methods of supplying a request body already use UTF-8 starting
in urllib3 v2.0. (`#&#8203;3053
<https://github.com/urllib3/urllib3/issues/3053>`\__)
- Fixed ResourceWarning on CONNECT with Python < 3.11.4 by backporting
[https://github.com/python/cpython/issues/103472](https://redirect.github.com/python/cpython/issues/103472).
(`#&#8203;3252 <https://github.com/urllib3/urllib3/issues/3252>`\__)
- Adjust tolerance for floating-point comparison on Windows to avoid
flakiness in CI (`#&#8203;3413
<https://github.com/urllib3/urllib3/issues/3413>`\__)
- Fixed a crash where certain standard library hash functions were
absent in restricted environments. (`#&#8203;3432
<https://github.com/urllib3/urllib3/issues/3432>`\__)
- Fixed mypy error when adding to
`HTTPConnection.default_socket_options`. (`#&#8203;3448
<https://github.com/urllib3/urllib3/issues/3448>`\__)

## HTTP/2 (experimental)

HTTP/2 support is still in early development.

- Excluded Transfer-Encoding: chunked from HTTP/2 request body
(`#&#8203;3425 <https://github.com/urllib3/urllib3/issues/3425>`\__)
- Added version checking for `h2` (https://pypi.org/project/h2/) usage.

Now only accepting supported h2 major version 4.x.x. (`#&#8203;3290
<https://github.com/urllib3/urllib3/issues/3290>`\__)
- Added a probing mechanism for determining whether a given target
origin
supports HTTP/2 via ALPN. (`#&#8203;3301
<https://github.com/urllib3/urllib3/issues/3301>`\__)
- Add support for sending a request body with HTTP/2 (`#&#8203;3302
<https://github.com/urllib3/urllib3/issues/3302>`\__)

## Deprecations and Removals

- Note for downstream distributors: the `_version.py` file has been
removed and is now created at build time by hatch-vcs. (`#&#8203;3412
<https://github.com/urllib3/urllib3/issues/3412>`\__)
- Drop support for end-of-life PyPy3.8 and PyPy3.9. (`#&#8203;3475
<https://github.com/urllib3/urllib3/issues/3475>`\__)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/googleapis/sdk-platform-java).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclosed socket warning after HTTP 407 response from HTTP CONNECT proxy
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy