HTTP Flashcards

1
Q

What is HTTP?

A

Hypertext Transfer Protocol? It is a stateless, application layer protocol for communicating between distributed systems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can HTTP support communication between a variety of host and clients and a mixture of networks configurations?

A

It assumes very little about a particular system and does not keep state between different message exchanges

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is HTTP a stateless protocol?

A

It assumes very little about a particular system and does not keep state between different message exchanges

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What protocol is the basis of HTTP?

A

TCP/IP or any other reliable protocol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the versions of HTTP?

A

HTTP/1.0, HTTP/1.1 and HTTP/2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the main differences between HTTP/1.0 and HTTP/1.1?

A

Persistent connections, chunked transfer-coding, fine grained caching headers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What URL stands for?

A

Uniform Resource Locator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a URL structure consisted of?

A

Protocol + Host + Port + Resource Path + Query: http://www.google.com:80/search?q=cats

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the resource path of a URL?

A

It is the local path to the resource on the server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a HTTP verb?

A

The action that should be performed on the host

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the request verbs?

A

GET, POST, PUT, DELETE, HEAD, TRACE, OPTIONS, CONNECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the GET verb?

A

Fetch an existing resource. The URL contains all the necessary information the server needs to locate and return the resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the POST verb?

A

create a new resource. PORT requests usually carry a payload that specifies the data for the new resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the PUT verb?

A

Update an existing resource. The payload may contain the updated data for the resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the DELETE verb?

A

Delete an existing resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Are PUT and DELETE specialized versions of the POST verb?

A

Yes. They may be packaged as POST requests with the payload containing the exact action: create, update or delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does the HEAD verb?

A

Similar to GET but without the message body. It is used to retrieve the server headers for a particular resource, generally to check if the resource has changed via timestamps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does the TRACE verb?

A

Used to retrieve the hops that a request takes to round trip from the server. Each intermediate proxy or gateway would inject its IP or DNS name into the “Via” header field. This can be used for diagnostic purposes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does the OPTIONS verb?

A

Used to retrieve the server capabilities. On the client side it can be used to modify the request based on what the server can support

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does the CONNECT verb?

A

Stabilises a tunnel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a proxy?

A

It is a server that acts as an intermediary for requests from clients seeking resources from other servers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a gateway?

A

Is a component that is part of two networks, which use different protocols. The gateway will translate one protocol into the other. A router is a special case of a gateway.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are status codes?

A

It is part of the server response that tells the client how to interpret it

24
Q

A header required to be accepted by all HTTP/1.1 clients

A

Transfer-Encoding

25
Q

To what class does the status code 1xx belongs?

A

Informational messages. Provisional class introduced in HTTP/1.1. The server can send a “Expect: 100-continue” message, telling the client to continue sending the remainder of the request, or ignore it if it has already sent it. HTTP/1.o clients ignore this header.

26
Q

To what class does the status code 2xx belongs?

A

Successful. Tells the client that the request was successfully processed.

27
Q

What does the status code 200 means?

A

OK

28
Q

What does the status code 202 means?

A

Accepted. Request was accepted but may not include the resource in the response. This is useful for async processing on the server side. The server may choose to send information for monitoring.

29
Q

What does the status code 204 means?

A

No content. There is no message body in the response.

30
Q

What does the status code 205 means?

A

Resent content. Indicates to the client to reset its document view.

31
Q

What does the status code 206 means?

A

Partial content. Indicates that the response contains partial content. Additional headers indicate the exact range and content expiration information.

32
Q

To what class does the status code 3xx belongs?

A

Redirection. This requires the client to take additional action.

33
Q

What does the status code 301 means?

A

Moved Permanently. The resource is now located at a new URL

34
Q

What does the status code 303 means?

A

See other. The resource is temporarily located at a new URL. The “Location” response header contains the temporary URL.

35
Q

What does the status code 304 means?

A

Not Modified. The server has determined that the resource has not changed and the client should use its cached copy.

36
Q

What is ETag?

A

Entity Tag. A hash of the client’s content. The server compares this with its own to check for modifications.

37
Q

To what class does the status code 4xx belongs?

A

Client Error. These codes are used when the server thinks that the client is at fault, either by requesting an invalid resource or making a bad request.

38
Q

What does the status code 400 means?

A

Bad request. The request was malformed.

39
Q

What does the status code 401 means?

A

Unauthorized. Request requires authentication. The client can repeat the request with the Authorization header.

40
Q

What does the status code 403 means?

A

Forbidden. Server has denied access to the resource

41
Q

What does the status code 405 means?

A

Method not allowed. Invalid HTTP verb used in the request line, or server does not support that verb.

42
Q

What does the status code 409 means?

A

Conflict. Server could not complete the request because the client is trying to modify a resource that is newer than the client’s timestamp.

43
Q

To what class does the status code 5xx belongs?

A

Server Error. Used to indicate a server failure while processing the request.

44
Q

What does the status code 501 means?

A

Not implemented. The server does not yet support the requested functionality

45
Q

What does the status code 503 means?

A

Service unavailable. Internal system failed or the server is overloaded.

46
Q

Transfer-Encoding: chunked means?

A

That the message body will be send in pieces. All HTTP/1.1 are required to accept it.

47
Q

What are the general headers?

A
Cache-Control
Connection
Date
Pragma
Trailer
Transfer-Encoding
Upgrade
Via
Warning
48
Q

Via header is…

A

Used in TRACE message and updated by all intermittent proxies and gateways

49
Q

Pragma header is…

A

Considered a custom header and may be used to include implementation-specif headers

50
Q

Date header is…

A

Used to timestamp the request/response message

51
Q

Upgrade header is…

A

Used to switch protocols and allow a smooth transition to a newer protocol

52
Q

Transfer-Encoder header is…

A

Generally used to break the response into smaller parts with the Transfer-Encoding: chunked value (HTTP/1.1)

53
Q

What are the entity headers?

A
Allow
Content-Encoding
Content-Language
Content-Length
Content-Location
Content-MD5
Content-Range
Content-Type
Expires
Last-Modified
54
Q

Custom/Unknown headers will be treated as … by the HTTP protocol.

A

Entity headers

55
Q

Example of request message

A
GET /articles HTTP/1.1
Host: www.articles.com (mandatory for HTTP/1.1)
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
Accept: text/html, application/xhtml+xml
56
Q

Example of a response status-line

A

HTTP/1.1 200 OK