Upgrade to new libweb interface

Recent commits from libweb brought a few breaking changes. The one below
affected slcl, so it had to be updated according to the new interface:

commit 98f5f52461b0c1ab1ee3331722bd32e2db9e1d41
Author: Xavier Del Campo <xavier.delcampo@midokura.com>
Date:   Thu Nov 16 12:23:08 2023 +0100

    Split handler_loop from handler_listen

    Some applications might set up a struct handler object to listen on any
    port i.e., 0, but still need a way to determine which port number was
    eventually selected by the implementation.

    Therefore, handler_listen has been reduced to the server initialization
    bit, whereas the main loop has been split into its own function, namely
    handler_loop.

    Because of these changes, it no longer made sense for libweb to write
    the selected port to standard output, as this is something now
    applications can do on their own.
This commit is contained in:
Xavier Del Campo Romero 2023-11-23 00:04:28 +01:00
parent daffea4660
commit 1768210ea4
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
2 changed files with 13 additions and 3 deletions

2
libweb

@ -1 +1 @@
Subproject commit b71a6174e12b4709acaf8bc151938ba12d2a54f6
Subproject commit dec953e4f4af89149685c7463c422ccca6174cb8

14
main.c
View File

@ -1325,7 +1325,7 @@ static int upload(const struct http_payload *const p,
fprintf(stderr, "%s: auth_cookie failed\n", __func__);
return page_forbidden(r);
}
else if (p->u.post.expect_continue)
else if (p->expect_continue)
{
*r = (const struct http_response)
{
@ -2089,11 +2089,21 @@ int main(int argc, char *argv[])
.user = a
};
unsigned short outport;
if (!(h = handler_alloc(&cfg))
|| add_urls(h, a)
|| handler_listen(h, port))
|| handler_listen(h, port, &outport))
goto end;
printf("Listening on port %hu\n", outport);
if (handler_loop(h))
{
fprintf(stderr, "%s: handler_loop failed\n", __func__);
goto end;
}
ret = EXIT_SUCCESS;
end: