Web++: A C++ Web Framework
132 subscribers
440 photos
36 videos
20 files
177 links
Web++ Framework (A C++ web framework to ease the pain of web development)

Using modern C++20/23.
GitHub: https://github.com/the-moisrex/webpp

I've been working on this project since 2019...
Download Telegram
I'm sorry, but I don't like silent errors. WHATWG URL specs requires this nonsense.
👍1
On what level of C++ expertness should you have to be to know the difference between decltype(x) and decltype((x))?
🤔2👍1
Null === Empty

Well, at least we should pretend they are in standards, specs, and what not.
For example, WHATWG URL Specs should not rely on nullness of host to carry algorithmic information.

These should be implementation details.
Only 396/11463 assertions are now failing in the standard WHATWG URL tests.

I've re-designed some parsers.
🔥1
Also, I've implemented Middlewares which was kinda a big deal. I've been through so many designs of the middlewares already; hope this one would be the one to stay.

The middlewares is designed in quite an interesting way. I'll write about it some day more.
❤3
I've also re-designed header fields as well; there's still one small detail that depends on me figuring out the headers themselves which requires re-aligning the request and responses to match the new middleware solution, which requires figuring out the design of the underlying protocol and who owns the responses and requests and where and who gets to modify them and also figure out where to put mini-caches and the relationship of the cache and the middlewares, and also how the I/O and async play into all of this.

I'm probably one or two pieces of the puzzle away from putting them all together and going with the implementations of the HTTP/FastCGI/CGI/... .
❤2
I also have some parts of the HTTP/1 parser as well. I'm probably gonna use openssl for now for the lower levels, but I'm gonna design it in a way that we can switch out the protocol easily later on.
❤2
Table-Driven Character Classification (Lookup Table/LUT) and Bitmask Accumulation

One of the ways that I'm designing my parsers is using Bitmask Accumulation in combination with a table lookup.

Essentially, I create a table of 256 length and lookup each character in it and use bitwise operator or (|) to accumulate them all into one single uint8_t integer which each bit of that integer can convey information about the types of characters that gave it.

This is a form of classification or categorization.

Then we simply can ask our 8 bit integer if the input for example for the code in the picture:
- Is it possible for it to have IPv4
- Possibility of IPv6
- Contains any specific characters that need special handling like % # ? / \
- Any invalid code points
- Possibility of existence of punycodes
- Existence of Unicode

Of course depending on the table, we can find out other information as well.

This helps the algorithm to completely disable a whole lot of checks.
👍1
Instantiating a generator as a template for certain reasons prevents compilers such as GCC and Clang from identifying it as a coroutine, resulting in errors indicating that std::coroutine_traits was not found. Implementing a non-templated override resolves this issue. It is uncertain whether this constitutes a compiler bug or standard behavior.
Setting IDE's line-height to a less than 1.0 value is not visually pleasing, but I must confess that it helps to reduce scrolling.
👍2⚡1👏1👌1
Did GCC implemented C++26's template for by just copying and pasting the body? 😁
😭2
What's the best way to handle errors in consteval functions?

- noexcept + throw std::exception-based
- noexcept + throw "char pointers"
- no noexcept, only throw
- assert
- static_assert (how?)
- return error (std::optional, std::expected, ...)
I wanted to use std::indirect, but I needed something pimpl idiom that:

- consteval constructible-only
- consteval copyable-only

Ended up writing custom nullable_indirect; at least for now.
🤔1🫡1
Let's hope introducing "dynamic scopes" to a highly templated and complex pipeline-builder "context" type is not gonna backfire.

The user-facing pipeline API will look cute though.
👍1😭1
Now I can hold shift, and slow down my mouse and my stylus.

Good for scaling down the drawings and writings.
This simple pipeline pretty much blows up the system by itself.

How? it doesn't grab the keyboard's events, creates a new virtual keyboard, and re-grabs its own virtual keyboard events.

Is it called stack-overflow or kernel-overflow or what? 😅
❤1
Added momentum to the scroll wheel.

The scroll itself of course is being converted from pen's events to mouse events, and then we add momentum to it.
My WHATWG URL implementation is now passes WHATWG tests.
🫡1
Obviously ada wins, but I do win against older ada v2.9.2.

(not reliable benchmark results)