Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 896981 Details for
Bug 935502
dev-python/cheroot-10.0.1 fails tests on mips: SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
build.log and emerge --info
file_935502.txt (text/plain), 349.07 KB, created by
matoro
on 2024-07-04 20:44:48 UTC
(
hide
)
Description:
build.log and emerge --info
Filename:
MIME Type:
Creator:
matoro
Created:
2024-07-04 20:44:48 UTC
Size:
349.07 KB
patch
obsolete
>Portage 3.0.65 (python 3.12.4-final-0, default/linux/mips/23.0/n64, gcc-14, glibc-2.39-r9, 6.9.7-gentoo-mips mips64) >================================================================= >System uname: Linux-6.9.7-gentoo-mips-mips64-Cavium_Octeon_II_V0.10-with-glibc2.39 >KiB Mem: 32899280 total, 18522868 free >KiB Swap: 0 total, 0 free >Timestamp of repository gentoo: Thu, 04 Jul 2024 19:18:54 +0000 >sh bash 5.2_p26-r6 >ld GNU ld (Gentoo 2.42 p6) 2.42.0 >app-misc/pax-utils: 1.3.7::gentoo >app-shells/bash: 5.2_p26-r6::gentoo >dev-build/autoconf: 2.72-r1::gentoo >dev-build/automake: 1.16.5-r2::gentoo >dev-build/cmake: 3.30.0::gentoo >dev-build/libtool: 2.4.7-r4::gentoo >dev-build/make: 4.4.1-r1::gentoo >dev-build/meson: 1.4.1::gentoo >dev-lang/perl: 5.40.0::gentoo >dev-lang/python: 3.12.4_p2::gentoo, 3.13.0_beta3::gentoo >dev-lang/rust-bin: 1.79.0::gentoo >sys-apps/baselayout: 2.15::gentoo >sys-apps/openrc: 0.54.2::gentoo >sys-apps/sandbox: 2.39::gentoo >sys-devel/binutils: 2.42-r2::gentoo >sys-devel/binutils-config: 5.5::gentoo >sys-devel/gcc: 14.1.1_p20240622::gentoo >sys-devel/gcc-config: 2.11::gentoo >sys-devel/llvm: 17.0.6::gentoo, 18.1.8::gentoo >sys-kernel/linux-headers: 6.9::gentoo (virtual/os-headers) >sys-libs/glibc: 2.39-r9::gentoo >Repositories: > >gentoo > location: /var/db/repos/gentoo > sync-type: rsync > sync-uri: rsync://rsync.gentoo.org/gentoo-portage > priority: -1000 > volatile: False > sync-rsync-verify-jobs: 1 > sync-rsync-extra-opts: > sync-rsync-verify-metamanifest: yes > sync-rsync-verify-max-age: 3 > >Binary Repositories: > >gentoobinhost > priority: 1 > sync-uri: https://distfiles.gentoo.org/releases/mips/binpackages/23.0/mips3_n64 > >ACCEPT_KEYWORDS="mips ~mips" >ACCEPT_LICENSE="@FREE" >CBUILD="mips64-unknown-linux-gnuabi64" >CFLAGS="-O2 -march=mips3 -mabi=64 -mfix-r4000 -mfix-r4400 -pipe" >CHOST="mips64-unknown-linux-gnuabi64" >CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" >CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d" >CXXFLAGS="-O2 -march=mips3 -mabi=64 -mfix-r4000 -mfix-r4400 -pipe" >DISTDIR="/var/cache/distfiles" >EMERGE_DEFAULT_OPTS="--autounmask --autounmask-continue --autounmask-backtrack=y --complete-graph --deep --usepkg --getbinpkg=y --backtrack=300 --usepkg-exclude dev-perl/Mozilla-CA --usepkg-exclude perl-core/Math-BigInt --usepkg-exclude dev-perl/Mozilla-PublicSuffix" >ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" >FCFLAGS="-O2 -march=mips3 -mabi=64 -mfix-r4000 -mfix-r4400 -pipe" >FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance binpkg-request-signature buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" >FFLAGS="-O2 -march=mips3 -mabi=64 -mfix-r4000 -mfix-r4400 -pipe" >GENTOO_MIRRORS="http://distfiles.gentoo.org" >LANG="en_US.utf8" >LDFLAGS="-Wl,-O1 -Wl,--as-needed" >LEX="flex" >MAKEOPTS="-j16" >PKGDIR="/var/cache/binpkgs" >PORTAGE_CONFIGROOT="/" >PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" >PORTAGE_TMPDIR="/var/tmp" >SHELL="/bin/bash" >USE="acl big-endian bzip2 crypt gdbm iconv ipv6 mips ncurses nls openmp pam pcre readline seccomp ssl test-rust unicode xattr zlib" ABI_MIPS="n64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="fbdev dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" >Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS > > > > * Package: dev-python/cheroot-10.0.1:0 > * Repository: gentoo > * Maintainer: python@gentoo.org > * USE: abi_mips_n64 elibc_glibc kernel_linux mips python_targets_python3_12 test test-rust > * FEATURES: keeptemp network-sandbox preserve-libs sandbox test userpriv usersandbox >>>> Unpacking source... >>>> Unpacking cheroot-10.0.1.tar.gz to /var/tmp/portage/dev-python/cheroot-10.0.1/work >>>> Source unpacked in /var/tmp/portage/dev-python/cheroot-10.0.1/work >>>> Preparing source in /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1 ... > * Build system packages: > * dev-python/gpep517 : 16 > * dev-python/installer : 0.7.0 > * dev-python/setuptools : 70.2.0 > * dev-python/setuptools-rust : 1.9.0-r1 > * dev-python/setuptools-scm : 8.1.0 > * dev-python/wheel : 0.43.0 >>>> Source prepared. >>>> Configuring source in /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1 ... >>>> Source configured. >>>> Compiling source in /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1 ... > * python3_12: running distutils-r1_run_phase distutils-r1_python_compile > * Building the wheel for cheroot-10.0.1 via setuptools.build_meta >python3.12 -m gpep517 build-wheel --prefix=/usr --backend setuptools.build_meta --output-fd 3 --wheel-dir /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/wheel >2024-07-04 20:25:04,410 gpep517 INFO Building wheel via backend setuptools.build_meta >/usr/lib/python3.12/site-packages/setuptools_scm/git.py:312: UserWarning: git archive did not support describe output > warnings.warn("git archive did not support describe output") >/usr/lib/python3.12/site-packages/setuptools_scm/git.py:331: UserWarning: unprocessed git archival found (no export subst applied) > warnings.warn("unprocessed git archival found (no export subst applied)") >/usr/lib/python3.12/site-packages/setuptools_scm/_integration/setuptools.py:92: UserWarning: version of None already set > warnings.warn(f"version of {dist_name} already set") >2024-07-04 20:25:06,797 root INFO running bdist_wheel >2024-07-04 20:25:07,512 root INFO running build >2024-07-04 20:25:07,513 root INFO running build_py >2024-07-04 20:25:07,661 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build >2024-07-04 20:25:07,662 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib >2024-07-04 20:25:07,663 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,665 root INFO copying cheroot/wsgi.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,667 root INFO copying cheroot/_compat.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,669 root INFO copying cheroot/cli.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,672 root INFO copying cheroot/testing.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,674 root INFO copying cheroot/server.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,677 root INFO copying cheroot/errors.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,679 root INFO copying cheroot/makefile.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,681 root INFO copying cheroot/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,684 root INFO copying cheroot/__main__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,686 root INFO copying cheroot/connections.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:07,690 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,692 root INFO copying cheroot/test/test_dispatch.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,694 root INFO copying cheroot/test/test__compat.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,696 root INFO copying cheroot/test/test_cli.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,699 root INFO copying cheroot/test/helper.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,701 root INFO copying cheroot/test/conftest.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,703 root INFO copying cheroot/test/test_makefile.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,706 root INFO copying cheroot/test/webtest.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,708 root INFO copying cheroot/test/test_errors.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,710 root INFO copying cheroot/test/test_server.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,713 root INFO copying cheroot/test/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,715 root INFO copying cheroot/test/test_conn.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,718 root INFO copying cheroot/test/test_core.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,720 root INFO copying cheroot/test/_pytest_plugin.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,722 root INFO copying cheroot/test/test_ssl.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,725 root INFO copying cheroot/test/test_wsgi.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test >2024-07-04 20:25:07,728 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers >2024-07-04 20:25:07,729 root INFO copying cheroot/workers/threadpool.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers >2024-07-04 20:25:07,732 root INFO copying cheroot/workers/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers >2024-07-04 20:25:07,735 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:07,736 root INFO copying cheroot/ssl/builtin.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:07,739 root INFO copying cheroot/ssl/pyopenssl.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:07,741 root INFO copying cheroot/ssl/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:07,743 root INFO running egg_info >2024-07-04 20:25:07,882 root INFO writing cheroot.egg-info/PKG-INFO >2024-07-04 20:25:07,898 root INFO writing dependency_links to cheroot.egg-info/dependency_links.txt >2024-07-04 20:25:07,901 root INFO writing entry points to cheroot.egg-info/entry_points.txt >2024-07-04 20:25:07,909 root INFO writing requirements to cheroot.egg-info/requires.txt >2024-07-04 20:25:07,911 root INFO writing top-level names to cheroot.egg-info/top_level.txt >[07/04/24 20:25:08] ERROR listing git files failed - pretending there aren't any git.py:26 >2024-07-04 20:25:08,873 root INFO reading manifest file 'cheroot.egg-info/SOURCES.txt' >2024-07-04 20:25:08,898 root INFO adding license file 'LICENSE.md' >2024-07-04 20:25:08,934 root INFO writing manifest file 'cheroot.egg-info/SOURCES.txt' >2024-07-04 20:25:08,959 root INFO copying cheroot/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,962 root INFO copying cheroot/_compat.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,965 root INFO copying cheroot/cli.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,968 root INFO copying cheroot/connections.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,971 root INFO copying cheroot/errors.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,974 root INFO copying cheroot/makefile.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,977 root INFO copying cheroot/py.typed -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,979 root INFO copying cheroot/server.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,982 root INFO copying cheroot/testing.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,985 root INFO copying cheroot/wsgi.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot >2024-07-04 20:25:08,988 root INFO copying cheroot/workers/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers >2024-07-04 20:25:08,991 root INFO copying cheroot/workers/threadpool.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers >2024-07-04 20:25:08,994 root INFO copying cheroot/ssl/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:08,996 root INFO copying cheroot/ssl/builtin.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:08,999 root INFO copying cheroot/ssl/pyopenssl.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl >2024-07-04 20:25:09,009 root WARNING warning: build_py: byte-compiling is disabled, skipping. > >2024-07-04 20:25:09,289 root INFO installing to /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel >2024-07-04 20:25:09,289 root INFO running install >2024-07-04 20:25:09,425 root INFO running install_lib >2024-07-04 20:25:09,565 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64 >2024-07-04 20:25:09,566 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel >2024-07-04 20:25:09,568 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,569 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/wsgi.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,572 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,573 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_dispatch.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,576 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test__compat.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,578 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_cli.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,581 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/helper.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,583 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/conftest.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,586 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_makefile.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,589 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/webtest.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,591 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_errors.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,594 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_server.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,596 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,599 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_conn.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,602 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_core.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,604 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/_pytest_plugin.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,607 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_ssl.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,610 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/test/test_wsgi.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/test >2024-07-04 20:25:09,612 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/_compat.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,615 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/cli.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,617 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/py.typed -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,620 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/connections.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,622 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/testing.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,625 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/server.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,628 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/errors.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,630 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/errors.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,633 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/wsgi.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,635 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/makefile.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,638 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/makefile.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,640 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/server.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,643 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/cli.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,645 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,648 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,650 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/testing.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,653 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/workers >2024-07-04 20:25:09,655 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers/threadpool.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/workers >2024-07-04 20:25:09,657 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers/threadpool.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/workers >2024-07-04 20:25:09,660 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/workers >2024-07-04 20:25:09,662 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/workers/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/workers >2024-07-04 20:25:09,665 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/__main__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,667 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/connections.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,670 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,672 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/builtin.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,674 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/pyopenssl.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,677 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/__init__.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,679 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/__init__.py -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,682 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/builtin.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,684 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/ssl/pyopenssl.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot/ssl >2024-07-04 20:25:09,687 root INFO copying /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/lib/cheroot/_compat.pyi -> /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot >2024-07-04 20:25:09,689 root WARNING warning: install_lib: byte-compiling is disabled, skipping. > >2024-07-04 20:25:09,690 root INFO running install_egg_info >2024-07-04 20:25:09,837 root INFO Copying cheroot.egg-info to /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot-10.0.1-py3.12.egg-info >2024-07-04 20:25:09,852 root INFO running install_scripts >2024-07-04 20:25:09,888 root INFO creating /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel/cheroot-10.0.1.dist-info/WHEEL >2024-07-04 20:25:09,892 wheel INFO creating '/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/wheel/.tmp-beciz1yc/cheroot-10.0.1-py3-none-any.whl' and adding '/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel' to it >2024-07-04 20:25:09,895 wheel INFO adding 'cheroot/__init__.py' >2024-07-04 20:25:09,897 wheel INFO adding 'cheroot/__init__.pyi' >2024-07-04 20:25:09,899 wheel INFO adding 'cheroot/__main__.py' >2024-07-04 20:25:09,900 wheel INFO adding 'cheroot/_compat.py' >2024-07-04 20:25:09,902 wheel INFO adding 'cheroot/_compat.pyi' >2024-07-04 20:25:09,904 wheel INFO adding 'cheroot/cli.py' >2024-07-04 20:25:09,906 wheel INFO adding 'cheroot/cli.pyi' >2024-07-04 20:25:09,908 wheel INFO adding 'cheroot/connections.py' >2024-07-04 20:25:09,910 wheel INFO adding 'cheroot/connections.pyi' >2024-07-04 20:25:09,912 wheel INFO adding 'cheroot/errors.py' >2024-07-04 20:25:09,914 wheel INFO adding 'cheroot/errors.pyi' >2024-07-04 20:25:09,916 wheel INFO adding 'cheroot/makefile.py' >2024-07-04 20:25:09,918 wheel INFO adding 'cheroot/makefile.pyi' >2024-07-04 20:25:09,919 wheel INFO adding 'cheroot/py.typed' >2024-07-04 20:25:09,922 wheel INFO adding 'cheroot/server.py' >2024-07-04 20:25:09,925 wheel INFO adding 'cheroot/server.pyi' >2024-07-04 20:25:09,927 wheel INFO adding 'cheroot/testing.py' >2024-07-04 20:25:09,929 wheel INFO adding 'cheroot/testing.pyi' >2024-07-04 20:25:09,931 wheel INFO adding 'cheroot/wsgi.py' >2024-07-04 20:25:09,933 wheel INFO adding 'cheroot/wsgi.pyi' >2024-07-04 20:25:09,936 wheel INFO adding 'cheroot/ssl/__init__.py' >2024-07-04 20:25:09,938 wheel INFO adding 'cheroot/ssl/__init__.pyi' >2024-07-04 20:25:09,940 wheel INFO adding 'cheroot/ssl/builtin.py' >2024-07-04 20:25:09,942 wheel INFO adding 'cheroot/ssl/builtin.pyi' >2024-07-04 20:25:09,944 wheel INFO adding 'cheroot/ssl/pyopenssl.py' >2024-07-04 20:25:09,946 wheel INFO adding 'cheroot/ssl/pyopenssl.pyi' >2024-07-04 20:25:09,948 wheel INFO adding 'cheroot/test/__init__.py' >2024-07-04 20:25:09,950 wheel INFO adding 'cheroot/test/_pytest_plugin.py' >2024-07-04 20:25:09,952 wheel INFO adding 'cheroot/test/conftest.py' >2024-07-04 20:25:09,954 wheel INFO adding 'cheroot/test/helper.py' >2024-07-04 20:25:09,956 wheel INFO adding 'cheroot/test/test__compat.py' >2024-07-04 20:25:09,958 wheel INFO adding 'cheroot/test/test_cli.py' >2024-07-04 20:25:09,960 wheel INFO adding 'cheroot/test/test_conn.py' >2024-07-04 20:25:09,963 wheel INFO adding 'cheroot/test/test_core.py' >2024-07-04 20:25:09,965 wheel INFO adding 'cheroot/test/test_dispatch.py' >2024-07-04 20:25:09,967 wheel INFO adding 'cheroot/test/test_errors.py' >2024-07-04 20:25:09,969 wheel INFO adding 'cheroot/test/test_makefile.py' >2024-07-04 20:25:09,971 wheel INFO adding 'cheroot/test/test_server.py' >2024-07-04 20:25:09,973 wheel INFO adding 'cheroot/test/test_ssl.py' >2024-07-04 20:25:09,976 wheel INFO adding 'cheroot/test/test_wsgi.py' >2024-07-04 20:25:09,978 wheel INFO adding 'cheroot/test/webtest.py' >2024-07-04 20:25:09,980 wheel INFO adding 'cheroot/workers/__init__.py' >2024-07-04 20:25:09,982 wheel INFO adding 'cheroot/workers/__init__.pyi' >2024-07-04 20:25:09,984 wheel INFO adding 'cheroot/workers/threadpool.py' >2024-07-04 20:25:09,986 wheel INFO adding 'cheroot/workers/threadpool.pyi' >2024-07-04 20:25:09,989 wheel INFO adding 'cheroot-10.0.1.dist-info/LICENSE.md' >2024-07-04 20:25:09,991 wheel INFO adding 'cheroot-10.0.1.dist-info/METADATA' >2024-07-04 20:25:09,993 wheel INFO adding 'cheroot-10.0.1.dist-info/WHEEL' >2024-07-04 20:25:09,994 wheel INFO adding 'cheroot-10.0.1.dist-info/entry_points.txt' >2024-07-04 20:25:09,996 wheel INFO adding 'cheroot-10.0.1.dist-info/top_level.txt' >2024-07-04 20:25:09,999 wheel INFO adding 'cheroot-10.0.1.dist-info/RECORD' >2024-07-04 20:25:10,002 root INFO removing /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/build/bdist.linux-mips64/wheel >2024-07-04 20:25:10,032 gpep517 INFO The backend produced /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/wheel/cheroot-10.0.1-py3-none-any.whl > * Installing cheroot-10.0.1-py3-none-any.whl to /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install >python3.12 -m gpep517 install-wheel --destdir=/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install --interpreter=/usr/bin/python3.12 --prefix=/usr --optimize=all /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/wheel/cheroot-10.0.1-py3-none-any.whl >2024-07-04 20:25:11,279 gpep517 INFO Installing /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/wheel/cheroot-10.0.1-py3-none-any.whl into /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install >2024-07-04 20:25:13,592 gpep517 INFO Installation complete >>>> Source compiled. >>>> Test phase: dev-python/cheroot-10.0.1 > * python3_12: running distutils-r1_run_phase python_test >python3.12 -m pytest -vv -ra -l -Wdefault -Werror::pytest.PytestUnhandledCoroutineWarning --color=yes -o console_output_style=count -o tmp_path_retention_count=0 -o tmp_path_retention_policy=failed -p xdist -n 16 --dist=worksteal --deselect cheroot/test/test_server.py::test_high_number_of_file_descriptors --deselect cheroot/test/test_ssl.py::test_https_over_http_error -p pytest_mock >================================================= test session starts ================================================= >platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0 -- /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >cachedir: .pytest_cache >rootdir: /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1 >configfile: pytest.ini >testpaths: cheroot/test/ >plugins: xdist-3.6.1, mock-3.14.0 >created: 16/16 workers >16 workers [176 items] > >scheduling tests via WorkStealingScheduling > >cheroot/test/test_conn.py::test_HTTP11_Timeout[False] >cheroot/test/test_core.py::test_parse_uri_unsafe_uri >cheroot/test/test_conn.py::test_Content_Length_out[/wrong_cl_unbuffered-200-I too] >cheroot/test/test_conn.py::test_streaming_11[False] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[localhost:5000-expected_bind_addr2] >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(ESHUTDOWN)] >cheroot/test/test__compat.py::test_compat_functions_positive[ntob-bar-bar] >cheroot/test/test_makefile.py::test_bytes_read >cheroot/test/test_core.py::test_malformed_request_line[GET / HTTPS/1.1-400-Malformed Request-Line: bad protocol] >cheroot/test/test_ssl.py::test_ssl_env[2-True-builtin] >cheroot/test/test_server.py::test_bind_addr_unix[abstract] >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-*.localhost-pyopenssl] >[gw0] [ 1/176] PASSED cheroot/test/test__compat.py::test_compat_functions_positive[ntob-bar-bar] >cheroot/test/test__compat.py::test_compat_functions_positive[ntou-bar-bar] >[gw8] [ 2/176] PASSED cheroot/test/test_makefile.py::test_bytes_read >cheroot/test/test_makefile.py::test_bytes_written >cheroot/test/test_ssl.py::test_ssl_adapters[pyopenssl] >[gw0] [ 3/176] PASSED cheroot/test/test__compat.py::test_compat_functions_positive[ntou-bar-bar] >cheroot/test/test__compat.py::test_compat_functions_positive[bton-bar-bar] >[gw8] [ 4/176] PASSED cheroot/test/test_makefile.py::test_bytes_written >cheroot/test/test_server.py::test_prepare_makes_server_ready >[gw8] [ 5/176] PASSED cheroot/test/test_server.py::test_prepare_makes_server_ready >cheroot/test/test_server.py::test_stop_interrupts_serve >cheroot/test/test_server.py::test_threadpool_threadrange_set[1-1-1] >[gw10] [ 6/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[1-1-1] >cheroot/test/test_server.py::test_threadpool_threadrange_set[1-2-2] >[gw1] [ 7/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[localhost:5000-expected_bind_addr2] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0--1-min=0 must be > 0] >[gw11] [ 8/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0--1-min=0 must be > 0] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-0-min=0 must be > 0] >[gw10] [ 9/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[1-2-2] >cheroot/test/test_server.py::test_threadpool_threadrange_set[1-inf-inf] >[gw10] [ 10/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[1-inf-inf] >[gw11] [ 11/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-0-min=0 must be > 0] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-1-min=0 must be > 0] >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-127.0.0.1-builtin] >[gw0] [ 12/176] PASSED cheroot/test/test__compat.py::test_compat_functions_positive[bton-bar-bar] >cheroot/test/test__compat.py::test_compat_functions_negative_nonnative[ntob] >cheroot/test/test_server.py::test_threadpool_threadrange_set[2--2-inf] >[gw10] [ 13/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[2--2-inf] >[gw9] [ 14/176] PASSED cheroot/test/test_server.py::test_bind_addr_unix[abstract] >[gw11] [ 15/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-1-min=0 must be > 0] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-2-min=0 must be > 0] >[gw11] [ 16/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[0-2-min=0 must be > 0] >[gw6] [ 17/176] PASSED cheroot/test/test_core.py::test_parse_uri_unsafe_uri >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[foo@bar:5000-expected_bind_addr3] >[gw1] [ 18/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[foo@bar:5000-expected_bind_addr3] >[gw2] [ 19/176] PASSED cheroot/test/test_conn.py::test_streaming_11[False] >cheroot/test/test_core.py::test_parse_uri_invalid_uri >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[1-0-Expected an integer or the infinity value for the `max` argument but got 0.] >[gw11] [ 20/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[1-0-Expected an integer or the infinity value for the `max` argument but got 0.] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[1-0.5-Expected an integer or the infinity value for the `max` argument but got 0.5.] >[gw11] [ 21/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[1-0.5-Expected an integer or the infinity value for the `max` argument but got 0.5.] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[foo-expected_bind_addr4] >[gw1] [ 22/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[foo-expected_bind_addr4] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-0-Expected an integer or the infinity value for the `max` argument but got 0.] >[gw0] [ 23/176] PASSED cheroot/test/test__compat.py::test_compat_functions_negative_nonnative[ntob] >cheroot/test/test__compat.py::test_compat_functions_negative_nonnative[ntou] >[gw7] [ 24/176] PASSED cheroot/test/test_core.py::test_malformed_request_line[GET / HTTPS/1.1-400-Malformed Request-Line: bad protocol] >[gw5] [ 25/176] PASSED cheroot/test/test_conn.py::test_Content_Length_out[/wrong_cl_unbuffered-200-I too] >[gw11] [ 26/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-0-Expected an integer or the infinity value for the `max` argument but got 0.] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-1-Expected an integer or the infinity value for the `max` argument but got '1'.] >cheroot/test/test_server.py::test_threadpool_threadrange_set[2--1-inf] >[gw10] [ 27/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[2--1-inf] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[123456789-expected_bind_addr5] >[gw1] [ 28/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[123456789-expected_bind_addr5] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[/tmp/cheroot.sock-/tmp/cheroot.sock] >cheroot/test/test_server.py::test_threadpool_threadrange_set[2-2-2] >[gw10] [ 29/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[2-2-2] >[gw11] [ 30/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-1-Expected an integer or the infinity value for the `max` argument but got '1'.] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-1-max=1 must be > min=2] >cheroot/test/test_server.py::test_threadpool_threadrange_set[2-inf-inf] >[gw10] [ 31/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[2-inf-inf] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1--1-min=-1 must be > 0] >[gw0] [ 32/176] PASSED cheroot/test/test__compat.py::test_compat_functions_negative_nonnative[ntou] >cheroot/test/test__compat.py::test_ntou_escape >[gw11] [ 33/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[2-1-max=1 must be > min=2] >cheroot/test/test_server.py::test_threadpool_multistart_validation >[gw11] [ 34/176] PASSED cheroot/test/test_server.py::test_threadpool_multistart_validation >[gw0] [ 35/176] PASSED cheroot/test/test__compat.py::test_ntou_escape >cheroot/test/test__compat.py::test_extract_bytes[qwerty-qwerty] >[gw0] [ 36/176] PASSED cheroot/test/test__compat.py::test_extract_bytes[qwerty-qwerty] >[gw3] [ 37/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(ESHUTDOWN)] >[gw1] [ 38/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[/tmp/cheroot.sock-/tmp/cheroot.sock] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[/tmp/some-random-file-name-/tmp/some-random-file-name] >[gw1] [ 39/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[/tmp/some-random-file-name-/tmp/some-random-file-name] >cheroot/test/test__compat.py::test_extract_bytes[input_argument1-asdfgh] >[gw0] [ 40/176] PASSED cheroot/test/test__compat.py::test_extract_bytes[input_argument1-asdfgh] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[@cheroot-\x00cheroot] >[gw1] [ 41/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[@cheroot-\x00cheroot] >[gw6] [ 42/176] PASSED cheroot/test/test_core.py::test_parse_uri_invalid_uri >[gw12] [ 43/176] PASSED cheroot/test/test_ssl.py::test_ssl_adapters[pyopenssl] >cheroot/test/test_cli.py::test_Aplication_resolve[None-application] >[gw1] [ 44/176] PASSED cheroot/test/test_cli.py::test_Aplication_resolve[None-application] >[gw10] [ 45/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1--1-min=-1 must be > 0] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-0-min=-1 must be > 0] >cheroot/test/test_cli.py::test_Aplication_resolve[application-application] >cheroot/test/test__compat.py::test_extract_bytes_invalid >[gw0] [ 46/176] PASSED cheroot/test/test__compat.py::test_extract_bytes_invalid >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[192.168.1.1:80-expected_bind_addr0] >[gw10] [ 47/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-0-min=-1 must be > 0] >[gw1] [ 48/176] PASSED cheroot/test/test_cli.py::test_Aplication_resolve[application-application] >cheroot/test/test_cli.py::test_Aplication_resolve[main-main] >[gw1] [ 49/176] PASSED cheroot/test/test_cli.py::test_Aplication_resolve[main-main] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-1-min=-1 must be > 0] >[gw10] [ 50/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-1-min=-1 must be > 0] >[gw0] [ 51/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[192.168.1.1:80-expected_bind_addr0] >[gw13] [ 52/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-127.0.0.1-builtin] >[gw15] [ 53/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[2-True-builtin] >cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[[::1]:8000-expected_bind_addr1] >cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-2-min=-1 must be > 0] >cheroot/test/test_conn.py::test_HTTP11_persistent_connections >cheroot/test/test_ssl.py::test_ssl_adapters[builtin] >[gw10] [ 54/176] PASSED cheroot/test/test_server.py::test_threadpool_invalid_threadrange[-1-2-min=-1 must be > 0] >[gw0] [ 55/176] PASSED cheroot/test/test_cli.py::test_parse_wsgi_bind_addr[[::1]:8000-expected_bind_addr1] >cheroot/test/test_conn.py::test_keepalive_conn_management >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(EPIPE)] >cheroot/test/test_server.py::test_bind_addr_unix[file] >[gw8] [ 56/176] PASSED cheroot/test/test_server.py::test_stop_interrupts_serve >cheroot/test/test_server.py::test_server_interrupt[OSError0] >[gw1] [ 57/176] PASSED cheroot/test/test_conn.py::test_HTTP11_persistent_connections >cheroot/test/test_core.py::test_malformed_request_line[GET / HTTP/1-400-Malformed Request-Line: bad version] >cheroot/test/test_conn.py::test_598 >[gw9] [ 58/176] PASSED cheroot/test/test_server.py::test_bind_addr_unix[file] >cheroot/test/test_conn.py::test_streaming_11[True] >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[RuntimeError(666)] >[gw10] [ 59/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(EPIPE)] >[gw7] [ 60/176] PASSED cheroot/test/test_core.py::test_malformed_request_line[GET / HTTP/1-400-Malformed Request-Line: bad version] >[gw2] [ 61/176] PASSED cheroot/test/test_conn.py::test_streaming_11[True] >cheroot/test/test_core.py::test_parse_no_leading_slash_invalid[hello] >[gw11] [ 62/176] PASSED cheroot/test/test_ssl.py::test_ssl_adapters[builtin] >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-localhost-builtin] >cheroot/test/test_conn.py::test_streaming_10[False] >cheroot/test/test_ssl.py::test_ssl_env[2-True-pyopenssl] >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-127.0.0.1-pyopenssl] >[gw3] [ 63/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[RuntimeError(666)] >[gw6] [ 64/176] PASSED cheroot/test/test_core.py::test_parse_no_leading_slash_invalid[hello] >[gw2] [ 65/176] PASSED cheroot/test/test_conn.py::test_streaming_10[False] >cheroot/test/test_server.py::test_bind_addr_unix_abstract >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(ECONNRESET)] >[gw12] [ 66/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-localhost-builtin] >cheroot/test/test_conn.py::test_unhandled_exception_in_request_handler >[gw9] [ 67/176] PASSED cheroot/test/test_server.py::test_bind_addr_unix_abstract >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-localhost-pyopenssl] >[gw8] [ 68/176] PASSED cheroot/test/test_server.py::test_server_interrupt[OSError0] >cheroot/test/test_server.py::test_server_interrupt[KeyboardInterrupt] >cheroot/test/test_core.py::test_malformed_request_line[GET / HTTP/2.15-505-Cannot fulfill request] >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(-1)] >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[simulated socket.error(ENOTCONN)] >[gw1] [ 69/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(ECONNRESET)] >[gw7] [ 70/176] PASSED cheroot/test/test_core.py::test_malformed_request_line[GET / HTTP/2.15-505-Cannot fulfill request] >cheroot/test/test_core.py::test_parse_no_leading_slash_invalid[\u043f\u0440\u0438\u0432\u0456\u0442] >[gw12] [ 71/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-localhost-pyopenssl] >cheroot/test/test_conn.py::test_streaming_10[True] >[gw14] [ 72/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-*.localhost-pyopenssl] >[gw3] [ 73/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[socket.error(-1)] >[gw11] [ 74/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[simulated socket.error(ENOTCONN)] >[gw6] [ 75/176] PASSED cheroot/test/test_core.py::test_parse_no_leading_slash_invalid[\u043f\u0440\u0438\u0432\u0456\u0442] >[gw2] [ 76/176] PASSED cheroot/test/test_conn.py::test_streaming_10[True] >cheroot/test/test_server.py::test_peercreds_unix_sock[abstract] >[gw9] [ 77/176] PASSED cheroot/test/test_server.py::test_peercreds_unix_sock[abstract] >cheroot/test/test_conn.py::test_No_Message_Body >[gw8] [ 78/176] PASSED cheroot/test/test_server.py::test_server_interrupt[KeyboardInterrupt] >cheroot/test/test_server.py::test_server_interrupt[OSError1] >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-not_localhost-builtin] >cheroot/test/test_core.py::test_malformed_http_method >[gw10] [ 79/176] PASSED cheroot/test/test_conn.py::test_unhandled_exception_in_request_handler >[gw1] [ 80/176] PASSED cheroot/test/test_conn.py::test_No_Message_Body >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[ConnectionResetError(ECONNRESET)] >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-127.0.0.1-builtin] >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[real socket.error(ENOTCONN)] >cheroot/test/test_conn.py::test_remains_alive_post_unhandled_exception >[gw7] [ 81/176] PASSED cheroot/test/test_core.py::test_malformed_http_method >[gw5] [ 82/176] XFAIL cheroot/test/test_conn.py::test_598 >cheroot/test/test_core.py::test_parse_uri_absolute_uri >cheroot/test/test_conn.py::test_keepalive[HTTP/1.0] >[gw4] [ 83/176] PASSED cheroot/test/test_conn.py::test_HTTP11_Timeout[False] >cheroot/test/test_conn.py::test_HTTP11_Timeout_after_request >[gw3] [ 84/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[ConnectionResetError(ECONNRESET)] >[gw11] [ 85/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[real socket.error(ENOTCONN)] >[gw6] [ 86/176] PASSED cheroot/test/test_core.py::test_parse_uri_absolute_uri >[gw12] [ 87/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-127.0.0.1-builtin] >[gw14] [ 88/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-not_localhost-builtin] >[gw2] [ 89/176] PASSED cheroot/test/test_conn.py::test_keepalive[HTTP/1.0] >[gw15] [ 90/176] FAILED cheroot/test/test_ssl.py::test_ssl_env[2-True-pyopenssl] >[gw13] [ 91/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-127.0.0.1-pyopenssl] >cheroot/test/test_server.py::test_peercreds_unix_sock[file] >cheroot/test/test_conn.py::test_No_CRLF[\n\n] >[gw5] [ 92/176] PASSED cheroot/test/test_conn.py::test_No_CRLF[\n\n] >[gw9] [ 93/176] PASSED cheroot/test/test_server.py::test_peercreds_unix_sock[file] >cheroot/test/test_conn.py::test_Chunked_Encoding >[gw8] [ 94/176] PASSED cheroot/test/test_server.py::test_server_interrupt[OSError1] >cheroot/test/test_server.py::test_server_interrupt[RuntimeError] >cheroot/test/test_core.py::test_malformed_header >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[BrokenPipeError(EPIPE)] >cheroot/test/test_core.py::test_normal_request >cheroot/test/test_ssl.py::test_http_over_https_error[0.0.0.0-builtin] >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-*.localhost-builtin] >[gw7] [ 95/176] PASSED cheroot/test/test_core.py::test_malformed_header >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-127.0.0.1-pyopenssl] >cheroot/test/test_core.py::test_parse_uri_asterisk_uri >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-not_localhost-pyopenssl] >[gw10] [ 96/176] PASSED cheroot/test/test_conn.py::test_remains_alive_post_unhandled_exception >[gw11] [ 97/176] PASSED cheroot/test/test_core.py::test_normal_request >cheroot/test/test_conn.py::test_HTTP11_Timeout[True] >cheroot/test/test_conn.py::test_keepalive[HTTP/1.1] >[gw3] [ 98/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[BrokenPipeError(EPIPE)] >[gw6] [ 99/176] PASSED cheroot/test/test_core.py::test_parse_uri_asterisk_uri >[gw2] [100/176] PASSED cheroot/test/test_conn.py::test_keepalive[HTTP/1.1] >[gw15] [101/176] FAILED cheroot/test/test_ssl.py::test_http_over_https_error[0.0.0.0-builtin] >cheroot/test/test_conn.py::test_No_CRLF[\r\n\n] >[gw12] [102/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-127.0.0.1-pyopenssl] >cheroot/test/test_server.py::test_peercreds_unix_sock_with_lookup[abstract] >[gw13] [103/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-*.localhost-builtin] >[gw5] [104/176] PASSED cheroot/test/test_conn.py::test_No_CRLF[\r\n\n] >[gw9] [105/176] PASSED cheroot/test/test_server.py::test_peercreds_unix_sock_with_lookup[abstract] >[gw8] [106/176] PASSED cheroot/test/test_server.py::test_server_interrupt[RuntimeError] >cheroot/test/test_server.py::test_serving_is_false_and_stop_returns_after_ctrlc >[gw8] [107/176] PASSED cheroot/test/test_server.py::test_serving_is_false_and_stop_returns_after_ctrlc >cheroot/test/test_server.py::test_bind_addr_inet[0.0.0.0] >cheroot/test/test_core.py::test_request_line_split_issue_1220 >cheroot/test/test_core.py::test_query_string_request >cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[BrokenPipeError(ESHUTDOWN)] >[gw8] [108/176] PASSED cheroot/test/test_server.py::test_bind_addr_inet[0.0.0.0] >[gw7] [109/176] PASSED cheroot/test/test_core.py::test_request_line_split_issue_1220 >cheroot/test/test_ssl.py::test_http_over_https_error[0.0.0.0-pyopenssl] >cheroot/test/test_core.py::test_parse_uri_fragment_uri >[gw11] [110/176] PASSED cheroot/test/test_core.py::test_query_string_request >cheroot/test/test_ssl.py::test_ssl_env[1-False-builtin] >[gw3] [111/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_tcp_fin[BrokenPipeError(ESHUTDOWN)] >[gw6] [112/176] PASSED cheroot/test/test_core.py::test_parse_uri_fragment_uri >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-*.localhost-builtin] >[gw15] [113/176] PASSED cheroot/test/test_ssl.py::test_http_over_https_error[0.0.0.0-pyopenssl] >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-*.localhost-pyopenssl] >cheroot/test/test_conn.py::test_invalid_selected_connection >cheroot/test/test_server.py::test_peercreds_unix_sock_with_lookup[file] >[gw14] [114/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-not_localhost-pyopenssl] >cheroot/test/test_server.py::test_bind_addr_inet[::] >[gw12] [115/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-*.localhost-builtin] >[gw2] [116/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[1-False-builtin] >[gw9] [117/176] PASSED cheroot/test/test_server.py::test_peercreds_unix_sock_with_lookup[file] >cheroot/test/test_core.py::test_garbage_in >[gw1] [118/176] XFAIL cheroot/test/test_conn.py::test_Chunked_Encoding >[gw8] [119/176] PASSED cheroot/test/test_server.py::test_bind_addr_inet[::] >cheroot/test/test_core.py::test_parse_acceptable_uri[/hello] >cheroot/test/test_wsgi.py::test_gateway_start_response_called_twice >[gw3] [120/176] PASSED cheroot/test/test_wsgi.py::test_gateway_start_response_called_twice >cheroot/test/test_wsgi.py::test_gateway_write_needs_start_response_called_before >[gw3] [121/176] PASSED cheroot/test/test_wsgi.py::test_gateway_write_needs_start_response_called_before >cheroot/test/webtest.py::cheroot.test.webtest.WebCase.getPage >[gw7] [122/176] PASSED cheroot/test/test_core.py::test_garbage_in >[gw3] [123/176] PASSED cheroot/test/webtest.py::cheroot.test.webtest.WebCase.getPage >cheroot/test/test_ssl.py::test_ssl_env[0-False-builtin] >cheroot/test/webtest.py::cheroot.test.webtest.strip_netloc >[gw3] [124/176] PASSED cheroot/test/webtest.py::cheroot.test.webtest.strip_netloc >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-not_localhost-pyopenssl] >cheroot/test/test_core.py::test_no_content_length >[gw11] [125/176] PASSED cheroot/test/test_core.py::test_parse_acceptable_uri[/hello] >cheroot/test/test_ssl.py::test_http_over_https_error[::-builtin] >[gw6] [126/176] PASSED cheroot/test/test_core.py::test_no_content_length >[gw0] [127/176] PASSED cheroot/test/test_conn.py::test_keepalive_conn_management >[gw14] [128/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[0-False-builtin] >cheroot/test/test_conn.py::test_Content_Length_in >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-*.localhost-pyopenssl] >cheroot/test/test_ssl.py::test_ssl_env[1-False-pyopenssl] >cheroot/test/test_dispatch.py::test_dispatch_no_script_name >[gw8] [129/176] PASSED cheroot/test/test_dispatch.py::test_dispatch_no_script_name >cheroot/test/test_server.py::test_reuse_port[0.0.0.0] >cheroot/test/test_errors.py::test_plat_specific_errors[err_names0-err_nums0] >[gw8] [130/176] PASSED cheroot/test/test_errors.py::test_plat_specific_errors[err_names0-err_nums0] >[gw15] [131/176] FAILED cheroot/test/test_ssl.py::test_http_over_https_error[::-builtin] >cheroot/test/test_errors.py::test_plat_specific_errors[err_names1-err_nums1] >[gw1] [132/176] PASSED cheroot/test/test_conn.py::test_Content_Length_in >[gw9] [133/176] PASSED cheroot/test/test_server.py::test_reuse_port[0.0.0.0] >cheroot/test/test_server.py::test_reuse_port[::] >[gw3] [134/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-not_localhost-pyopenssl] >[gw9] [135/176] PASSED cheroot/test/test_server.py::test_reuse_port[::] >cheroot/test/test_server.py::test_threadpool_threadrange_set[1--2-inf] >[gw9] [136/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[1--2-inf] >cheroot/test/test_server.py::test_threadpool_threadrange_set[1--1-inf] >[gw9] [137/176] PASSED cheroot/test/test_server.py::test_threadpool_threadrange_set[1--1-inf] >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-127.0.0.1-pyopenssl] >[gw13] [138/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-*.localhost-pyopenssl] >[gw12] [139/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-*.localhost-pyopenssl] >cheroot/test/test_core.py::test_send_header_before_closing >cheroot/test/test_core.py::test_parse_acceptable_uri[/query_string?test=True] >[gw2] [140/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[1-False-pyopenssl] >[gw7] [141/176] PASSED cheroot/test/test_core.py::test_send_header_before_closing >cheroot/test/test_core.py::test_content_length_required >[gw11] [142/176] PASSED cheroot/test/test_core.py::test_parse_acceptable_uri[/query_string?test=True] >[gw6] [143/176] PASSED cheroot/test/test_core.py::test_content_length_required >cheroot/test/test_conn.py::test_broken_connection_during_http_communication_fallback >cheroot/test/test_ssl.py::test_ssl_env[0-False-pyopenssl] >cheroot/test/test_ssl.py::test_http_over_https_error[::-pyopenssl] >[gw5] [144/176] PASSED cheroot/test/test_conn.py::test_invalid_selected_connection >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-not_localhost-builtin] >cheroot/test/test_core.py::test_http_connect_request >cheroot/test/test_conn.py::test_Content_Length_not_int >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-localhost-builtin] >[gw10] [145/176] PASSED cheroot/test/test_conn.py::test_HTTP11_Timeout[True] >[gw15] [146/176] PASSED cheroot/test/test_ssl.py::test_http_over_https_error[::-pyopenssl] >[gw5] [147/176] PASSED cheroot/test/test_core.py::test_http_connect_request >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-localhost-pyopenssl] >[gw14] [148/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[0-False-pyopenssl] >[gw1] [149/176] PASSED cheroot/test/test_conn.py::test_Content_Length_not_int >cheroot/test/test_ssl.py::test_tls_client_auth[0-True-not_localhost-builtin] >[gw13] [150/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-not_localhost-builtin] >cheroot/test/test_ssl.py::test_ssl_env[1-True-builtin] >cheroot/test/test_core.py::test_large_request >cheroot/test/test_core.py::test_parse_acceptable_uri[/%D0%AE%D1%85%D1%85%D1%83%D1%83%D1%83?%D1%97=%D0%B9%D0%BE] >[gw3] [151/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-localhost-builtin] >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-not_localhost-pyopenssl] >[gw12] [152/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[0-True-not_localhost-builtin] >[gw11] [153/176] PASSED cheroot/test/test_core.py::test_parse_acceptable_uri[/%D0%AE%D1%85%D1%85%D1%83%D1%83%D1%83?%D1%97=%D0%B9%D0%BE] >[gw2] [154/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[1-True-builtin] >[gw8] [155/176] FAILED cheroot/test/test_errors.py::test_plat_specific_errors[err_names1-err_nums1] >cheroot/test/test_conn.py::test_readall_or_close[0] >[gw0] [156/176] PASSED cheroot/test/test_conn.py::test_broken_connection_during_http_communication_fallback >cheroot/test/test_wsgi.py::test_connection_keepalive >cheroot/test/test_ssl.py::test_ssl_env[1-True-pyopenssl] >cheroot/test/test_conn.py::test_kb_int_from_http_handler >cheroot/test/test_ssl.py::test_tls_client_auth[1-True-localhost-pyopenssl] >cheroot/test/test_ssl.py::test_ssl_env[0-True-builtin] >[gw8] [157/176] PASSED cheroot/test/test_conn.py::test_readall_or_close[0] >cheroot/test/test_conn.py::test_Content_Length_out[/wrong_cl_buffered-500-The requested resource returned more bytes than the declared Content-Length.] >[gw13] [158/176] PASSED cheroot/test/test_conn.py::test_Content_Length_out[/wrong_cl_buffered-500-The requested resource returned more bytes than the declared Content-Length.] >cheroot/test/test_conn.py::test_100_Continue >[gw14] [159/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[0-True-builtin] >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-localhost-builtin] >[gw9] [160/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-127.0.0.1-pyopenssl] >[gw3] [161/176] PASSED cheroot/test/test_conn.py::test_100_Continue >cheroot/test/test_ssl.py::test_ssl_env[0-True-pyopenssl] >cheroot/test/test_core.py::test_malformed_request_line[GET /-400-Malformed Request-Line] >[gw2] [162/176] PASSED cheroot/test/test_core.py::test_malformed_request_line[GET /-400-Malformed Request-Line] >[gw12] [163/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-localhost-builtin] >[gw11] [164/176] PASSED cheroot/test/test_ssl.py::test_ssl_env[0-True-pyopenssl] >[gw7] [165/176] XFAIL cheroot/test/test_core.py::test_large_request >[gw0] [166/176] PASSED cheroot/test/test_conn.py::test_kb_int_from_http_handler >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-*.localhost-builtin] >[gw4] [167/176] PASSED cheroot/test/test_conn.py::test_HTTP11_Timeout_after_request >cheroot/test/test_conn.py::test_HTTP11_pipelining >cheroot/test/test_conn.py::test_readall_or_close[1001] >[gw10] [168/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-localhost-pyopenssl] >[gw5] [169/176] FAILED cheroot/test/test_ssl.py::test_ssl_env[1-True-pyopenssl] >[gw7] [170/176] PASSED cheroot/test/test_conn.py::test_readall_or_close[1001] >[gw4] [171/176] PASSED cheroot/test/test_conn.py::test_HTTP11_pipelining >[gw1] [172/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-localhost-pyopenssl] >[gw9] [173/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-*.localhost-builtin] >[gw6] [174/176] FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-not_localhost-pyopenssl] >cheroot/test/test_ssl.py::test_tls_client_auth[2-True-127.0.0.1-builtin] >[gw10] [175/176] PASSED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-127.0.0.1-builtin] >[gw15] [176/176] PASSED cheroot/test/test_wsgi.py::test_connection_keepalive > >====================================================== FAILURES ======================================================= >_________________________________ test_tls_client_auth[2-True-*.localhost-pyopenssl] __________________________________ >[gw14] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffebfc5a30>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebf205c0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebfc5a30> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffebce58b0> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebf205c0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebf205c0> >_stacktrace = <traceback object at 0xffebe30440> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=41367): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebf205c0> >_stacktrace = <traceback object at 0xffebe30440> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffebd8ee70> >tls_http_server = functools.partial(<function make_tls_http_server at 0xffeba8a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-*.localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffebad2ff0> >tls_certificate = <trustme.LeafCert object at 0xffebbedf10> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpnvoocw4n.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgskncgyh.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem', is_trusted_cert = True >tls_client_identity = '*.localhost', tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffebad2ff0> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem' >client_cert = <trustme.LeafCert object at 0xffeb9d5c40> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xffeba16fc0>, 'https://127.0.0.1:41367/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffebd8ee70> >port = 41367 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffebce6ea0> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' >tls_certificate = <trustme.LeafCert object at 0xffebbedf10> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpnvoocw4n.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgskncgyh.pem' >tls_client_identity = '*.localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xffeba8a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-*.localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tlshttpserver = <cheroot.server.HTTPServer object at 0xffebf83aa0> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem'} > params = None > url = 'https://127.0.0.1:41367/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffeb46c380> > url = 'https://127.0.0.1:41367/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffeb46c380> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:41367/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffebfc5a30> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffeb46c380> > start = 1720124740.6613197 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffebfc5a30>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=41367): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp0vm84qrj.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebf205c0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebfc5a30> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp5xsed0xt.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >___________________________________________ test_ssl_env[2-True-pyopenssl] ____________________________________________ >[gw15] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xfff0977b60>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0977dd0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff0977b60> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/env' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/env', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xfff0030320> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0977dd0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/env' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/env' >response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0977dd0> >_stacktrace = <traceback object at 0xfff0995b40> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=49591): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0977dd0> >_stacktrace = <traceback object at 0xfff0995b40> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/env', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/env' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >thread_exceptions = [], recwarn = WarningsRecorder(record=True) >mocker = <pytest_mock.plugin.MockerFixture object at 0xfff0954ec0>, http_request_timeout = 0.1 >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_ssl_env[2-True-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xfff0917d10>, tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tls_certificate = <trustme.LeafCert object at 0xfff0cebb60> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp9rvd8hw1.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp8sid7n3e.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem', use_client_cert = True > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > pytest.param( > 'builtin', > marks=pytest.mark.xfail( > IS_MACOS and PY310_PLUS, > reason='Unclosed TLS resource warnings happen on macOS ' > 'under Python 3.10 (#508)', > strict=False, > ), > ), > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('tls_verify_mode', 'use_client_cert'), > ( > (ssl.CERT_NONE, False), > (ssl.CERT_NONE, True), > (ssl.CERT_OPTIONAL, False), > (ssl.CERT_OPTIONAL, True), > (ssl.CERT_REQUIRED, True), > ), > ) > def test_ssl_env( # noqa: C901 # FIXME > thread_exceptions, > recwarn, > mocker, > http_request_timeout, > tls_http_server, adapter_type, > ca, tls_verify_mode, tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > use_client_cert, > ): > """Test the SSL environment generated by the SSL adapters.""" > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob('127.0.0.1'), > ): > client_cert = ca.issue_cert(ntou('127.0.0.1')) > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlswsgiserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlswsgiserver.bind_addr) > >> resp = requests.get( > 'https://' + interface + ':' + str(port) + '/env', > timeout=http_request_timeout, > verify=tls_ca_certificate_pem_path, > cert=cl_pem if use_client_cert else None, > ) > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xfff0917d10> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem' >client_cert = <trustme.LeafCert object at 0xfff0976720> >http_request_timeout = 0.1 >interface = '127.0.0.1' >mocker = <pytest_mock.plugin.MockerFixture object at 0xfff0954ec0> >port = 49591 >recwarn = WarningsRecorder(record=True) >thread_exceptions = [] >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xfff0fd4b60> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' >tls_certificate = <trustme.LeafCert object at 0xfff0cebb60> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp9rvd8hw1.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp8sid7n3e.pem' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_ssl_env[2-True-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tlswsgiserver = <cheroot.server.HTTPServer object at 0xfff0981130> >use_client_cert = True > >cheroot/test/test_ssl.py:506: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem'} > params = None > url = 'https://127.0.0.1:49591/env' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xfff0975070> > url = 'https://127.0.0.1:49591/env' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xfff0975070> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:49591/env' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xfff0977b60> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xfff0975070> > start = 1720124741.4064658 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xfff0977b60>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=49591): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3pxc7qn9.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0977dd0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff0977b60> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/env' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp58f4ehkz.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >__________________________________ test_tls_client_auth[1-True-127.0.0.1-pyopenssl] ___________________________________ >[gw13] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffebc17d70>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb118110> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebc17d70> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffeb1184a0> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb118110> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb118110> >_stacktrace = <traceback object at 0xffebe0fe40> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=58703): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb118110> >_stacktrace = <traceback object at 0xffebe0fe40> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffebe31af0> >tls_http_server = functools.partial(<function make_tls_http_server at 0xffebf72660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-127.0.0.1-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffebe26d20> >tls_certificate = <trustme.LeafCert object at 0xffeba093a0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmppc_a5n4v.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_2hc99nz.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem', is_trusted_cert = True >tls_client_identity = '127.0.0.1', tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffebe26d20> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem' >client_cert = <trustme.LeafCert object at 0xffebc16900> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xffebef6fc0>, 'https://127.0.0.1:58703/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffebe31af0> >port = 58703 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffebf51850> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' >tls_certificate = <trustme.LeafCert object at 0xffeba093a0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmppc_a5n4v.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_2hc99nz.pem' >tls_client_identity = '127.0.0.1' >tls_http_server = functools.partial(<function make_tls_http_server at 0xffebf72660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-127.0.0.1-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tlshttpserver = <cheroot.server.HTTPServer object at 0xffebc151f0> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem'} > params = None > url = 'https://127.0.0.1:58703/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffebc17c80> > url = 'https://127.0.0.1:58703/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffebc17c80> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:58703/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffebc17d70> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffebc17c80> > start = 1720124741.40565 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffebc17d70>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=58703): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp7kouoksm.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb118110> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebc17d70> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpsja3ao82.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >_____________________________________ test_http_over_https_error[0.0.0.0-builtin] _____________________________________ >[gw15] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >http_request_timeout = 0.1 >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_http_over_https_error[0.0.0.0-builtin]>>) >adapter_type = 'builtin', ca = <trustme.CA object at 0xfff0981d30>, ip_addr = '0.0.0.0' >tls_certificate = <trustme.LeafCert object at 0xfff0975b80> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6qpdbb40.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpchk1k9zt.pem' > > @pytest.mark.parametrize( > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > 'ip_addr', > ( > ANY_INTERFACE_IPV4, > pytest.param(ANY_INTERFACE_IPV6, marks=missing_ipv6), > ), > ) > @pytest.mark.flaky(reruns=3, reruns_delay=2) > def test_http_over_https_error( > http_request_timeout, > tls_http_server, adapter_type, > ca, ip_addr, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ): > """Ensure that connecting over HTTP to HTTPS port is handled.""" > # disable some flaky tests > # https://github.com/cherrypy/cheroot/issues/225 > issue_225 = ( > IS_MACOS > and adapter_type == 'builtin' > ) > if issue_225: > pytest.xfail('Test fails in Travis-CI') > > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > > tls_certificate.configure_cert(tls_adapter.context) > > interface, _host, port = _get_conn_data(ip_addr) > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data( > tlshttpserver.bind_addr, > ) > > fqdn = interface > if ip_addr is ANY_INTERFACE_IPV6: > fqdn = '[{fqdn}]'.format(**locals()) > > expect_fallback_response_over_plain_http = ( > ( > adapter_type == 'pyopenssl' > ) > ) > if expect_fallback_response_over_plain_http: > resp = requests.get( > 'http://{host!s}:{port!s}/'.format(host=fqdn, port=port), > timeout=http_request_timeout, > ) > assert resp.status_code == 400 > assert resp.text == ( > 'The client sent a plain HTTP request, ' > 'but this server only speaks HTTPS on this port.' > ) > return > > with pytest.raises(requests.exceptions.ConnectionError) as ssl_err: > requests.get( # FIXME: make stdlib ssl behave like PyOpenSSL > 'http://{host!s}:{port!s}/'.format(host=fqdn, port=port), > timeout=http_request_timeout, > ) > > if IS_LINUX: > expected_error_code, expected_error_text = ( > 104, 'Connection reset by peer', > ) > if IS_MACOS: > expected_error_code, expected_error_text = ( > 54, 'Connection reset by peer', > ) > if IS_WINDOWS: > expected_error_code, expected_error_text = ( > 10054, > 'An existing connection was forcibly closed by the remote host', > ) > > underlying_error = ssl_err.value.args[0].args[-1] > err_text = str(underlying_error) >> assert underlying_error.errno == expected_error_code, ( > 'The underlying error is {underlying_error!r}'. > format(**locals()) > ) >E AssertionError: The underlying error is ConnectionResetError(131, 'Connection reset by peer') >E assert 131 == 104 >E + where 131 = ConnectionResetError(131, 'Connection reset by peer').errno > >_host = '127.0.0.1' >adapter_type = 'builtin' >ca = <trustme.CA object at 0xfff0981d30> >err_text = '[Errno 131] Connection reset by peer' >expect_fallback_response_over_plain_http = False >expected_error_code = 104 >expected_error_text = 'Connection reset by peer' >fqdn = '127.0.0.1' >http_request_timeout = 0.1 >interface = '127.0.0.1' >ip_addr = '0.0.0.0' >issue_225 = False >port = 32807 >ssl_err = <ExceptionInfo ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(131, 'Connection reset by peer'))) tblen=6> >tls_adapter = <cheroot.ssl.builtin.BuiltinSSLAdapter object at 0xfff129a870> >tls_adapter_cls = <class 'cheroot.ssl.builtin.BuiltinSSLAdapter'> >tls_certificate = <trustme.LeafCert object at 0xfff0975b80> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6qpdbb40.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpchk1k9zt.pem' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_http_over_https_error[0.0.0.0-builtin]>>) >tlshttpserver = <cheroot.server.HTTPServer object at 0xfff00351f0> >underlying_error = ConnectionResetError(131, 'Connection reset by peer') > >cheroot/test/test_ssl.py:697: AssertionError >------------------------------------------------ Captured stderr call ------------------------------------------------- >Client ('127.0.0.1', 34210) attempted to speak plain HTTP into a TCP connection configured for TLS-only traffic — trying to send back a plain HTTP error response: (1, '[SSL: HTTP_REQUEST] http request (_ssl.c:1004)') >________________________________ test_tls_client_auth[2-True-not_localhost-pyopenssl] _________________________________ >[gw14] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffeaf3c5c0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb48a8a0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeaf3c5c0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffeb489250> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb48a8a0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb48a8a0> >_stacktrace = <traceback object at 0xffeafd2680> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=42037): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb48a8a0> >_stacktrace = <traceback object at 0xffeafd2680> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffebce6210> >tls_http_server = functools.partial(<function make_tls_http_server at 0xffeba8a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-not_localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffebce4530> >tls_certificate = <trustme.LeafCert object at 0xffebce66c0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp05ne7rja.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpe7tt0_5n.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem', is_trusted_cert = True >tls_client_identity = 'not_localhost', tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffebce4530> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem' >client_cert = <trustme.LeafCert object at 0xffeb46eb10> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xffeba16fc0>, 'https://127.0.0.1:42037/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffebce6210> >port = 42037 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffeb46e840> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' >tls_certificate = <trustme.LeafCert object at 0xffebce66c0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp05ne7rja.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpe7tt0_5n.pem' >tls_client_identity = 'not_localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xffeba8a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-not_localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tlshttpserver = <cheroot.server.HTTPServer object at 0xffeb46ebd0> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem'} > params = None > url = 'https://127.0.0.1:42037/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffeaf3c470> > url = 'https://127.0.0.1:42037/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffeaf3c470> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:42037/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffeaf3c5c0> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffeaf3c470> > start = 1720124743.2049851 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffeaf3c5c0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=42037): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy4_ouo2m.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb48a8a0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeaf3c5c0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpn8wwq8vh.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >_______________________________________ test_http_over_https_error[::-builtin] ________________________________________ >[gw15] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >http_request_timeout = 0.1 >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_http_over_https_error[::-builtin]>>) >adapter_type = 'builtin', ca = <trustme.CA object at 0xfff0031fd0>, ip_addr = '::' >tls_certificate = <trustme.LeafCert object at 0xfff0955d60> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpplwbe4w8.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp22y_nhgc.pem' > > @pytest.mark.parametrize( > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > 'ip_addr', > ( > ANY_INTERFACE_IPV4, > pytest.param(ANY_INTERFACE_IPV6, marks=missing_ipv6), > ), > ) > @pytest.mark.flaky(reruns=3, reruns_delay=2) > def test_http_over_https_error( > http_request_timeout, > tls_http_server, adapter_type, > ca, ip_addr, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ): > """Ensure that connecting over HTTP to HTTPS port is handled.""" > # disable some flaky tests > # https://github.com/cherrypy/cheroot/issues/225 > issue_225 = ( > IS_MACOS > and adapter_type == 'builtin' > ) > if issue_225: > pytest.xfail('Test fails in Travis-CI') > > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > > tls_certificate.configure_cert(tls_adapter.context) > > interface, _host, port = _get_conn_data(ip_addr) > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data( > tlshttpserver.bind_addr, > ) > > fqdn = interface > if ip_addr is ANY_INTERFACE_IPV6: > fqdn = '[{fqdn}]'.format(**locals()) > > expect_fallback_response_over_plain_http = ( > ( > adapter_type == 'pyopenssl' > ) > ) > if expect_fallback_response_over_plain_http: > resp = requests.get( > 'http://{host!s}:{port!s}/'.format(host=fqdn, port=port), > timeout=http_request_timeout, > ) > assert resp.status_code == 400 > assert resp.text == ( > 'The client sent a plain HTTP request, ' > 'but this server only speaks HTTPS on this port.' > ) > return > > with pytest.raises(requests.exceptions.ConnectionError) as ssl_err: > requests.get( # FIXME: make stdlib ssl behave like PyOpenSSL > 'http://{host!s}:{port!s}/'.format(host=fqdn, port=port), > timeout=http_request_timeout, > ) > > if IS_LINUX: > expected_error_code, expected_error_text = ( > 104, 'Connection reset by peer', > ) > if IS_MACOS: > expected_error_code, expected_error_text = ( > 54, 'Connection reset by peer', > ) > if IS_WINDOWS: > expected_error_code, expected_error_text = ( > 10054, > 'An existing connection was forcibly closed by the remote host', > ) > > underlying_error = ssl_err.value.args[0].args[-1] > err_text = str(underlying_error) >> assert underlying_error.errno == expected_error_code, ( > 'The underlying error is {underlying_error!r}'. > format(**locals()) > ) >E AssertionError: The underlying error is ConnectionResetError(131, 'Connection reset by peer') >E assert 131 == 104 >E + where 131 = ConnectionResetError(131, 'Connection reset by peer').errno > >_host = '::1' >adapter_type = 'builtin' >ca = <trustme.CA object at 0xfff0031fd0> >err_text = '[Errno 131] Connection reset by peer' >expect_fallback_response_over_plain_http = False >expected_error_code = 104 >expected_error_text = 'Connection reset by peer' >fqdn = '[::1]' >http_request_timeout = 0.1 >interface = '::1' >ip_addr = '::' >issue_225 = False >port = 50625 >ssl_err = <ExceptionInfo ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(131, 'Connection reset by peer'))) tblen=6> >tls_adapter = <cheroot.ssl.builtin.BuiltinSSLAdapter object at 0xfff00323c0> >tls_adapter_cls = <class 'cheroot.ssl.builtin.BuiltinSSLAdapter'> >tls_certificate = <trustme.LeafCert object at 0xfff0955d60> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpplwbe4w8.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp22y_nhgc.pem' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09f2660>, request=<SubRequest 'tls_http_server' for <Function test_http_over_https_error[::-builtin]>>) >tlshttpserver = <cheroot.server.HTTPServer object at 0xfff0032570> >underlying_error = ConnectionResetError(131, 'Connection reset by peer') > >cheroot/test/test_ssl.py:697: AssertionError >------------------------------------------------ Captured stderr call ------------------------------------------------- >Client ('::1', 48824, 0, 0) attempted to speak plain HTTP into a TCP connection configured for TLS-only traffic — trying to send back a plain HTTP error response: (1, '[SSL: HTTP_REQUEST] http request (_ssl.c:1004)') >_________________________________ test_tls_client_auth[1-True-*.localhost-pyopenssl] __________________________________ >[gw13] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffeb1a42c0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc16510> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeb1a42c0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffeb17da60> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc16510> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc16510> >_stacktrace = <traceback object at 0xffeb1b2f80> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=37547): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc16510> >_stacktrace = <traceback object at 0xffeb1b2f80> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb11ee10> >tls_http_server = functools.partial(<function make_tls_http_server at 0xffebf72660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-*.localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffeb11cf80> >tls_certificate = <trustme.LeafCert object at 0xffeb11daf0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpjn4qbhix.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw8jezqtx.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem', is_trusted_cert = True >tls_client_identity = '*.localhost', tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffeb11cf80> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem' >client_cert = <trustme.LeafCert object at 0xfff01c1a30> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xffebef6fc0>, 'https://127.0.0.1:37547/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb11ee10> >port = 37547 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffeb17e2d0> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' >tls_certificate = <trustme.LeafCert object at 0xffeb11daf0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpjn4qbhix.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw8jezqtx.pem' >tls_client_identity = '*.localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xffebf72660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-*.localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tlshttpserver = <cheroot.server.HTTPServer object at 0xffeb17e3c0> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem'} > params = None > url = 'https://127.0.0.1:37547/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffeb1a41d0> > url = 'https://127.0.0.1:37547/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffeb1a41d0> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:37547/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffeb1a42c0> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffeb1a41d0> > start = 1720124743.992405 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffeb1a42c0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=37547): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpc8p19e1a.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc16510> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeb1a42c0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpw2qmjn1t.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >___________________________________ test_plat_specific_errors[err_names1-err_nums1] ___________________________________ >[gw8] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >err_names = ('EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK', 'EPIPE'), err_nums = (91, 11, 32) > > @pytest.mark.parametrize( > ('err_names', 'err_nums'), > ( > (('', 'some-nonsense-name'), []), > ( > ( > 'EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK', > 'WSAEWOULDBLOCK', 'EPIPE', > ), > (91, 11, 32) if IS_LINUX else > (32, 35, 41) if IS_MACOS else > (98, 11, 32) if IS_SOLARIS else > (32, 10041, 11, 10035) if IS_WINDOWS else > (), > ), > ), > ) > def test_plat_specific_errors(err_names, err_nums): > """Test that ``plat_specific_errors`` gets correct error numbers list.""" > actual_err_nums = errors.plat_specific_errors(*err_names) > assert len(actual_err_nums) == len(err_nums) >> assert sorted(actual_err_nums) == sorted(err_nums) >E assert [11, 32, 98] == [11, 32, 91] >E >E At index 2 diff: 98 != 91 >E >E Full diff: >E [ >E 11, >E 32, >E - 91, >E ? ^ >E + 98, >E ? ^ >E ] > >actual_err_nums = [32, 98, 11] >err_names = ('EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK', 'EPIPE') >err_nums = (91, 11, 32) > >cheroot/test/test_errors.py:31: AssertionError >__________________________________ test_tls_client_auth[2-True-127.0.0.1-pyopenssl] ___________________________________ >[gw9] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffebe8e990>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebe8e1b0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebe8e990> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffebe7d250> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebe8e1b0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebe8e1b0> >_stacktrace = <traceback object at 0xfff04df1c0> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=36723): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebe8e1b0> >_stacktrace = <traceback object at 0xfff04df1c0> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xfff0861bb0> >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff08ae660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-127.0.0.1-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffebe8d9a0> >tls_certificate = <trustme.LeafCert object at 0xffebe8e000> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpazzrmnba.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmplfjny8ze.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem', is_trusted_cert = True >tls_client_identity = '127.0.0.1', tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffebe8d9a0> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem' >client_cert = <trustme.LeafCert object at 0xffebe8f530> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xfff08dafc0>, 'https://127.0.0.1:36723/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xfff0861bb0> >port = 36723 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffebe8f2f0> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' >tls_certificate = <trustme.LeafCert object at 0xffebe8e000> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpazzrmnba.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmplfjny8ze.pem' >tls_client_identity = '127.0.0.1' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff08ae660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-127.0.0.1-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tlshttpserver = <cheroot.server.HTTPServer object at 0xfff08c5d00> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem'} > params = None > url = 'https://127.0.0.1:36723/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffebe8e6c0> > url = 'https://127.0.0.1:36723/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffebe8e6c0> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:36723/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffebe8e990> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffebe8e6c0> > start = 1720124744.91794 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffebe8e990>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=36723): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpbacyemu6.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebe8e1b0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebe8e990> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpf_hx0z3y.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >__________________________________ test_tls_client_auth[2-True-localhost-pyopenssl] ___________________________________ >[gw10] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffeb8d8290>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb96a7e0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeb8d8290> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffeb8c7ec0> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb96a7e0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb96a7e0> >_stacktrace = <traceback object at 0xfff02bf800> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=38599): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb96a7e0> >_stacktrace = <traceback object at 0xfff02bf800> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb947680> >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff042a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffeb9474a0> >tls_certificate = <trustme.LeafCert object at 0xfff06c1880> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpuor8swox.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpu6r5c3lf.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem', is_trusted_cert = True >tls_client_identity = 'localhost', tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffeb9474a0> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem' >client_cert = <trustme.LeafCert object at 0xffeb96ad80> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xfff0736fc0>, 'https://127.0.0.1:38599/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb947680> >port = 38599 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffeb947290> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' >tls_certificate = <trustme.LeafCert object at 0xfff06c1880> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpuor8swox.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpu6r5c3lf.pem' >tls_client_identity = 'localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff042a660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[2-True-localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_REQUIRED: 2> >tlshttpserver = <cheroot.server.HTTPServer object at 0xfff06c1730> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem'} > params = None > url = 'https://127.0.0.1:38599/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffeb97cdd0> > url = 'https://127.0.0.1:38599/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffeb97cdd0> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:38599/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffeb8d8290> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffeb97cdd0> > start = 1720124745.5316708 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffeb8d8290>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=38599): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpeil59x_2.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb96a7e0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffeb8d8290> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgb936td9.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >___________________________________________ test_ssl_env[1-True-pyopenssl] ____________________________________________ >[gw5] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xffebc298b0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc29bb0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebc298b0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/env' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/env', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffebc3ab40> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc29bb0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/env' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/env' >response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc29bb0> >_stacktrace = <traceback object at 0xfff0789440> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=59497): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc29bb0> >_stacktrace = <traceback object at 0xfff0789440> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/env', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/env' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >thread_exceptions = [], recwarn = WarningsRecorder(record=True) >mocker = <pytest_mock.plugin.MockerFixture object at 0xffebc0fcb0>, http_request_timeout = 0.1 >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff035a660>, request=<SubRequest 'tls_http_server' for <Function test_ssl_env[1-True-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffebc39250>, tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tls_certificate = <trustme.LeafCert object at 0xfff0372000> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpkbf5qeu6.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpl4pj5ftr.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem', use_client_cert = True > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > pytest.param( > 'builtin', > marks=pytest.mark.xfail( > IS_MACOS and PY310_PLUS, > reason='Unclosed TLS resource warnings happen on macOS ' > 'under Python 3.10 (#508)', > strict=False, > ), > ), > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('tls_verify_mode', 'use_client_cert'), > ( > (ssl.CERT_NONE, False), > (ssl.CERT_NONE, True), > (ssl.CERT_OPTIONAL, False), > (ssl.CERT_OPTIONAL, True), > (ssl.CERT_REQUIRED, True), > ), > ) > def test_ssl_env( # noqa: C901 # FIXME > thread_exceptions, > recwarn, > mocker, > http_request_timeout, > tls_http_server, adapter_type, > ca, tls_verify_mode, tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > use_client_cert, > ): > """Test the SSL environment generated by the SSL adapters.""" > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob('127.0.0.1'), > ): > client_cert = ca.issue_cert(ntou('127.0.0.1')) > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlswsgiserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlswsgiserver.bind_addr) > >> resp = requests.get( > 'https://' + interface + ':' + str(port) + '/env', > timeout=http_request_timeout, > verify=tls_ca_certificate_pem_path, > cert=cl_pem if use_client_cert else None, > ) > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffebc39250> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem' >client_cert = <trustme.LeafCert object at 0xffebc3bf50> >http_request_timeout = 0.1 >interface = '127.0.0.1' >mocker = <pytest_mock.plugin.MockerFixture object at 0xffebc0fcb0> >port = 59497 >recwarn = WarningsRecorder(record=True) >thread_exceptions = [] >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xfff0605400> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' >tls_certificate = <trustme.LeafCert object at 0xfff0372000> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpkbf5qeu6.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpl4pj5ftr.pem' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff035a660>, request=<SubRequest 'tls_http_server' for <Function test_ssl_env[1-True-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tlswsgiserver = <cheroot.server.HTTPServer object at 0xffebc3b0e0> >use_client_cert = True > >cheroot/test/test_ssl.py:506: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem'} > params = None > url = 'https://127.0.0.1:59497/env' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffebc3ade0> > url = 'https://127.0.0.1:59497/env' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffebc3ade0> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:59497/env' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xffebc298b0> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffebc3ade0> > start = 1720124745.9502394 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xffebc298b0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=59497): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp3nhm_gxd.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffebc29bb0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xffebc298b0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/env' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp19sexzmm.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >__________________________________ test_tls_client_auth[1-True-localhost-pyopenssl] ___________________________________ >[gw1] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xfff0a17ef0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb87cbc0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff0a17ef0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xffeb87d610> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb87cbc0> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb87cbc0> >_stacktrace = <traceback object at 0xffebd41900> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=55331): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb87cbc0> >_stacktrace = <traceback object at 0xffebd41900> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb85a750> >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff01c2660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xffeb85aa80> >tls_certificate = <trustme.LeafCert object at 0xfff016ef00> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_95669eb.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_3uqdq19.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem', is_trusted_cert = True >tls_client_identity = 'localhost', tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xffeb85aa80> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem' >client_cert = <trustme.LeafCert object at 0xffeb86d5e0> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xffebe3efc0>, 'https://127.0.0.1:55331/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xffeb85a750> >port = 55331 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xffeb86f110> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' >tls_certificate = <trustme.LeafCert object at 0xfff016ef00> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_95669eb.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp_3uqdq19.pem' >tls_client_identity = 'localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff01c2660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tlshttpserver = <cheroot.server.HTTPServer object at 0xffeb86ef00> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem'} > params = None > url = 'https://127.0.0.1:55331/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xffeb87c7a0> > url = 'https://127.0.0.1:55331/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xffeb87c7a0> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:55331/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xfff0a17ef0> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xffeb87c7a0> > start = 1720124746.0762928 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xfff0a17ef0>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=55331): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpgs7hetn9.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xffeb87cbc0> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff0a17ef0> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpszta5has.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >________________________________ test_tls_client_auth[1-True-not_localhost-pyopenssl] _________________________________ >[gw6] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 >urllib3.exceptions.SSLError: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563) > >The above exception was the direct cause of the following exception: > >self = <requests.adapters.HTTPAdapter object at 0xfff00aef60>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: >> resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0935430> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff00aef60> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:667: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/urllib3/connectionpool.py:843: in urlopen > retries = retries.increment( > assert_same_host = False > body = None > body_pos = None > chunked = False > clean_exit = False > conn = None > decode_content = False > destination_scheme = None > err = None > headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': '*/*', 'Connection': 'keep-alive'} > http_tunnel_required = False > method = 'GET' > new_e = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) > parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/', query=None, fragment=None) > pool_timeout = None > preload_content = False > redirect = False > release_conn = False > release_this_conn = True > response_conn = <urllib3.connection.HTTPSConnection object at 0xfff09a5a30> > response_kw = {} > retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) > self = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0935430> > timeout = Timeout(connect=0.1, read=0.1, total=None) > timeout_obj = Timeout(connect=0.1, read=0.1, total=None) > url = '/' >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = Retry(total=0, connect=None, read=False, redirect=None, status=None), method = 'GET', url = '/', response = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0935430> >_stacktrace = <traceback object at 0xfff066d200> > > def increment( > self, > method: str | None = None, > url: str | None = None, > response: BaseHTTPResponse | None = None, > error: Exception | None = None, > _pool: ConnectionPool | None = None, > _stacktrace: TracebackType | None = None, > ) -> Self: > """Return a new Retry object with incremented retry counters. > > :param response: A response object, or None, if the server did not > return a response. > :type response: :class:`~urllib3.response.BaseHTTPResponse` > :param Exception error: An error encountered during the request, or > None if the response was received successfully. > > :return: A new ``Retry`` object. > """ > if self.total is False and error: > # Disabled, indicate to re-raise the error. > raise reraise(type(error), error, _stacktrace) > > total = self.total > if total is not None: > total -= 1 > > connect = self.connect > read = self.read > redirect = self.redirect > status_count = self.status > other = self.other > cause = "unknown" > status = None > redirect_location = None > > if error and self._is_connection_error(error): > # Connect retry? > if connect is False: > raise reraise(type(error), error, _stacktrace) > elif connect is not None: > connect -= 1 > > elif error and self._is_read_error(error): > # Read retry? > if read is False or method is None or not self._is_method_retryable(method): > raise reraise(type(error), error, _stacktrace) > elif read is not None: > read -= 1 > > elif error: > # Other retry? > if other is not None: > other -= 1 > > elif response and response.get_redirect_location(): > # Redirect retry? > if redirect is not None: > redirect -= 1 > cause = "too many redirects" > response_redirect_location = response.get_redirect_location() > if response_redirect_location: > redirect_location = response_redirect_location > status = response.status > > else: > # Incrementing because of a server error like a 500 in > # status_forcelist and the given method is in the allowed_methods > cause = ResponseError.GENERIC_ERROR > if response and response.status: > if status_count is not None: > status_count -= 1 > cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) > status = response.status > > history = self.history + ( > RequestHistory(method, url, error, status, redirect_location), > ) > > new_retry = self.new( > total=total, > connect=connect, > read=read, > redirect=redirect, > status=status_count, > other=other, > history=history, > ) > > if new_retry.is_exhausted(): > reason = error or ResponseError(cause) >> raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] >E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='127.0.0.1', port=50977): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0935430> >_stacktrace = <traceback object at 0xfff066d200> >cause = 'unknown' >connect = None >error = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >history = (RequestHistory(method='GET', url='/', error=SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')), status=None, redirect_location=None),) >method = 'GET' >new_retry = Retry(total=-1, connect=None, read=False, redirect=None, status=None) >other = None >read = False >reason = SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)')) >redirect = None >redirect_location = None >response = None >self = Retry(total=0, connect=None, read=False, redirect=None, status=None) >status = None >status_count = None >total = -1 >url = '/' > >/usr/lib/python3.12/site-packages/urllib3/util/retry.py:519: MaxRetryError > >During handling of the above exception, another exception occurred: > >http_request_timeout = 0.1, mocker = <pytest_mock.plugin.MockerFixture object at 0xfff00737a0> >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09fa660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-not_localhost-pyopenssl]>>) >adapter_type = 'pyopenssl', ca = <trustme.CA object at 0xfff0071400> >tls_certificate = <trustme.LeafCert object at 0xfff09a59a0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp4pqvktq3.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy8n1w8qb.pem' >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem', is_trusted_cert = True >tls_client_identity = 'not_localhost', tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> > > @pytest.mark.parametrize( # noqa: C901 # FIXME > 'adapter_type', > ( > 'builtin', > 'pyopenssl', > ), > ) > @pytest.mark.parametrize( > ('is_trusted_cert', 'tls_client_identity'), > ( > (True, 'localhost'), (True, '127.0.0.1'), > (True, '*.localhost'), (True, 'not_localhost'), > ), > ) > @pytest.mark.parametrize( > 'tls_verify_mode', > ( > ssl.CERT_NONE, # server shouldn't validate client cert > ssl.CERT_OPTIONAL, # same as CERT_REQUIRED in client mode, don't use > ssl.CERT_REQUIRED, # server should validate if client cert CA is OK > ), > ) > @pytest.mark.xfail( > IS_PYPY and IS_CI, > reason='Fails under PyPy in CI for unknown reason', > strict=False, > ) > def test_tls_client_auth( # noqa: C901, WPS213 # FIXME > # FIXME: remove twisted logic, separate tests > http_request_timeout, > mocker, > tls_http_server, adapter_type, > ca, > tls_certificate, > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > tls_ca_certificate_pem_path, > is_trusted_cert, tls_client_identity, > tls_verify_mode, > ): > """Verify that client TLS certificate auth works correctly.""" > test_cert_rejection = ( > tls_verify_mode != ssl.CERT_NONE > and not is_trusted_cert > ) > interface, _host, port = _get_conn_data(ANY_INTERFACE_IPV4) > > client_cert_root_ca = ca if is_trusted_cert else trustme.CA() > with mocker.mock_module.patch( > 'idna.core.ulabel', > return_value=ntob(tls_client_identity), > ): > client_cert = client_cert_root_ca.issue_cert( > ntou(tls_client_identity), > ) > del client_cert_root_ca > > with client_cert.private_key_and_cert_chain_pem.tempfile() as cl_pem: > tls_adapter_cls = get_ssl_adapter_class(name=adapter_type) > tls_adapter = tls_adapter_cls( > tls_certificate_chain_pem_path, > tls_certificate_private_key_pem_path, > ) > if adapter_type == 'pyopenssl': > tls_adapter.context = tls_adapter.get_context() > tls_adapter.context.set_verify( > _stdlib_to_openssl_verify[tls_verify_mode], > lambda conn, cert, errno, depth, preverify_ok: preverify_ok, > ) > else: > tls_adapter.context.verify_mode = tls_verify_mode > > ca.configure_trust(tls_adapter.context) > tls_certificate.configure_cert(tls_adapter.context) > > tlshttpserver = tls_http_server((interface, port), tls_adapter) > > interface, _host, port = _get_conn_data(tlshttpserver.bind_addr) > > make_https_request = functools.partial( > requests.get, > 'https://{host!s}:{port!s}/'.format(host=interface, port=port), > > # Don't wait for the first byte forever: > timeout=http_request_timeout, > > # Server TLS certificate verification: > verify=tls_ca_certificate_pem_path, > > # Client TLS certificate verification: > cert=cl_pem, > ) > > if not test_cert_rejection: >> resp = make_https_request() > >_host = '127.0.0.1' >adapter_type = 'pyopenssl' >ca = <trustme.CA object at 0xfff0071400> >cl_pem = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem' >client_cert = <trustme.LeafCert object at 0xfff007eff0> >http_request_timeout = 0.1 >interface = '127.0.0.1' >is_trusted_cert = True >make_https_request = functools.partial(<function get at 0xfff06eefc0>, 'https://127.0.0.1:50977/', timeout=0.1, verify='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem', cert='/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem') >mocker = <pytest_mock.plugin.MockerFixture object at 0xfff00737a0> >port = 50977 >test_cert_rejection = False >tls_adapter = <cheroot.ssl.pyopenssl.pyOpenSSLAdapter object at 0xfff007e9c0> >tls_adapter_cls = <class 'cheroot.ssl.pyopenssl.pyOpenSSLAdapter'> >tls_ca_certificate_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' >tls_certificate = <trustme.LeafCert object at 0xfff09a59a0> >tls_certificate_chain_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp4pqvktq3.pem' >tls_certificate_private_key_pem_path = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmpy8n1w8qb.pem' >tls_client_identity = 'not_localhost' >tls_http_server = functools.partial(<function make_tls_http_server at 0xfff09fa660>, request=<SubRequest 'tls_http_server' for <Function test_tls_client_auth[1-True-not_localhost-pyopenssl]>>) >tls_verify_mode = <VerifyMode.CERT_OPTIONAL: 1> >tlshttpserver = <cheroot.server.HTTPServer object at 0xfff0fd5a00> > >cheroot/test/test_ssl.py:327: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/site-packages/requests/api.py:73: in get > return request("get", url, params=params, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem'} > params = None > url = 'https://127.0.0.1:50977/' >/usr/lib/python3.12/site-packages/requests/api.py:59: in request > return session.request(method=method, url=url, **kwargs) > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', > 'params': None, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem'} > method = 'get' > session = <requests.sessions.Session object at 0xfff007e390> > url = 'https://127.0.0.1:50977/' >/usr/lib/python3.12/site-packages/requests/sessions.py:589: in request > resp = self.send(prep, **send_kwargs) > allow_redirects = True > auth = None > cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem' > cookies = None > data = None > files = None > headers = None > hooks = None > json = None > method = 'get' > params = None > prep = <PreparedRequest [GET]> > proxies = {} > req = <Request [GET]> > self = <requests.sessions.Session object at 0xfff007e390> > send_kwargs = {'allow_redirects': True, > 'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem'} > settings = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem'} > stream = None > timeout = 0.1 > url = 'https://127.0.0.1:50977/' > verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' >/usr/lib/python3.12/site-packages/requests/sessions.py:703: in send > r = adapter.send(request, **kwargs) > adapter = <requests.adapters.HTTPAdapter object at 0xfff00aef60> > allow_redirects = True > hooks = {'response': []} > kwargs = {'cert': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', > 'proxies': OrderedDict(), > 'stream': False, > 'timeout': 0.1, > 'verify': '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem'} > request = <PreparedRequest [GET]> > self = <requests.sessions.Session object at 0xfff007e390> > start = 1720124745.7844095 > stream = False >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <requests.adapters.HTTPAdapter object at 0xfff00aef60>, request = <PreparedRequest [GET]>, stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem', proxies = OrderedDict() > > def send( > self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None > ): > """Sends PreparedRequest object. Returns Response object. > > :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. > :param stream: (optional) Whether to stream the request content. > :param timeout: (optional) How long to wait for the server to send > data before giving up, as a float, or a :ref:`(connect timeout, > read timeout) <timeouts>` tuple. > :type timeout: float or tuple or urllib3 Timeout object > :param verify: (optional) Either a boolean, in which case it controls whether > we verify the server's TLS certificate, or a string, in which case it > must be a path to a CA bundle to use > :param cert: (optional) Any user-provided SSL certificate to be trusted. > :param proxies: (optional) The proxies dictionary to apply to the request. > :rtype: requests.Response > """ > > try: > conn = self.get_connection_with_tls_context( > request, verify, proxies=proxies, cert=cert > ) > except LocationValueError as e: > raise InvalidURL(e, request=request) > > self.cert_verify(conn, request.url, verify, cert) > url = self.request_url(request, proxies) > self.add_headers( > request, > stream=stream, > timeout=timeout, > verify=verify, > cert=cert, > proxies=proxies, > ) > > chunked = not (request.body is None or "Content-Length" in request.headers) > > if isinstance(timeout, tuple): > try: > connect, read = timeout > timeout = TimeoutSauce(connect=connect, read=read) > except ValueError: > raise ValueError( > f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " > f"or a single float to set both timeouts to the same value." > ) > elif isinstance(timeout, TimeoutSauce): > pass > else: > timeout = TimeoutSauce(connect=timeout, read=timeout) > > try: > resp = conn.urlopen( > method=request.method, > url=url, > body=request.body, > headers=request.headers, > redirect=False, > assert_same_host=False, > preload_content=False, > decode_content=False, > retries=self.max_retries, > timeout=timeout, > chunked=chunked, > ) > > except (ProtocolError, OSError) as err: > raise ConnectionError(err, request=request) > > except MaxRetryError as e: > if isinstance(e.reason, ConnectTimeoutError): > # TODO: Remove this in 3.0.0: see #2811 > if not isinstance(e.reason, NewConnectionError): > raise ConnectTimeout(e, request=request) > > if isinstance(e.reason, ResponseError): > raise RetryError(e, request=request) > > if isinstance(e.reason, _ProxyError): > raise ProxyError(e, request=request) > > if isinstance(e.reason, _SSLError): > # This branch is for urllib3 v1.22 and later. >> raise SSLError(e, request=request) >E requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=50977): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) > >cert = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp6hse39fo.pem' >chunked = False >conn = <urllib3.connectionpool.HTTPSConnectionPool object at 0xfff0935430> >proxies = OrderedDict() >request = <PreparedRequest [GET]> >self = <requests.adapters.HTTPAdapter object at 0xfff00aef60> >stream = False >timeout = Timeout(connect=0.1, read=0.1, total=None) >url = '/' >verify = '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/tmp312z3x5o.pem' > >/usr/lib/python3.12/site-packages/requests/adapters.py:698: SSLError >====================================================== XFAILURES ====================================================== >______________________________________________________ test_598 _______________________________________________________ >[gw5] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >test_client = <cheroot.testing._TestClient object at 0xfff05b0740> > > @pytest.mark.xfail( > reason='Sometimes this test fails due to low timeout. ' > 'Ref: https://github.com/cherrypy/cherrypy/issues/598', > ) > def test_598(test_client): > """Test serving large file with a read timeout in place.""" > # Initialize a persistent HTTP connection > conn = test_client.get_connection() > remote_data_conn = urllib.request.urlopen( > '%s://%s:%s/one_megabyte_of_a' > % ('http', conn.host, conn.port), > ) > buf = remote_data_conn.read(512) > time.sleep(timeout * 0.6) > remaining = (1024 * 1024) - 512 > while remaining: > data = remote_data_conn.read(remaining) > if not data: > break > buf += data > remaining -= len(data) > >> assert len(buf) == 1024 * 1024 >E AssertionError: assert 1024 == (1024 * 1024) >E + where 1024 = len(b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') > >buf = (b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' > b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') >conn = <http.client.HTTPConnection object at 0xfff08bb500> >data = b'' >remaining = 1047552 >remote_data_conn = <http.client.HTTPResponse object at 0xffebc0d8d0> >test_client = <cheroot.testing._TestClient object at 0xfff05b0740> > >cheroot/test/test_conn.py:1476: AssertionError >________________________________________________ test_Chunked_Encoding ________________________________________________ >[gw1] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >test_client = <cheroot.testing._TestClient object at 0xfff0123dd0> > > @pytest.mark.xfail( > reason=unwrap( > trim(""" > Headers from earlier request leak into the request > line for a subsequent request, resulting in 400 > instead of 413. See cherrypy/cheroot#69 for details. > """), > ), > ) > def test_Chunked_Encoding(test_client): > """Test HTTP uploads with chunked transfer-encoding.""" > # Initialize a persistent HTTP connection > conn = test_client.get_connection() > > # Try a normal chunked request (with extensions) > body = ( > b'8;key=value\r\nxx\r\nxxxx\r\n5\r\nyyyyy\r\n0\r\n' > b'Content-Type: application/json\r\n' > b'\r\n' > ) > conn.putrequest('POST', '/upload', skip_host=True) > conn.putheader('Host', conn.host) > conn.putheader('Transfer-Encoding', 'chunked') > conn.putheader('Trailer', 'Content-Type') > # Note that this is somewhat malformed: > # we shouldn't be sending Content-Length. > # RFC 2616 says the server should ignore it. > conn.putheader('Content-Length', '3') > conn.endheaders() > conn.send(body) > response = conn.getresponse() > status_line, _actual_headers, actual_resp_body = webtest.shb(response) > actual_status = int(status_line[:3]) > assert actual_status == 200 > assert status_line[4:] == 'OK' > expected_resp_body = ("thanks for '%s'" % b'xx\r\nxxxxyyyyy').encode() >> assert actual_resp_body == expected_resp_body >E assert b"thanks for 'xx\r\nxxxxyyyyy'" == b"thanks for 'b'xx\\r\\nxxxxyyyyy''" >E >E At index 12 diff: b'x' != b'b' >E >E Full diff: >E - (b"thanks for 'b'xx\\r\\nxxxxyyyyy''") >E ? -- - - - >E + (b"thanks for 'xx\r\nxxxxyyyyy'") > >_actual_headers = [('Content-Type', 'text/html'), > ('Content-Length', '26'), > ('Date', 'Thu, 04 Jul 2024 20:25:42 GMT'), > ('Server', 'Cheroot/10.0.1')] >actual_resp_body = b"thanks for 'xx\r\nxxxxyyyyy'" >actual_status = 200 >body = (b'8;key=value\r\nxx\r\nxxxx\r\n5\r\nyyyyy\r\n0\r\nContent-Type: application/js' > b'on\r\n\r\n') >conn = <http.client.HTTPConnection object at 0xfff048fe30> >expected_resp_body = b"thanks for 'b'xx\\r\\nxxxxyyyyy''" >response = <http.client.HTTPResponse object at 0xfff048d630> >status_line = '200 OK' >test_client = <cheroot.testing._TestClient object at 0xfff0123dd0> > >cheroot/test/test_conn.py:1347: AssertionError >_________________________________________________ test_large_request __________________________________________________ >[gw7] linux -- Python 3.12.4 /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1-python3_12/install/usr/bin/python3.12 > >test_client_with_defaults = <cheroot.testing._TestClient object at 0xffebb22ed0> > > @pytest.mark.xfail( > reason='https://github.com/cherrypy/cheroot/issues/106', > strict=False, # sometimes it passes > ) > def test_large_request(test_client_with_defaults): > """Test GET query with maliciously large Content-Length.""" > # If the server's max_request_body_size is not set (i.e. is set to 0) > # then this will result in an `OverflowError: Python int too large to > # convert to C ssize_t` in the server. > # We expect that this should instead return that the request is too > # large. > c = test_client_with_defaults.get_connection() > c.putrequest('GET', '/hello') > c.putheader('Content-Length', str(2**64)) > c.endheaders() > >> response = c.getresponse() > >c = <http.client.HTTPConnection object at 0xffebb36d50> >test_client_with_defaults = <cheroot.testing._TestClient object at 0xffebb22ed0> > >cheroot/test/test_core.py:295: >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ >/usr/lib/python3.12/http/client.py:1428: in getresponse > response.begin() > response = <http.client.HTTPResponse object at 0xffebb36e00> > self = <http.client.HTTPConnection object at 0xffebb36d50> >/usr/lib/python3.12/http/client.py:331: in begin > version, status, reason = self._read_status() > self = <http.client.HTTPResponse object at 0xffebb36e00> >_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > >self = <http.client.HTTPResponse object at 0xffebb36e00> > > def _read_status(self): > line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") > if len(line) > _MAXLINE: > raise LineTooLong("status line") > if self.debuglevel > 0: > print("reply:", repr(line)) > if not line: > # Presumably, the server closed the connection before > # sending a valid response. >> raise RemoteDisconnected("Remote end closed connection without" > " response") >E http.client.RemoteDisconnected: Remote end closed connection without response > >line = '' >self = <http.client.HTTPResponse object at 0xffebb36e00> > >/usr/lib/python3.12/http/client.py:300: RemoteDisconnected >------------------------------------------------ Captured stderr call ------------------------------------------------- >OverflowError('Python int too large to convert to C ssize_t') >Traceback (most recent call last): > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1291, in communicate > req.respond() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1081, in respond > self.server.gateway(self).respond() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/wsgi.py", line 141, in respond > self.write(chunk) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/wsgi.py", line 221, in write > self.req.ensure_headers_sent() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1128, in ensure_headers_sent > self.send_headers() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1209, in send_headers > self.rfile.read(remaining) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 380, in read > data = self.rfile.read(size) > ^^^^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/makefile.py", line 49, in read > val = super().read(*args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.12/_pyio.py", line 1068, in read > return self._read_unlocked(size) > ^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib/python3.12/_pyio.py", line 1108, in _read_unlocked > chunk = self.raw.read(wanted) > ^^^^^^^^^^^^^^^^^^^^^ >OverflowError: Python int too large to convert to C ssize_t >================================================== warnings summary =================================================== >cheroot/test/test_server.py:258: 16 warnings > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_server.py:258: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html > @pytest.mark.flaky(reruns=3, reruns_delay=2) > >cheroot/test/test_server.py:406: 16 warnings > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_server.py:406: PytestUnknownMarkWarning: Unknown pytest.mark.forked - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html > test_high_number_of_file_descriptors = pytest.mark.forked( > >cheroot/test/test_ssl.py:619: 16 warnings > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_ssl.py:619: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html > @pytest.mark.flaky(reruns=3, reruns_delay=2) > >cheroot/test/test_wsgi.py:40: 16 warnings > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_wsgi.py:40: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html > @pytest.mark.flaky(reruns=3, reruns_delay=2) > >cheroot/test/test_conn.py::test_unhandled_exception_in_request_handler > /usr/lib/python3.12/site-packages/_pytest/python.py:162: ResourceWarning: unclosed <socket.socket fd=15, family=10, type=2, proto=6, laddr=('::1', 36222, 0, 0), raddr=('::1', 55073, 0, 0)> > result = testfunction(**testargs) > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >cheroot/test/test_conn.py::test_unhandled_exception_in_request_handler > /usr/lib/python3.12/site-packages/_pytest/threadexception.py:77: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-12 (safe_start) > > Traceback (most recent call last): > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/usr/lib/python3.12/threading.py", line 1010, in run > self._target(*self._args, **self._kwargs) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1741, in safe_start > raise sys_exit_exc from underlying_interrupt > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1731, in safe_start > self.start() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1845, in start > self.serve() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1833, in serve > raise self.interrupt > SystemExit: test requesting shutdown > > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) > >cheroot/test/test_conn.py::test_remains_alive_post_unhandled_exception > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_conn.py:928: ResourceWarning: unclosed <socket.socket fd=15, family=10, type=2, proto=6, laddr=('::1', 39910, 0, 0), raddr=('::1', 48349, 0, 0)> > test_client.get_connection().send(b'GET / HTTP/1.1') > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >cheroot/test/test_conn.py::test_remains_alive_post_unhandled_exception > /usr/lib/python3.12/site-packages/_pytest/threadexception.py:77: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-23 (safe_start) > > Traceback (most recent call last): > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/usr/lib/python3.12/threading.py", line 1010, in run > self._target(*self._args, **self._kwargs) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1741, in safe_start > raise sys_exit_exc from underlying_interrupt > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1731, in safe_start > self.start() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1845, in start > self.serve() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1833, in serve > raise self.interrupt > SystemExit: test requesting shutdown > > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) > >cheroot/test/test_server.py::test_serving_is_false_and_stop_returns_after_ctrlc > /usr/lib/python3.12/site-packages/_pytest/threadexception.py:77: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-76 (serve) > > Traceback (most recent call last): > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/usr/lib/python3.12/threading.py", line 1010, in run > self._target(*self._args, **self._kwargs) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1818, in serve > self._connections.run(self.expiration_interval) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/connections.py", line 198, in run > self._run(expiration_interval) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/connections.py", line 233, in _run > active_list = self._selector.select(timeout=select_timeout) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_server.py", line 174, in raise_keyboard_interrupt > raise KeyboardInterrupt() > KeyboardInterrupt > > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) > >cheroot/test/test_ssl.py::test_http_over_https_error[::-builtin] > /usr/lib/python3.12/threading.py:855: ResourceWarning: unclosed <socket.socket fd=16, family=2, type=2, proto=6, laddr=('127.0.0.1', 48491), raddr=('127.0.0.1', 46666)> > def _maintain_shutdown_locks(): > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >cheroot/test/test_conn.py::test_broken_connection_during_http_communication_fallback > /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_conn.py:727: ResourceWarning: unclosed <socket.socket fd=15, family=10, type=2, proto=6, laddr=('::1', 55698, 0, 0), raddr=('::1', 57549, 0, 0)> > test_client.get_connection().send(b'GET / HTTP/1.1') > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >cheroot/test/test_conn.py::test_broken_connection_during_http_communication_fallback > /usr/lib/python3.12/site-packages/_pytest/threadexception.py:77: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-12 (safe_start) > > Traceback (most recent call last): > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/usr/lib/python3.12/threading.py", line 1010, in run > self._target(*self._args, **self._kwargs) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1731, in safe_start > self.start() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1845, in start > self.serve() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1833, in serve > raise self.interrupt > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/workers/threadpool.py", line 119, in run > self._process_connections_until_interrupted() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/workers/threadpool.py", line 216, in _process_connections_until_interrupted > conn.close() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1361, in close > self.rfile.close() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_conn.py", line 714, in _raise_connection_reset > raise ConnectionResetError(666) > ConnectionResetError: 666 > > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) > >cheroot/test/test_conn.py::test_kb_int_from_http_handler > /usr/lib/python3.12/site-packages/_pytest/python.py:162: ResourceWarning: unclosed <socket.socket fd=15, family=10, type=2, proto=6, laddr=('::1', 47024, 0, 0), raddr=('::1', 57821, 0, 0)> > result = testfunction(**testargs) > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >cheroot/test/test_conn.py::test_kb_int_from_http_handler > /usr/lib/python3.12/site-packages/_pytest/threadexception.py:77: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-23 (safe_start) > > Traceback (most recent call last): > File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner > self.run() > File "/usr/lib/python3.12/threading.py", line 1010, in run > self._target(*self._args, **self._kwargs) > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1736, in safe_start > raise kb_intr_exc from underlying_interrupt > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1731, in safe_start > self.start() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1845, in start > self.serve() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1833, in serve > raise self.interrupt > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/workers/threadpool.py", line 166, in _process_connections_until_interrupted > keep_conn_open = conn.communicate() > ^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1291, in communicate > req.respond() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/server.py", line 1081, in respond > self.server.gateway(self).respond() > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/wsgi.py", line 136, in respond > response = self.req.server.wsgi_app(self.env, self.start_response) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/helper.py", line 153, in __call__ > output = handler(req, resp) > ^^^^^^^^^^^^^^^^^^ > File "/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/cheroot/test/test_conn.py", line 770, in _trigger_kb_intr > raise KeyboardInterrupt('simulated test handler keyboard interrupt') > KeyboardInterrupt: simulated test handler keyboard interrupt > > warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg)) > >cheroot/test/test_wsgi.py::test_connection_keepalive > /usr/lib/python3.12/urllib/parse.py:582: ResourceWarning: unclosed <socket.socket fd=16, family=10, type=2, proto=6, laddr=('::1', 47187, 0, 0), raddr=('::1', 50966, 0, 0)> > segments[1:-1] = filter(None, segments[1:-1]) > Enable tracemalloc to get traceback where the object was allocated. > See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. > >-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html >-- generated xml file: /var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1/.test-results/pytest/test.xml --- >================================================ slowest 10 durations ================================================= >12.98s call cheroot/test/test_wsgi.py::test_connection_keepalive >4.02s call cheroot/test/test_conn.py::test_HTTP11_Timeout_after_request >3.46s call cheroot/test/test_conn.py::test_keepalive_conn_management >2.00s call cheroot/test/test_conn.py::test_HTTP11_Timeout[False] >2.00s call cheroot/test/test_conn.py::test_HTTP11_Timeout[True] >1.04s call cheroot/test/test_conn.py::test_invalid_selected_connection >0.64s call cheroot/test/test_conn.py::test_598 >0.63s call cheroot/test/test_conn.py::test_kb_int_from_http_handler >0.63s call cheroot/test/test_conn.py::test_unhandled_exception_in_request_handler >0.62s call cheroot/test/test_conn.py::test_remains_alive_post_unhandled_exception >=============================================== short test summary info =============================================== >XFAIL cheroot/test/test_conn.py::test_598 - Sometimes this test fails due to low timeout. Ref: https://github.com/cherrypy/cherrypy/issues/598 >XFAIL cheroot/test/test_conn.py::test_Chunked_Encoding - Headers from earlier request leak into the request line for a subsequent request, resulting in 400 instead of 413. See cherrypy/cheroot#69 for details. >XFAIL cheroot/test/test_core.py::test_large_request - https://github.com/cherrypy/cheroot/issues/106 >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-*.localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=41367): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_ssl_env[2-True-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=49591): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-127.0.0.1-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=58703): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_http_over_https_error[0.0.0.0-builtin] - AssertionError: The underlying error is ConnectionResetError(131, 'Connection reset by peer') >assert 131 == 104 > + where 131 = ConnectionResetError(131, 'Connection reset by peer').errno >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-not_localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=42037): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_http_over_https_error[::-builtin] - AssertionError: The underlying error is ConnectionResetError(131, 'Connection reset by peer') >assert 131 == 104 > + where 131 = ConnectionResetError(131, 'Connection reset by peer').errno >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-*.localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=37547): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_errors.py::test_plat_specific_errors[err_names1-err_nums1] - assert [11, 32, 98] == [11, 32, 91] > > At index 2 diff: 98 != 91 > > Full diff: > [ > 11, > 32, > - 91, > ? ^ > + 98, > ? ^ > ] >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-127.0.0.1-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=36723): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[2-True-localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=38599): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_ssl_env[1-True-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=59497): Max retries exceeded with url: /env (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=55331): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >FAILED cheroot/test/test_ssl.py::test_tls_client_auth[1-True-not_localhost-pyopenssl] - requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=50977): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:2563)'))) >=============================== 13 failed, 160 passed, 3 xfailed, 75 warnings in 41.51s =============================== > * ERROR: dev-python/cheroot-10.0.1::gentoo failed (test phase): > * pytest failed with python3.12 > * > * Call stack: > * ebuild.sh, line 136: Called src_test > * environment, line 4068: Called distutils-r1_src_test > * environment, line 2051: Called _distutils-r1_run_foreach_impl 'python_test' > * environment, line 815: Called python_foreach_impl 'distutils-r1_run_phase' 'python_test' > * environment, line 3655: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' > * environment, line 3161: Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test' > * environment, line 3159: Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test' > * environment, line 1297: Called distutils-r1_run_phase 'python_test' > * environment, line 1974: Called python_test > * environment, line 3955: Called epytest '-p' 'pytest_mock' > * environment, line 2588: Called die > * The specific snippet of code: > * [[ ${ret} -ne 0 ]] && die -n "pytest failed with ${EPYTHON}"; > * > * If you need support, post the output of `emerge --info '=dev-python/cheroot-10.0.1::gentoo'`, > * the complete build log and the output of `emerge -pqv '=dev-python/cheroot-10.0.1::gentoo'`. > * The complete build log is located at '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/build.log'. > * The ebuild environment file is located at '/var/tmp/portage/dev-python/cheroot-10.0.1/temp/environment'. > * Working directory: '/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1' > * S: '/var/tmp/portage/dev-python/cheroot-10.0.1/work/cheroot-10.0.1' > > > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 935502
: 896981