From 5002127580bb3c2dd0e8c79882610bb005fd70db Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Wed, 17 Sep 2025 00:20:50 -0700 Subject: [PATCH 1/2] fix bad typespec in qhl:parse --- src/qhl.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qhl.erl b/src/qhl.erl index a6c6134..43f92bc 100644 --- a/src/qhl.erl +++ b/src/qhl.erl @@ -27,7 +27,8 @@ -spec parse(Socket, Received) -> Result when Socket :: gen_tcp:socket(), Received :: binary(), - Result :: {ok, #request{}} | {error, Reason}, + Result :: {ok, #request{}, Next} | {error, Reason}, + Next :: none | binary(), Reason :: term(). % FIXME %% @doc %% @equiv parse(Socket, Received, #request{}) @@ -40,13 +41,17 @@ parse(Socket, Received) -> when Socket :: gen_tcp:socket(), Received :: binary(), Request :: #request{}, - Result :: {ok, #request{}} | {error, Reason}, + Result :: {ok, #request{}, Next} | {error, Reason}, + Next :: none | binary(), Reason :: term(). % FIXME %5 @doc %% Pass this function the connection socket and whatever the receive loop has acquired, %% and receive back a parsed #request{} record. This requires that you have imported %% the `http.hrl' and set `{mode, binary}' and `{active, once}' options on the %% socket. +%% +%% `Next' is any additional binary data found on the socket after a valid +%% request is parsed (presumably the beginning of a sequential request). parse(Socket, Received, M = #request{method = undefined}) -> case read_method(Socket, Received) of -- 2.30.2 From 62b95f13fea56097ff0db947ca575dfaa5284ecd Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Wed, 17 Sep 2025 00:23:18 -0700 Subject: [PATCH 2/2] fix a %5 -> %% typo i spotted --- src/qhl.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qhl.erl b/src/qhl.erl index 43f92bc..f65f590 100644 --- a/src/qhl.erl +++ b/src/qhl.erl @@ -44,7 +44,7 @@ parse(Socket, Received) -> Result :: {ok, #request{}, Next} | {error, Reason}, Next :: none | binary(), Reason :: term(). % FIXME -%5 @doc +%% @doc %% Pass this function the connection socket and whatever the receive loop has acquired, %% and receive back a parsed #request{} record. This requires that you have imported %% the `http.hrl' and set `{mode, binary}' and `{active, once}' options on the -- 2.30.2