Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: urllib3/urllib3
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.26.16
Choose a base ref
...
head repository: urllib3/urllib3
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.0.0
Choose a head ref
Loading
Showing with 13,502 additions and 10,536 deletions.
  1. +11 −12 .coveragerc
  2. +5 −5 .github/CODEOWNERS
  3. +1 −1 .github/FUNDING.yml
  4. +1 −1 .github/ISSUE_TEMPLATE/config.yml
  5. +19 −0 .github/PULL_REQUEST_TEMPLATE/release.md
  6. +4 −0 .github/SECURITY.md
  7. +3 −0 .github/codeql.yml
  8. +11 −0 .github/dependabot.yml
  9. +28 −0 .github/workflows/changelog.yml
  10. +104 −48 .github/workflows/ci.yml
  11. +35 −0 .github/workflows/codeql.yml
  12. +29 −0 .github/workflows/integration.yml
  13. +29 −0 .github/workflows/lint.yml
  14. +87 −0 .github/workflows/publish.yml
  15. +33 −0 .github/workflows/scorecards.yml
  16. +23 −0 .pre-commit-config.yaml
  17. +7 −1 .readthedocs.yml
  18. +0 −95 .travis.yml
  19. +368 −78 CHANGES.rst
  20. +0 −310 CONTRIBUTORS.txt
  21. +0 −5 MANIFEST.in
  22. +114 −0 README.md
  23. +0 −118 README.rst
  24. +1 −0 changelog/.gitignore
  25. +31 −0 changelog/README.rst
  26. +60 −0 ci/0001-Mark-100-Continue-tests-as-failing.patch
  27. +34 −0 ci/0002-Stop-relying-on-removed-DEFAULT_CIPHERS.patch
  28. +2 −2 ci/deploy.sh
  29. +0 −19 ci/downstream/botocore.sh
  30. +0 −9 ci/downstream/requests-requirements.txt
  31. +0 −20 ci/downstream/requests.sh
  32. +0 −23 ci/install.sh
  33. +0 −15 ci/run.sh
  34. +3 −1 ci/run_tests.sh
  35. +0 −21 ci/upload_coverage.sh
  36. +0 −8 codecov.yml
  37. +10 −18 dev-requirements.txt
  38. 0 docs/{images → _static}/banner.svg
  39. +13 −0 docs/_static/banner_github.svg
  40. +1 −0 docs/_static/dark-logo.svg
  41. +370 −150 docs/advanced-usage.rst
  42. +5 −0 docs/changelog.rst
  43. +48 −19 docs/conf.py
  44. +109 −33 docs/contributing.rst
  45. +14 −12 docs/index.rst
  46. +0 −7 docs/reference/contrib/appengine.rst
  47. +0 −2 docs/reference/contrib/index.rst
  48. +0 −7 docs/reference/contrib/ntlmpool.rst
  49. +3 −0 docs/reference/contrib/pyopenssl.rst
  50. +3 −0 docs/reference/contrib/securetransport.rst
  51. +1 −1 docs/reference/index.rst
  52. +4 −0 docs/reference/urllib3.connection.rst
  53. +2 −0 docs/reference/urllib3.connectionpool.rst
  54. +4 −2 docs/reference/urllib3.exceptions.rst
  55. +6 −0 docs/reference/urllib3.poolmanager.rst
  56. +3 −6 docs/reference/urllib3.request.rst
  57. +11 −0 docs/reference/urllib3.response.rst
  58. +2 −2 docs/reference/urllib3.util.rst
  59. +2 −1 docs/requirements.txt
  60. +2 −48 docs/sponsors.rst
  61. +407 −288 docs/user-guide.rst
  62. +315 −0 docs/v2-migration-guide.rst
  63. +0 −180 docs/v2-roadmap.rst
  64. +1 −1 dummyserver/certs/README.rst
  65. +128 −104 dummyserver/handlers.py
  66. +48 −0 dummyserver/https_proxy.py
  67. +26 −22 dummyserver/proxy.py
  68. +136 −46 dummyserver/server.py
  69. +166 −94 dummyserver/testcase.py
  70. +9 −0 mypy-requirements.txt
  71. +130 −0 notes/connection-lifecycle.md
  72. +28 −0 notes/public-and-private-apis.md
  73. +121 −101 noxfile.py
  74. +123 −0 pyproject.toml
  75. +1 −26 setup.cfg
  76. +0 −97 setup.py
  77. +89 −11 src/urllib3/__init__.py
  78. +173 −0 src/urllib3/_base_connection.py
  79. +242 −145 src/urllib3/_collections.py
  80. +77 −30 src/urllib3/{request.py → _request_methods.py}
  81. +3 −1 src/urllib3/_version.py
  82. +645 −288 src/urllib3/connection.py
  83. +436 −325 src/urllib3/connectionpool.py
  84. 0 src/urllib3/contrib/__init__.pyi
  85. +0 −36 src/urllib3/contrib/_appengine_environ.py
  86. +11 −100 src/urllib3/contrib/_securetransport/bindings.py
  87. +101 −23 src/urllib3/contrib/_securetransport/low_level.py
  88. +0 −314 src/urllib3/contrib/appengine.py
  89. +0 −121 src/urllib3/contrib/ntlmpool.py
  90. +217 −169 src/urllib3/contrib/pyopenssl.py
  91. +196 −203 src/urllib3/contrib/securetransport.py
  92. +52 −35 src/urllib3/contrib/socks.py
  93. +96 −95 src/urllib3/exceptions.py
  94. +0 −55 src/urllib3/exceptions.pyi
  95. +168 −97 src/urllib3/fields.py
  96. +0 −28 src/urllib3/fields.pyi
  97. +28 −37 src/urllib3/filepost.py
  98. +0 −16 src/urllib3/filepost.pyi
  99. +0 −5 src/urllib3/packages/__init__.py
  100. 0 src/urllib3/packages/__init__.pyi
  101. 0 src/urllib3/packages/backports/__init__.py
  102. +0 −51 src/urllib3/packages/backports/makefile.py
  103. +0 −1,021 src/urllib3/packages/six.py
  104. 0 src/urllib3/packages/six.pyi
  105. +0 −22 src/urllib3/packages/ssl_match_hostname/__init__.py
  106. +0 −4 src/urllib3/packages/ssl_match_hostname/__init__.pyi
  107. +0 −11 src/urllib3/packages/ssl_match_hostname/_implementation.pyi
  108. +211 −123 src/urllib3/poolmanager.py
  109. +2 −0 src/urllib3/py.typed
  110. +614 −306 src/urllib3/response.py
  111. +6 −11 src/urllib3/util/__init__.py
  112. +35 −48 src/urllib3/util/connection.py
  113. +12 −25 src/urllib3/util/proxy.py
  114. +0 −22 src/urllib3/util/queue.py
  115. 0 src/urllib3/util/queue.pyi
  116. +142 −29 src/urllib3/util/request.py
  117. +38 −44 src/urllib3/util/response.py
  118. +137 −209 src/urllib3/util/retry.py
  119. +264 −227 src/urllib3/util/ssl_.py
  120. +45 −46 src/urllib3/{packages/ssl_match_hostname/_implementation.py → util/ssl_match_hostname.py}
  121. +115 −56 src/urllib3/util/ssltransport.py
  122. +62 −51 src/urllib3/util/timeout.py
  123. +226 −185 src/urllib3/util/url.py
  124. +0 −32 src/urllib3/util/url.pyi
  125. +42 −0 src/urllib3/util/util.py
  126. +31 −60 src/urllib3/util/wait.py
  127. +198 −163 test/__init__.py
  128. 0 test/appengine/__init__.py
  129. +0 −78 test/appengine/conftest.py
  130. +0 −178 test/appengine/test_gae_manager.py
  131. +0 −66 test/appengine/test_urlfetch.py
  132. +0 −76 test/benchmark.py
  133. +224 −51 test/conftest.py
  134. +21 −19 test/contrib/test_pyopenssl.py
  135. +10 −8 test/contrib/test_pyopenssl_dependencies.py
  136. +19 −5 test/contrib/test_securetransport.py
  137. +164 −98 test/contrib/test_socks.py
  138. +26 −13 test/port_helpers.py
  139. +0 −63 test/socketpair_helper.py
  140. +169 −126 test/test_collections.py
  141. +7 −29 test/test_compatibility.py
  142. +198 −13 test/test_connection.py
  143. +197 −110 test/test_connectionpool.py
  144. +33 −11 test/test_exceptions.py
  145. +66 −48 test/test_fields.py
  146. +25 −37 test/test_filepost.py
  147. +9 −56 test/test_no_ssl.py
  148. +179 −77 test/test_poolmanager.py
  149. +17 −11 test/test_proxymanager.py
  150. +6 −7 test/test_queue_monkeypatch.py
  151. +435 −189 test/test_response.py
  152. +132 −86 test/test_retry.py
  153. +0 −471 test/test_retry_deprecated.py
  154. +211 −164 test/test_ssl.py
  155. +159 −100 test/test_ssltransport.py
  156. +424 −235 test/test_util.py
  157. +27 −25 test/test_wait.py
  158. +18 −10 test/tz_stub.py
  159. +98 −38 test/with_dummyserver/test_chunked_transfer.py
  160. +145 −0 test/with_dummyserver/test_connection.py
  161. +303 −196 test/with_dummyserver/test_connectionpool.py
  162. +506 −269 test/with_dummyserver/test_https.py
  163. +10 −9 test/with_dummyserver/test_no_ssl.py
  164. +331 −96 test/with_dummyserver/test_poolmanager.py
  165. +519 −207 test/with_dummyserver/test_proxy_poolmanager.py
  166. +798 −322 test/with_dummyserver/test_socketlevel.py
  167. +7 −0 towncrier.toml
