Skip to content

Dev#53

Merged
ondratu merged 13 commits into
masterfrom
dev
Jun 20, 2026
Merged

Dev#53
ondratu merged 13 commits into
masterfrom
dev

Conversation

@ondratu

@ondratu ondratu commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

No description provided.

ondratu added 8 commits June 19, 2026 09:59
- 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.
Comment thread poorwsgi/digest.py Dismissed
Comment thread tests/test_request.py Fixed
Comment thread tests/test_request.py Fixed
Comment thread tests/test_request.py Fixed
Comment thread tests/test_request.py Fixed
ondratu added 5 commits June 19, 2026 23:12
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 ondratu merged commit 2dd1cd6 into master Jun 20, 2026
7 checks passed
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
@ondratu ondratu deleted the dev branch June 20, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants