neolith run: say when a connection closes, and bound what it reads after a refusal

Open
#134 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, python

Research direction

Start with src/neolith/_server.py and its tests after issue #129 has merged. Read how Django's WSGIRequestHandler.handle_one_request selects ServerHandler, then trace the server's response handling for draining, refused requests with unread bodies, and bodyless statuses. Done means the tests cover all three expected connection behaviors, including the documented case where draining starts after headers are sent.

Written by the indexing model from the issue text.

Description

bug help wanted

Found by running the HTTP connector (#128) against the provider endpoints (#129) on one tree. Three points about connections under neolith run:

  • Drain. A response that finishes while the host is draining carries no Connection: close, so the caller's pool keeps a connection the server is about to close, and the next call on it fails as unavailable. Expected: while draining, each response says Connection: close and the connection closes after it. One case stays and is documented: Drain that begins after the headers are sent.
  • An unread request body. After an early refusal, such as a call with no credential, the server reads the rest of the request body into memory in one read. Expected: it is discarded in fixed-size pieces up to a bound, and past the bound the connection is closed.
  • An empty reply. Every 204 closes the connection, because a response with no Content-Length is treated as unframed, so each empty reply costs the caller a new connection. Expected: a status that admits no body (1xx, 204, 304) keeps the connection.

All three need the server to build its own response handler, since Django's WSGIRequestHandler.handle_one_request names ServerHandler directly. runserver and the test live server keep Django's behaviour, and the documentation says so.

Scope: src/neolith/_server.py and its tests, once #129 has merged. The sentences of ADR 0011 that describe these are handled in #133.

Dominant language
Python
Stars
1
Forks
0
Avg merge
5h 30m
Merged PRs (30d)
85

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stack314/django-neolith

All issues in stack314/django-neolith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.