Conversation
- Accepted values are 'Strict', 'Lax', 'None', and False; anything else raises ValueError - same_site='None' without secure=True raises ValueError (browsers reject SameSite=None cookies without the Secure flag) - Type annotation corrected from Union[str, bool] to Union[str, Literal[False]] - Docstrings and doc/documentation.rst updated to document valid values, the Secure requirement for 'None', and raised exceptions - Unit tests added for all new validation paths (match= parameter used to keep PT011 happy) - Bump version to 2.8.1
- Session._destroyed flag prevents _apply_cookie_attrs() from overwriting Max-Age=-1 set by destroy() with the original configured value; without this fix a browser would honour Max-Age over Expires and not delete the cookie - Unit tests for session.py and aes_session.py reach 100% line coverage: get_token/check_token (both timeout windows), NoCompress, destroy() with max_age and secure, header() with a headers object, PoorSession and AESSession edge cases (str key, empty cookie, short signature/payload, non-dict data) - Consolidate tool config into pyproject.toml: ruff.toml and .isort.cfg removed; pytest testpaths and coverage source=poorwsgi added so that pytest --cov only reports poorwsgi/ and not the test files themselves
Tests cover all previously untested code in poorwsgi/headers.py: - parse_header: simple, with params, quoted value, quoted semicolon inside a parameter value (inner _parseparam loop) - parse_negotiation: no quality, with quality, bad quality fallback - render_negotiation: with and without quality - parse_range: simple, suffix, open-ended, multi-range, invalid input, empty pair skipped - datetime_to_http, time_to_http (with/without argument), http_to_datetime, http_to_time - ContentRange: default units, explicit full size, custom units - Headers: __len__, __iter__, __repr__, names(), keys(), values(), get_all(), __delitem__, __setitem__, setdefault(), add() duplicate raises KeyError, Set-Cookie allows duplicates, add_header() with None kwarg (bare flag), strict=False for list and dict, iso88591() lone surrogate raises ValueError, utf8() success and except branch
- Tests for SimpleRequest and Request properties (forwarded headers, auto_data, auto_json, auto_form, auto_cookies, authorization, etc.) - Tests for CachedInput read and readline including timeout and buffering edge cases - Tests for deprecated FieldStorage wrapper, EmptyForm and JsonList fce argument, and Args/form/json setters - Coverage increased from 63 % to 100 %
- Status line format verified across all response types (200, 301, 302, 304, 204, 206) - 304 Not Modified: deny-header warning and missing-required-header warning - Content-Length accuracy for bytes, UTF-8, write(), partial ranges - make_partial/make_range edge cases: inconsistent ranges, multiple ranges warning - RedirectResponse: Location header, message body, Content-Type - FileResponse: Last-Modified RFC 7231 format, Accept-Ranges, Content-Length - FileObjResponse: BytesIO, unknown-size stream, closed-file edge cases - NoContentResponse, EmptyResponse (deprecated), Declined behaviour - HTTPException.make_response and response property - make_response factory: str/bytes/dict/list/None/invalid inputs - IBytesIO iteration in 1024-byte chunks - Response.write() and data property edge cases
- valid_boundary: RFC 2046 syntax, str/bytes, length limits - FieldStorageInterface base: getvalue/getfirst/getlist with func, fce deprecation - FieldStorage: value from str/_value/StringIO/BytesIO/file, keys, get, getitem single/multiple/missing, bool, iter, len, del closes file, context manager - URL-encoded forms: percent encoding, + as space, blank values, repeated keys, custom separator, Content-Length error, max_num_fields - multipart/form-data: text fields, file uploads, binary content, repeated keys, browser-style dashes in boundary, Unicode filenames, Content-Type on parts, content-length-per-part stripped (browser quirk), CRLF line endings, max_num_fields - read_single: text/plain via read_lines, large upload spills to tempfile - read_binary: empty-input sets done=-1, non-bytes stream raises ValueError - file_callback: called with filename for uploads - make_file: text/binary tempfile selection, callback override - Error paths: invalid boundary, non-bytes readline, TextIOWrapper input
… coverage - Replace == comparisons of auth response hashes with hmac.compare_digest to prevent timing attacks (GitHub alerts #5/#6) - Fix bug: -n -s CLI flag combination now correctly uses SHA-256 algorithm - Add RFC 7616 unit tests: check_response (MD5, MD5-sess, qop variants), check_credentials (all rejection paths), check_digest decorator, PasswordMap.write/roundtrip, get_re_type, and CLI main() coverage
98 tests covering all handler functions (bad_request, not_found, forbidden, unauthorized, method_not_allowed, not_modified, internal_server_error, not_implemented, directory_index, debug_info, hbytes, html_escape, handlers_view), achieving 98% coverage with validation of HTTP status codes and RFC-conforming response headers.
pytest-pylint 0.21.0 is incompatible with pytest 9.x — it uses the removed `path` argument in pytest_collect_file. Replace with a direct `pylint poorwsgi` step and run mypy/doctests separately.
- digest.py: add nosec B324 to MD5/SHA-256 import — both algorithms are mandated by RFC 7616 for HTTP Digest Authentication, not used for password storage - test_request.py: replace ellipsis stubs with proper pass bodies to silence "statement has no effect" code quality warnings
ondratu
added a commit
that referenced
this pull request
Jun 20, 2026
- digest.py: add nosec B324 to MD5/SHA-256 import — both algorithms are mandated by RFC 7616 for HTTP Digest Authentication, not used for password storage - test_request.py: replace ellipsis stubs with proper pass bodies to silence "statement has no effect" code quality warnings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.