Skip to main content

 

MoeNavigator update: The engine got a new network stack


In short: The network stack in MoeNavigatorEngine has been cleaned up and has become more flexible. The tools for the engine have been updated, MoeNavigator got a bit of maintenance.


The refactorisation of the network stack in MoeNavigatorEngine (MNE) has progressed far enough so that the new code has been merged back into the master branch.

The new stack relies on a network handler that interfaces with the network functionality of the operating system and request objects that pass themselves to the network handler when the request starts. The difference to the old stack is that there is no network protocol handler anymore that passes data. Instead, the network handler sends data to the request object's buffer which is then passed to the "other side" of the web browser engine that processes the data in one of its parsers. To avoid polling, mutexes are used as semaphores which get locked when data have been read and unlocked when data is available. The new network stack should also be able to handle asynchronous requests, but that isn't implemented yet.

The protocol support is the same as with the old network stack: HTTP only. But in the new stack, the Request class provides an abstraction layer where protocols are just specialisations of the base Request class. Adding support for other protocols (like gopher) should have become easier with the new network stack.

The HTTP support has improved in the new stack since the header fields are not limited to a certain set of fields. All header fields are treated equal in request and response headers as long as they are valid. The HTTPRequest class doesn't care what's inside the fields, its only repsonsability is to put together the request header, parse the response header and read the response data. I have verified that reading big binary files works using the mneget tool (from the moenavigatorengine-tools repository). To send data via HTTP POST or PUT, the HTTPRequest class needs some more code to send big chunks of request data.

To add TLS support, a layer between the network handler and the request is necessary. How it shall be named is not yet decided, but it will probably implement the NetworkHandler interface so that all methods for unencrypted network access can be available for encrypted network access as well. This would enable support for HTTPS and could add TLS support for all other protocols the engine supports so that theoretically there could be something like "gophers" (gopher secure), once gopher is implemented.

Besides the work on the engine, I updated the tools for it and got mneget, a wget-like program, into a working state. MoeNavigator itself got a little bit of maintenance and an updated about dialog. With the big progress in MoeNavigatorEngine this week, the days of WebKit as default engine in MoeNavigator are numbered.


About

MoeNavigator is a web browser written from scratch in C++. It uses its own engine called MoeNavigatorEngine (MNE). There is also a collection of tools for the engine. The source code is licensed under the terms of the GNU General Public License v3. The repositories are on @Codeberg.org:

- https://codeberg.org/moenavigator/moenavigator
- https://codeberg.org/moenavigator/moenavigatorengine
- https://codeberg.org/moenavigator/moenavigatorengine-tools


# # # # # # # #

 

Which web template languages would you like to use in C++?


I'm implementing basic Jinja2 and ERB support into libcuwte (C++ unified web template engine). Which other web template languages do you think might be useful in C++?


libcuwte repository: https://codeberg.org/ncc1988/libcuwte

# # # # #

 

libcuwte progress: it renders basic jinja2 templates again, but with designed code


The original libcuwte source code was able to render a basic jinja2 template with placeholders in it using proof of concept code. I now converted the code into proper code after I thought of a design for it.

Now the evaluation of if-statements in Jinja2 has to be done. When if-statements can be evaluated, other Jinja2 statements (for, foreach, swich, while, ...) can be added quickly since they can be converted to if-statements. The next template language to be implemented will probably be ERB.

libcuwte source code: https://codeberg.org/ncc1988/libcuwte

libcuwte wiki (currently only a feature matrix): https://codeberg.org/ncc1988/libcuwte/wiki

# # # # # #

 

Friclicli update: moving to C++


I'm currently translating the source code of Friclicli (Friendica CLI client) from C to modern C++. Some code parts have already been rewritten and have been shortened by that due to the use of std::string instead of char arrays. The code translation process happens in the "move-to-cpp" branch to leave the master branch of the friclicli repository in a usable state.

At the moment there are linking errors because of undefined functions or functions whose definitions have been converted to class methods. It will take some time until the translation process has finished and I can continue to add new functionality to friclicli.

The source code repository is at codeberg: https://codeberg.org/ncc1988/friclicli


# # # # # # #
 
I'm creating tasks on Codeberg for the C++ translation. The tasks are all placed under the following milestone so that you can view the progress: https://codeberg.org/ncc1988/friclicli/milestone/142