File 2822-inets-Add-callback-attributes-to-httpd.patch of Package erlang

From 62fbdc3407129788b8a9b1ba6e95e08f294c01c7 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 27 Sep 2023 16:12:48 +0200
Subject: [PATCH 2/5] inets: Add callback attributes to httpd

---
 lib/inets/src/http_server/httpd.erl | 35 +++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lib/inets/src/http_server/httpd.erl b/lib/inets/src/http_server/httpd.erl
index 97e78e10fd..057e7e1903 100644
--- a/lib/inets/src/http_server/httpd.erl
+++ b/lib/inets/src/http_server/httpd.erl
@@ -49,6 +49,41 @@
 -deprecated({parse_query, 1,
             "use uri_string:dissect_query/1 instead"}).
 
+%%%========================================================================
+%%% Types
+%%%========================================================================
+-type property() :: atom().
+-type ets_table() :: ets:tid().
+
+%%%========================================================================
+%%% Callbacks
+%%%========================================================================
+-callback do(ModData) -> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done when
+      ModData :: [{data,NewData} | {'Body', Body} | {'Head',Head}],
+      OldData :: list(),
+      NewData :: [{response, {StatusCode, Body}}],
+      StatusCode :: integer(),
+      Body :: iolist() | nobody | {Fun, FunArg},
+      Head :: [HeaderOption],
+      HeaderOption :: {Option, Value} | {code, StatusCode},
+      Option :: accept_ranges | allow,
+      Value :: string(),
+      FunArg :: [term()],
+      Fun :: fun((FunArg) -> sent | close | Body).
+
+-callback remove(ConfigDB) -> ok | {error, Reason} when
+      ConfigDB :: ets_table(), Reason :: term().
+
+-callback store({Option, Value}, Config) ->
+    {ok, {Option, NewValue}} | {error, Reason} when
+      Option :: property(),
+      Config :: [{Option, Value}],
+      Value :: term(),
+      NewValue :: term(),
+      Reason :: term().
+
+-optional_callbacks([remove/1, store/2]).
+
 %%%========================================================================
 %%% API
 %%%========================================================================
-- 
2.35.3

openSUSE Build Service is sponsored by