[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'gb.httpd' embedded web server evolutions


Le 30/06/2025 à 11:44, Benoît Minisini a écrit :
Hi,

Until now, debugging projects based on 'gb.web' or 'gb.web.gui' (which itself is based on 'gb.web') from the IDE was done through the 'gb.httpd' component, which integrates an embedded HTTP server inside your project.

In that case, when your project is started, it's the internal HTTP server that is run forever, and that will fork itself to handle each request by running the startup class of your project.

So that you can put breakpoints, the embedded server serializes requests. But then, some other things, like file uplpoad, start to fail. HTTP requets are supposed to be run independently.

To fix that problem, I removed the request serialization trick from 'gb.httpd'.

I also modified the IDE so that debugging projects based on 'gb.web' and 'gb.web.gui' now relies on external debugging instead of normal debugging.

It's not perfect yet, as external debugging can only stop at breakpoints or STOP instructions. In other words starting the debugger with the "step" button has the same effect has starting it with the "run" button. It does not stop on the first line on its own.

But now your project can be run on its own without the need of a real web server:

$ GB_HTTPD_PORT=8080 gbr3 -H ./mywebapp.gambas

...except if you need HTTPS, for example, as the embedded web server, which is relatively simple, does not support it.

It's a work in progress, so questions and comments are welcomed!

Regards,


Sorry for the typos...

For information, here is one not yet solved problem:

When debugging a project based on 'gb.web.gui', the IDE now starts the project, and then enter external debugging mode.

As 'gb.web.gui' handle sessions by forking a new process, when you stop the debugger from the IDE, these forked processes keep running until their timeout is reached (which is ten minutes by default!). Only the main process running the embedded http server is automatically killed.

Finding a good solution for that problem still needs a bit of thinking and good nights.

Regards,

--
Benoît Minisini.


References:
'gb.httpd' embedded web server evolutionsBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>