December 10, 2012-- Updated the links about robots. This tutorial explains the simple, English-based structure of HTTP communication, and teaches you the practical details of writing HTTP clients and servers. HTTP is simple enough for a beginning sockets programmer, so this page might be a good followup to a sockets tutorial.
Knowing HTTP enables you to write Web browsers, Web servers, automatic page downloaders, link-checkers, and other useful tools.
This Sockets FAQ focuses on C, but the underlying concepts are language-independent.
The first half explains basic HTTP 1.0, and the second half explains the new requirements and features of HTTP 1.1.
This tutorial doesn't cover everything about HTTP; it explains the basic framework, how to comply with the requirements, and where to find out more when you need it.
If you plan to use HTTP extensively, you should read the specification as well-- see the end of this document for more details.
Before getting started, understand the following two paragraphs: Writing HTTP or other network programs requires more care than programming for a single machine.
Of course, you have to follow standards, or no one will understand you.
But even more important is the burden you place on other machines.
Write a bad program for your own machine, and you waste your own resources (CPU time, bandwidth, memory).
Write a bad network program, and you waste other people's resources.
Write a really bad network program, and you waste many thousands of people's resources at the same time.
Sloppy and malicious network programming forces network standards to be modified, made safer but less efficient.
So be careful, respectful, and cooperative, for everyone's sake.