HTTP

Hypertext Transfer Protocol is an application protocol for distributed information systems. HTTP is the foundation of data communication for the Internet. It is a request-response protocol in which the client sends a request to the server. The server then either provides a resource or performs a function on behalf of the client and sends a response message back to the client. The response contains a status code and possibly a body containing the requested resource or other information.

Sessions

An HTTP session is a sequence of network request-response transactions. An HTTP client initiates a request by establishing a TCP connection to a particular port on a server (usually 80).

Persistent Connections

In HTTP/0.9 and 1.0, the connection is closed after a single request/response pair. A keep-alive mechanism was introduced in HTTP/1.1, where a connection could be reused for more than one request. This reduced request latency because the client does not need to re-negotiate the TCP 3-way handshake connection after the first request has been sent.

Request Methods

HTTP defines methods to indicate the desired action to be performed on the resource.

MethodDescription
GETRetrieve data
HEADSame as GET but without the body
POSTSend data
PUTSend data and modify the server’s copy
DELETEDelete a resource
TRACEEcho the received request
OPTIONSReturn HTTP methods that the server supports
CONNECTConvert the request connection to a TCP/IP tunnel
PATCHApply partial modifications to a resource

Status Codes

All HTTP responses include a status code to indicate the success of the request. In addition to the code, a status message accompanies it for humans to read. There are 5 main groups of status codes:

CodeDescription
1XXInformational - the request was received, continuing process
2XXSuccessful - the request was successfully received, understood and accepted
3XXRedirection - further action needs to be taken in order to complete the request
4XXClient Error - the request contains bad syntax or cannot be fulfilled
5XXServer Error - the server failed to fulfill an apparently valid request

Reference: List of HTTP Status Codes

HTTPS

HTTPS is an extension of HTTP by securing the communication protocol with TLS (previously SSL).