The HTTP protocol

The Hypertext Transfer Protocol (HTTP) is built on top of the TCP. When you type a URL in a browser, the browser opens a TCP channel to the server (after DNS lookup, of course) and sends an HTTP request to the web server. The server, after receiving the request, produces a response and sends it to the client. After that, the TCP channel may be closed or kept alive for further HTTP request-response pairs.

Both the request and the response contain a header and an optional (possibly zero-length) body. The header is in text format, and is separated from the body by an empty line.

More precisely, the header and the body are separated by four bytes0x0D, 0x0A, 0x0D, and 0x0A, which are two CR, LF line separators. The HTTP protocol ...

Get Java Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.