Skip to content

Request client setting to allow RST instead of FIN on request cancelation. #4017

Description

@BlackRabbitCoder

Problem

When a client request future is dropped/cancelled mid-send (e.g., partial body),
hyper-util sends FIN via poll_shutdown(). This tells the server "I'm done sending"
rather than "abort/discard."

Why RST would be better

  • FIN + truncated body can cause server to wait for remaining data (timeout)
  • Server might attempt to process incomplete request
  • RST semantics ("abort") match the intent of cancellation

Current behavior

  1. Request future dropped
  2. Connection detects cancellation via poll_canceled()
  3. poll_shutdown() called → FIN sent
  4. Server receives incomplete request + graceful close

Suggested behavior

Option to send RST instead of FIN when a request is cancelled mid-flight.
Could be a pool config option like rst_on_cancel(true).

Workaround

Currently requires setting SO_LINGER=0 on the socket in a custom connector somehow just before connection is dropped.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: feature. This is adding a new feature.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions