Lesson 15: [Coming Soon] HTTP Request Handling
Build a basic HTTP server in pure Erlang - parse requests, generate responses, and handle the HTTP protocol for WebSocket upgrade handshakes
HTTP Request Handling
Coming Soon
This lesson will teach you how to build a basic HTTP server in pure Erlang to handle web requests and WebSocket upgrades. You’ll learn how to:
- Parse HTTP requests and extract headers
- Generate proper HTTP responses
- Handle different HTTP methods (GET, POST, OPTIONS)
- Implement content negotiation and MIME types
- Prepare for WebSocket protocol upgrades
What You’ll Build
By the end of this lesson, you’ll have implemented:
- A basic HTTP server with request parsing
- HTTP response generation with proper headers
- Static file serving for your chat client
- CORS handling for cross-origin requests
- Foundation for WebSocket upgrade handshakes
Key Concepts Preview
% HTTP request parsingparse_request(Data) -> [RequestLine | Headers] = string:split(Data, "\r\n", all), [Method, Path, Version] = string:split(RequestLine, " ", all), ParsedHeaders = parse_headers(Headers), {Method, Path, Version, ParsedHeaders}.
This lesson builds on the TCP socket programming from Lesson 13 and prepares you for the WebSocket protocol implementation we’ll explore in Lesson 15.
This lesson is currently under development. Check back soon for the complete content!
Finished this lesson?
Mark it as complete to track your progress
This open source tutorial is brought to you by Pennypack Software - we build reliable software systems.
Found an issue? Edit this page on GitHub or open an issue