23 changes: 11 additions & 12 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -2,28 +2,27 @@
source =
urllib3

omit =
*urllib3/packages/*
*urllib3/contrib/appengine.py
*urllib3/contrib/ntlmpool.py
*urllib3/contrib/pyopenssl.py
*urllib3/contrib/securetransport.py
*urllib3/contrib/_securetransport/*

[paths]
source =
src/urllib3
.tox/*/lib/python*/site-packages/urllib3
.tox\*\Lib\site-packages\urllib3
.tox/pypy*/site-packages/urllib3
*/urllib3
*\urllib3

[report]
omit =
src/urllib3/contrib/pyopenssl.py
src/urllib3/contrib/securetransport.py
src/urllib3/contrib/_securetransport/*

exclude_lines =
except ModuleNotFoundError:
except ImportError:
pass
import
raise
raise NotImplementedError
.* # Platform-specific.*
.*:.* # Python \d.*
.* # Abstract
.* # Defensive:
if (?:typing.)?TYPE_CHECKING:
^\s*?\.\.\.\s*$
10 changes: 5 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Restrict all files related to deploying to
# require lead maintainer approval.

.github/CODEOWNERS @sethmlarson @shazow
src/urllib3/_version.py @sethmlarson @shazow
setup.py @sethmlarson @shazow
ci/ @sethmlarson @shazow
.travis.yml @sethmlarson @shazow
.github/workflows/ @sethmlarson @pquentin @shazow
.github/CODEOWNERS @sethmlarson @pquentin @shazow
src/urllib3/_version.py @sethmlarson @pquentin @shazow
pyproject.toml @sethmlarson @pquentin @shazow
ci/ @sethmlarson @pquentin @shazow
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tidelift: pypi/urllib3
github: urllib3
open_collective: urllib3
custom: https://gitcoin.co/grants/65/urllib3
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: 📚 Documentation
url: https://urllib3.readthedocs.io/en/latest/
url: https://urllib3.readthedocs.io
about: Make sure you read the relevant docs
- name: ❓ Ask on StackOverflow
url: https://stackoverflow.com/questions/tagged/urllib3
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
* [ ] See if all tests, including integration, pass
* [ ] Get the release pull request approved by a [CODEOWNER](https://github.com/urllib3/urllib3/blob/main/.github/CODEOWNERS)
* [ ] Squash merge the release pull request with message "`Release <VERSION>`"
* [ ] Tag with X.Y.Z, push tag on urllib3/urllib3 (not on your fork, update `<REMOTE>` accordingly)
* Notice that the `<VERSION>` shouldn't have a `v` prefix (Use `1.26.6` instead of `v.1.26.6`)
* ```
git tag -s -a '<VERSION>' -m 'Release: <VERSION>'
git push <REMOTE> --tags
```
* [ ] Execute the `publish` GitHub workflow. This requires a review from a maintainer.
* [ ] Ensure that all expected artifacts are added to the new GitHub release. Should
be one `.whl`, one `.tar.gz`, and one `multiple.intoto.jsonl`. Update the GitHub
release to have the content of the release's changelog.
* [ ] Announce on:
* [ ] Twitter
* [ ] Discord
* [ ] OpenCollective
* [ ] Update Tidelift metadata
* [ ] If this was a 1.26.x release, add changelog to the `main` branch
4 changes: 4 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Security Disclosures

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure with maintainers.
3 changes: 3 additions & 0 deletions .github/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paths:
- "src/"

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
ignore:
# Ignore all patch releases as we can manually
# upgrade if we run into a bug and need a fix.
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
28 changes: 28 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

permissions: "read-all"

jobs:
check-changelog-entry:
name: changelog entry
runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
fetch-depth: 0

- name: "Check changelog"
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
run: |
if ! pipx run towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please see https://github.com/urllib3/urllib3/blob/main/changelog/README.rst for guidance."
false
fi
152 changes: 104 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -2,81 +2,137 @@ name: CI

on: [push, pull_request]

permissions: "read-all"

defaults:
run:
shell: bash

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: python3.8 -m pip install nox
- name: Lint the code
run: nox -s lint

package:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: "Setup Python"
uses: "actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b"
with:
python-version: 3.7
- name: Check packages
python-version: "3.x"
cache: "pip"

- name: "Check packages"
run: |
python3.7 -m pip install wheel twine rstcheck;
python3.7 setup.py sdist bdist_wheel;
rstcheck README.rst CHANGES.rst
python3.7 -m twine check dist/*
python -m pip install -U pip setuptools wheel build twine rstcheck
python -m build
rstcheck CHANGES.rst
python -m twine check dist/*
test:
strategy:
fail-fast: false
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
os: [macos-latest, windows-latest]
experimental: [false]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
os:
- macos-11
- windows-latest
- ubuntu-20.04 # OpenSSL 1.1.1
- ubuntu-22.04 # OpenSSL 3.0
nox-session: ['']
include:
- python-version: 3.9-dev
os: macos-latest
- experimental: false
- python-version: "pypy-3.7"
os: ubuntu-latest
experimental: false
nox-session: test-pypy
- python-version: "pypy-3.8"
os: ubuntu-latest
experimental: false
nox-session: test-pypy
- python-version: "3.x"
os: ubuntu-latest
experimental: false
nox-session: test_brotlipy
# Test CPython with a broken hostname_checks_common_name (the fix is in 3.9.3)
- python-version: "3.9.2"
os: ubuntu-20.04 # CPython 3.9.2 is not available for ubuntu-22.04.
experimental: false
nox-session: test-3.9
- python-version: "3.12-dev"
experimental: true
exclude:
# Ubuntu 22.04 comes with OpenSSL 3.0, so only CPython 3.9+ is compatible with it
# https://github.com/python/cpython/issues/83001
- python-version: "3.7"
os: ubuntu-22.04
- python-version: "3.8"
os: ubuntu-22.04
# Testing with non-final CPython on macOS is too slow for CI.
- python-version: "3.12-dev"
os: macos-11

runs-on: ${{ matrix.os }}
name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows"}')[matrix.os] }} (${{ matrix.python-version }})
name: ${{ fromJson('{"macos-11":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu","ubuntu-20.04":"Ubuntu 20.04 (OpenSSL 1.1.1)","ubuntu-22.04":"Ubuntu 22.04 (OpenSSL 3.0)"}')[matrix.os] }} ${{ matrix.python-version }} ${{ matrix.nox-session}}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: Set Up Python - ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: "Setup Python ${{ matrix.python-version }}"
uses: "actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b"
with:
python-version: ${{ matrix.python-version }}

- name: Set Up Python 3.7 to run nox
if: matrix.python-version != '3.7'
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install Dependencies
run: python -m pip install --upgrade nox
- name: "Install dependencies"
run: python -m pip install --upgrade pip setuptools nox

- name: Run Tests
- name: "Run tests"
run: ./ci/run_tests.sh
env:
PYTHON_VERSION: ${{ matrix.python-version }}
NOX_SESSION: ${{ matrix.nox-session }}

- name: Upload Coverage
run: ./ci/upload_coverage.sh
env:
JOB_NAME: "${{ runner.os }} (${{ matrix.python-version }})"
- name: "Upload artifact"
uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce"
with:
name: coverage-data
path: ".coverage.*"
if-no-files-found: error


coverage:
if: always()
runs-on: "ubuntu-latest"
needs: test
steps:
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: "Setup Python"
uses: "actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b"
with:
python-version: "3.x"

- name: "Install coverage"
run: "python -m pip install --upgrade coverage"

- name: "Download artifact"
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: coverage-data

- name: "Combine & check coverage"
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --ignore-errors --show-missing --fail-under=100
- if: ${{ failure() }}
name: "Upload report if check failed"
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: coverage-report
path: htmlcov
35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "0 0 * * 5"

permissions: "read-all"

jobs:
analyze:
name: "Analyze"
runs-on: "ubuntu-latest"
permissions:
actions: read
contents: read
security-events: write
steps:
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: "Run CodeQL init"
uses: "github/codeql-action/init@b2c19fb9a2a485599ccf4ed5d65527d94bc57226"
with:
config-file: "./.github/codeql.yml"
languages: "python"

- name: "Run CodeQL autobuild"
uses: "github/codeql-action/autobuild@b2c19fb9a2a485599ccf4ed5d65527d94bc57226"

- name: "Run CodeQL analyze"
uses: "github/codeql-action/analyze@b2c19fb9a2a485599ccf4ed5d65527d94bc57226"
29 changes: 29 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Downstream

on: [push, pull_request]

permissions: "read-all"

jobs:
integration:
strategy:
fail-fast: false
matrix:
downstream: [botocore, requests]
runs-on: ubuntu-22.04
timeout-minutes: 30

steps:
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: "Setup Python"
uses: "actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b"
with:
python-version: "3.x"

- name: "Install dependencies"
run: python -m pip install --upgrade nox

- name: "Run downstream tests"
run: nox -s downstream_${{ matrix.downstream }}
Loading