N
P
CppHttpClientServer code
CppHttpClientServer Repository
Synchronous HTTP communication channel
Quick Status
Code functions correctly
no known defects but performance issues
as server is built with STA model.
Note
implements small subset of HTTP 1.0
Demonstration code
yes
Documentation
yes
Test cases
no, but planned
Static library
no, but planned
Build requires
C++17 option, Windows
Planned design changes
- Replace STA server with MTA
- May eventually replace with
Boost::Asio
1.0 Contents
CppHttpClientServer is a "getting started" prototype for two components:
an HttpClient and an HttpServer. The goal is to make these as small and simple as practical
so they can be easily used in distributed applications.
The HttpServer is not intended to be a website server, but rather, an endpoint between
two communicating applications, that use HTTP messaging.
2.0 Current Design
The CppHttpServer uses a single threaded apartment model, e.g., it hosts a thread-safe
blocking queue, which all CppHttpClients share. I used that because I already had
servers built with that model, so I just started with one of them. However, that has
serious performance implications. The server should use a Multi-threaded apartment model
because it uses a synchronous protocol. The client waits for a reply. With STA that will keep other
clients waiting until the server finishes other enqueued tasks.
3.0 Status
This is a Prototype - not ready for Prime Time
The CppHttpServer will serve static pages to Chrome and FireFox, but has serious performance
issues with multiple clients. I don't recommend spending much time with this code until it
matures.
Once this code has evolved enough to be useful, I will start working on a ThreadPool based model
for CppHttpServer. I think this will eventually be a very useful facility.
If C++ eventually standardizes on a networking library (probably something like Boost::Asio),
I will probably use that for the core implementaion code, wrapped by a Comm class with Sender
and Receiver.