Client-Server-Model Flashcards
What is a server?
A server is a computer program /hardware/ that provides functionality for other programs or devices, called “clients”. This architecture is called the client–server model.
Servers can provide various functionalities, often called “services”, such as sharing data or resources among multiple clients, or performing computation for a client.
What is a client?
Client is a piece of computer software that accesses a service made available by a server as part of the client–server model of computer networks.
The server is often (but not always) on another computer system, in which case the client accesses the service by way of a network.
HTTP Messages
HTTP messages are how data is exchanged between a server and a client. There are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server.
What three things are on the start-line of an HTTP request message?
- An HTTP method, a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed.
- The request target, usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context. The format of this request target varies between different HTTP methods.
- The HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
What three things are on the start-line of an HTTP response message?
- The protocol version, usually HTTP/1.1.
2/ A status code, indicating success or failure of the request. Common status codes are 200, 404, or 302 - A status text. A brief, purely informational, textual description of the status code to help a human understand the HTTP message.
A typical status line looks like: HTTP/1.1 404 Not Found.
What are HTTP headers?
An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.
For example, a request message can use headers to indicate it’s preferred media formats, while a response can use header to indicate the media format of the returned body.
What is on the first line of an HTTP response message?
The status line is the first line in the response message. It consists of three items: The HTTP version number, showing the HTTP specification to which the server has tried to make the message comply. A status code, which is a three-digit number indicating the result of the request.
Is a body required for a valid HTTP message?
No, body is optional, it is containing data associated with the request (like content of an HTML form), or the document associated with a response. The presence of the body and its size is specified by the start-line and HTTP headers.