Forum > Networking and Web Programming

HTTP/2+HTTP/1.1+WebSocket server written with Lazarus (Free Pascal)

(1/3) > >>

iLya2IK:
The fpweb library is certainly good, but it clearly lacks modern features - namely, full-fledged http/1.1 with persistent connections, and also http/2. I completed my search for the desired analog by creating a server with all the necessary. I would like to present to your attention my project - WCHTTPServer.

The project builds on the fcl-web library and extends it to increase functionality:

Client management using cookies (saving and maintaining sessions).

* Saving information about clients and sessions in SQLite database.
* Saving information about the latest requests and saving logs in SQLite database.
* Multithreading preparation and execution of requests based on thread pools e.g. helpful classes to work with EventSources.
* Client rankings based on the frequency of client requests.
* Built-in support for gzip and deflate compression methods including decompression of client-side requests.
* The WebSocket (RFC 6455) protocol is supported with the "permessage-deflate" extension (RFC 7692).
* Ability to start the server both in HTTP/2 (RFC 7540) mode and in HTTP/1.1 mode.
* Ability to start the server both in HTTP/2 mode and in HTTP 1.1 mode.
* Modified OpenSSL modules (added necessary TLS extensions) in order to create and maintain HTTP/2 connections.
* Added the ability to save the master key and a random set of client data on the server-side (necessary for debugging TLS dumps using WireShark).
* Works under both Windows and Linux
Link to project on GitHub : https://github.com/iLya2IK/wchttpserver

Now the project is at its final stage, but it requires a careful look from the outside. On the forum, I would like to see suggestions for improving the functionality and bug reports.

Thanks.

PierceNg:
Great stuff! Thanks for making this available.

I only started looking at HTTP/2 and know next to nothing about it. I did find https://github.com/summerwind/h2spec. Can you try it on your implementation and share your views on the output please.

iLya2IK:

--- Quote from: PierceNg on February 25, 2021, 02:42:26 pm ---Great stuff! Thanks for making this available.

--- End quote ---
Thanks :D


--- Quote from: PierceNg on February 25, 2021, 02:42:26 pm ---I did find https://github.com/summerwind/h2spec. Can you try it on your implementation and share your views on the output please.

--- End quote ---
Nice advice I'll try it. I used before h2load. But I think h2spec models a lot of additional non-standard situations.

iLya2IK:
I checked the server with the h2spec utility: 41 passed from 94 tests.
I found some bugs in my code caused by a misunderstanding of the http2 protocol (mostly in the part of informing clients about malformed requests and protocol errors). I also found that tests have their own bugs and some ambiguous testing algorithms. For example - Test 5.1/1 waits for the GOAWAY frame with PROTOCOL_ERROR, but section 6.1 in RFC 7540 requires GOAWAY frame with STREAM_CLOSED error. Another example - Test to emulate maximum concurrent streams. On my server, the test program was unable to create so many concurrent streams - no matter how I increase or decrease the MAX_CONCURRENT_STREAMS value - they seem to be quickly snatched up by worker threads.
The author has yet to work out his testing program better, but now it is a powerful tool and I intend to use it further to improve the reliability and adequacy of my server.

ASBzone:
Thanks for this great work.

You may want to post this in the "Third Party" board of the forum, though:

https://forum.lazarus.freepascal.org/index.php/board,19.0.html

Navigation

[0] Message Index

[#] Next page

Go to full version