Skip to content

Attempt to close with local-only codes (e.g. 1006) results in normal close (1000) #182

@samsamoa

Description

@samsamoa

Currently, if you close a websocket with code 1006 (which is not allowed), the result is a 1000-code closure:
https://github.com/python-hyper/wsproto/blob/main/src/wsproto/frame_protocol.py#L576-L577

I suspect this should instead be either a 1002 error or an exception, but I'm not certain.

This resulted in a latent bug in hypercorn (an ASGI web server that uses wsproto) where websockets were closed with code 1000 on internal server errors:
pgjones/hypercorn#112

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions