Skip to content

Close WSGI producer at Content-Length completion - #179

Open
kentbull wants to merge 1 commit into
ioflo:mainfrom
kentbull:fix/http-content-length-producer-settlement
Open

Close WSGI producer at Content-Length completion#179
kentbull wants to merge 1 commit into
ioflo:mainfrom
kentbull:fix/http-content-length-producer-settlement

Conversation

@kentbull

@kentbull kentbull commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Close and forget the suspended WSGI response iterator when emitted bytes reach the declared Content-Length. Keep the response successfully ended without advancing the producer again.

Why

HIO already treats the framed body as complete, but retained the suspended generator and its application-owned resources. Closing after the current next() returns runs generator cleanup without recurrently servicing a faulty or nonterminating producer beyond the HTTP body boundary.

Fixes #178.

This is the target-native upstream port of GLEIF-IT#18.

Boundary

This PR owns exact Content-Length completion and cleanup of the currently stored iterator only. Universal application-returned-iterable ownership, abort/failure settlement, transport drain policy, and TLS shutdown remain separate work.

Treat exact Content-Length emission as successful response completion while closing and forgetting the suspended iterator. This runs generator cleanup without resuming a faulty or nonterminating producer beyond the framed body.
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.

Responder retains WSGI iterable after Content-Length completion

1 participant