
Launch a header-only C++ networking library with HTTP and WebSocket clients and servers using Boost.Beast. Establish a cross-platform Windows and Linux repository with tests and a readme.
Build Boost C++ on Windows with Visual Studio 2022. Bootstrap the builder, use b2 to compile Boost as shared libraries, and skip MPI and Python to streamline the build.
Prepare a third party directory with artifacts, lib, and include, then set up a Visual Studio solution and an http server test project with catch two.
Organize a Visual Studio solution by creating an HTTP server project, a separate HTTP client, and a shared common library, then set up folders, rename, and adjust build targets.
Add all project files to git, ignore the build directory with a Visual Studio gitignore, copy the template, then stage, commit, and push the changes.
Learn the Boost.Asio basics: the IO context centers task execution, post and run, and how threads, work objects, and strands coordinate asynchronous tasks, with timers as convenient utilities.
Outline a roadmap with a sample app and a basic api to define done, then implement a minimal http client with timeout, build utilities, and add tests as we evolve.
Prepare a test http client using boost.asio by creating an io_context with work, launching a thread to run it, and logging any exceptions.
Design and implement a factory-based HTTP client with a private constructor, a make method returning a shared pointer, and an executor configured through HTTP client parameters using boost.asio.
Build a simple http client by adding send async, creating and sending an http request, and robustly validating the http response and error codes before use.
Add a default-constructed HTTP client via a factory method and an asynchronous send method, wiring a constructor with parameters, using make_shared and post-based testing.
Refactor the primitive resolve code by parameterizing connection parameters, removing default values, and making callbacks and lambdas callable and mutable for clearer async handling and error reporting.
Learn to implement a robust async connect with boost.asio by parameterizing connect, resolving multiple endpoints, handling errors, and preparing for chaining to send async, while managing memory lifetimes.
Explain how to manage object lifetimes in asynchronous operations using shared_ptr and enable_shared_from_this, preventing deletes during connect async and safely chaining send async calls.
Implement memory management improvements for the http client, adding deferred deletion to preserve lifetimes, prevent undefined behavior during asynchronous callbacks, and rely on an executor to keep shared pointers alive.
Learn how http requests and responses flow over a single connection using wireshark, observing get requests to httpbin.org, headers, bodies, and crlf line endings.
Send a simple http message by composing a minimal http request with a host header, then use boost asio to async write and test with Postman.
Learn to read a simple http response asynchronously, using read until for double newline, handle headers and body, and safely extract the response content from a buffer.
Create an http response stream parser with boost to read headers, determine content length, and parse the remainder using begin and end iterators, signaling completion with a done flag.
Implement a stream-based http response header parser by buffering incoming data, waiting for the double CRLF, and parsing the header data once found.
Code Together guides building an HTTP header parser, turning header data into a start line and key-value pairs using boost split, with iterative parsing of lines.
Parse http header lines by extracting header field name and value, trimming spaces, handling empty lines, and adding to the http header vector for the response.
analyze and implement http header parsing to determine transfer method using content length or chunked encoding, handle body reading, and add error checks during header processing.
Determine the http transfer method by examining the http header for transfer-encoding or content length, implementing a header get method, and handling chunked and content length cases.
Extract the http header to determine content length and compute header and body sizes, enabling parsing the body from the buffer.
Read the http body after parsing headers, update content length using the expected message size, and manage buffers through state checks as the body is read.
Debug and fix an HTTP request parser by tracing headers, content length, and body parsing, add breakpoints, handle uninitialized values, and validate the transfer method to ensure parsing and response.
Learn to parse and extract host and port from a uri using boost url, and configure debugging, linking, and libraries in Visual Studio for a client url workflow toward api.
Learn to build a robust connection parameter helper using boost url, parsing links, and auto-guessing ports for http schemes, with inline headers and future-proofing for an open source project.
Learn to map url schemes to ports by building a vector of string pairs, searching for a matching scheme, and returning the corresponding port with basic testing.
Design and serialize an http request object for API calls by creating an http request serializer, defining http methods like get or post, and populating host, path, and version fields.
Create a get request helper using the HTTP client's request generator to build a simple get request with a single URL and path, and validate it with a unit test.
Set up a Visual Studio unit test with Catch2, wire in the HTTP client, and validate connection parameter parsing for HTTP and HTTPS, including ports and a get request generator.
Acquire OpenSSL to enable https support on Windows using binaries from SLP Pro Web.com. Place the include and library files, plus DLLs, in a third-party directory for development.
Prepare an OpenSSL SSL context for the http client by integrating boost.asio, enabling optional https, certificate verification, and TLS configuration with TLS 1.3.
Determine when to use https by inspecting connection parameters to enable tls for https, compare http and https, and apply tls/ssl concepts in a practical shim-driven workflow.
Learn how to extend an HTTP client with TLS support by integrating an SSL context, initializing a TLS socket, and routing HTTPS requests correctly.
Build a TLS connect flow by swapping in a TLS stream for the raw socket, performing an async handshake after connect, configuring the SNI hostname, and handling OpenSSL errors.
Develop secure message exchange by enabling send async over TLS or raw sockets, serializing content and routing through the appropriate socket, with a templated sendmessage approach.
Read responses from https sockets with a templated async method, update deferred deletion, and verify tls read and write and http compatibility.
Secure a Boost.Asio HTTP client by enforcing TLS 1.2 or 1.3, verifying the server certificate with a trusted CA cert.pem, and loading it into the SSL context.
Demonstrates building an http client stress test by spinning up a local nginx http server and performing concurrent downloads to evaluate performance.
Implement concurrent HTTP client downloads to stress test the system, validate status codes 200 and response bodies, and tune the constructor concurrency to support multiple runs.
Explore adding threading to a concurrency test by launching multiple threads, guarding shared counters with a mutex, and printing results when you press enter to stop.
Explore adding randomness to download addresses with a link generator and random selection, and validate via concurrency stress tests and status code checks.
Add timings to the stress tester by logging connection and receive times in milliseconds, capturing before connect, after connect, and received timestamps to analyze latency.
Good software developers invest considerable time into learning. Learning programming languages, techniques, getting the basics, and having a clear theoretical knowledge is a starting point and is definitely necessary. Though, what comes next is often even more valuable. Unfortunately, many times it is ignored.
“Gaining real-life experience while developing something actually useful and doing it together with someone who knows what s/he is doing”.
Doing homework, reading, or writing code snippets have their own merits, but some things can only be learned through experience. It is through this valuable experience that you actually internalize what you have been learning. You learn what to do and what not to do, when and where.
The very first steps of human improvement involve imitation of successful behavior. Many of us who are lucky enough to have a senior developer that we can observe at work, have already somewhat understood this fact. For the rest of us who does not have a relevant senior developer close to us, or for those of us who still feels lacking experience about certain subjects, this course is for you.
In “Code Together” series you will actively observe a senior developing a practically useful piece of software. We will
- prepare a minimal work definition
- write samples
- design an API
- do the implementation
together with you. You are advised to actively follow the work being done
- by listening/watching carefully
- by stopping the videos and writing/replicating the code yourself
or even redesigning things where you see appropriate.
The code we show in this lecture is available as an opensource project on github.
In this episode we will be developing a client and a server with http(s) support.
By the end of this course, you will have experience on
- how to implement
o http clients
o API definitions
o sample apps
- how to use boost asio
- how to implement proper lock-safe multitasking. (i.e. using minimal number of locks or no locks at all)
Above all, you will accumulate useful experience about how a seasoned developer thinks and approaches things.