HTTP Flashcards
What does HTTP stand for?
Hyper Text Transfer Protocol.
What is the default port of HTTP?
80
What is HTTP?
Stateless protocol that defines how messages are formatted and transmitted, and what actions servers and clients should take in response to various commands.
What are 4 basic aspects of HTTP?
- Simple: simple and human readable.
- Extensible: through use of headers.
- Stateless (but not session-less): no limit between requests being carried with same connection. HTTP cookies allow for stateful sessions.
- Connections: Most commonly relies upon connection based TCP.
What are the three pillars of HTTP communication?
- URL structure.
- Verbs.
- Status codes.
What are the three basic components of HTTP based systems.
- Client
- Web server
- Proxies
What is the client component of an HTTP based system?
The “User-agent”. Any tool that acts on behalf of a user (browser, phone). Always initiates the request.
What is the web-server component of an HTTP based system?
The server which handles the request of the client.
What is the proxy component of HTTP based systems?
Machines operating at the application layer that relay HTTP messages. Functions include: 1. caching 2. filtering 3. load balancing 4. authentication 5. logging
What are the layers for HTTP?
HTTP, TCP, IP
What are the layers for HTTPS?
HTTP, SSL or TLS, TCP, IP
What made up http 1.0?
- Building extensibility.
- Versioning info sent with each request.
- Status code sent in response.
- HTTP headers introduced.
- Transmission of more than HTML.
What made up HTTP 1.1?
- Standardized protocol.
- Connection reuse.
- Pipelining: 2nd req made before 1st received.
- Support for chunked responses.
- Additional cache-control mechanisms.
- Content negotiation between endpoints.
- Server collocation.
What makes up HTTP 2?
- Greater performance.
- Binary protocol: cannot be read/created manually.
- Multiplexed: Parallel requests mad over the same connection.
- Compressed headers: removes duplication.
- Allows server to populate data in client cache in advance of being required.
What can be controlled by HTTP?
- Cache
- Relaxing origin constraint
- Authentication
- Proxy and tunneling
- Sessions
What is the process for two endpoints for request and response?
CLIENT- resolve IP address from host name w/ DNS lookup.
CLIENT- establish connection with server.
CLIENT- send request to server.
CLIENT- wait for response.
SERVER- process request, send response.
CLIENT- receive response.
CLIENT- close connection.
What is HTTP flow from client perspective?
- Connect to server via TCP.
- Send HTTP message to server.
- Read response from server.
- Close or reuse connection for more requests.
What are the two types of HTTP messages?
request and response.
What are the components of an HTTP request message?
- method, path, protocol version
- headers (optional)
- blank line
- body (optional)
What are the components of an HTTP response message?
- protocol version, status code, status message
- headers (optional)
- blank line
- body (optional)
What does URL stand for?
Uniform Resource Locator.
What are the parts of a URL?
protocol, host, port, resource path, query
What are the verbs used in HTTP?
GET POST PUT DELETE HEAD TRACE OPTIONS
What does the GET verb indicate?
Fetch an existing resource?
What does the POST verb indicate?
Create a new resource. Usually carries a payload that specifies the date for the new resource.
What does the PUT verb indicate?
Update an existing resource. Payload may contain the data to update the resource.
What does the DELETE verb indicate?
Delete an existing resource.
What does the HEAD verb indicate?
Identical to GET except server must not send a message body in the response.
What does the OPTION verb indicate?
Request for information about the communication options available on the request/response channel.
What does the TRACE verb indicate?
Invoke a remote, application-layer loop-back of the request message.
When is a request idempotent?
When a single execution of the entire sequence always yields a result that is not changed by a re-execution of all, or part, of that sequence.
What methods are idempotent
GET, HEAD, PUT, DELETE. OPTIONS and TRACE should always be as well.
What are the headers that are share between both request and response messages?
Cache-Control Connection Date Pragma Trailer Transfer-Encoding Upgrade Via Warning
What are the entity headers?
Allow Content-Encoding Content-Language Content-Length Content-Location Content-MD5 Content-Range Content-Type Expires Last Modified
What is an HTTP cookie?
Small piece of data a server sends to a users web browser. Typically used to tell if two requests came from the same browser. Remember stateful information.
What are the three reasons to use cookies?
- Session management
- Personalization
- Tracking
How is a cookie created?
With the Set-Cookie head in a server response message.
What are different caches associated with HTTP?
Private cache: Dedicated to a single user. Holds all docs downloaded via HTTP by the user.
Shared Proxy Caches: Shared cache that stores responses to be used by more than one user.
What is the header used in request messages to define caching policies?
Cache-Control
What is the web-storage API?
A mechanism by which browsers can store key/value pairs in a more intuitive way than cookies.
What is Session storage in web-storage?
Storage for browser that maintains a separate area for each origin thats available for the duration of the page session.
What is Local storage in web-storage?
Same as Session storage but persists even when browser is closed.
What is the answer to minimizing network delays and creating a smooth experience for the client?
Parallel connections in combination with persistent connections.