anmonteiro / anmonteiro/httpun-ws

How to report an exception while reading a handshake failure response

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
29
Forks
16
PR merge metrics
No merged PRs in 30d

Description

The Lwt client type, `Websocketaf_lwt*.Client.t` is abstract:

https://github.com/anmonteiro/websocketaf/blob/248a2cb0dcffa51996c3ad7643577dce75d67454/lwt/websocketaf_lwt_intf.ml#L51

and not made concrete in either `Websocketaf_lwt` or `Websocketaf_lwt_unix`, and there seem to be no accessors for extracting either a `Websocketaf.Client_connection.t` or `Httpaf.Client_connection.t` from it. After receiving a `` `Handshake_failure`` response,

https://github.com/anmonteiro/websocketaf/blob/248a2cb0dcffa51996c3ad7643577dce75d67454/lib/websocketaf.mli#L184-L186

which is an ordinary situation in case of 3xx redirect, a client written over websocket/af will "want" to treat the response as if it is an HTTP/1 client using http/af. In particular, if it needs to abort body reading with an exception, it will want to call `report_exn`, which is available on `Websocketaf.Client_connection.t`:

https://github.com/anmonteiro/websocketaf/blob/248a2cb0dcffa51996c3ad7643577dce75d67454/lib/websocketaf.mli#L219

and a similar function is available o n`Httpaf.Client_connection.t`. However, it doesn't seem possible to get either `Client_connection.t` at this point.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.