foundations of the web Flashcards

1
Q

what is an ISP and what does it do?

A

internet service provider. this acts as a gateaway. it provides internet services such as internet transit and web hosting

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

what is POP

A

point of presence: artificial interface point between the local networks and the ISPs network.

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

what is an IXP

A

internet eXchange points. where networks of isp’s connect.

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

How are the terms URI, URL, and URN defined, what is their

purpose, and what is the relation between them

A
  1. URI (Uniform Resource Identifier):
    URIs are texts used to uniquely identify any resource or name on the
    internet. They are subcatigorized into URLs and URNs.
  2. URL (Uniform Resource Locator):
    URL includes location as well as the protocol to retrieve the resource.
    Protocols could be ftp://, https:// or ldap://. In the example below
    you can see the protocol is http:// and the location is thinkzara-
    hatke.com we are trying to access the resource amty.html.
  3. URN (Uniform Resource Name):
    URN stands for Uniform Resource Name. URN is also the subset
    of URI. One of the best examples of URN is ISBN number which is
    used to uniquely identify a book. URN is completely different than
    URL as it doesn’t include any protocol.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is a proxy server?

A

is a program acting on behalf of the origin server. a client sends requests to the proxy. if the proxy cant give the resource itself then it’ll send a request to the origin server

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

what are the most well known proxies and what do they do (2)?

A
  • forward proxy (gives user access to the internet in an otherwise firewall-restricted network)
  • reverse proxy (typically sits behind a firewall in a private network and directs client requests to the appropriate backend server)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is http?

A

hypertext transfer protocol

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

which types of content negation exist for http

A

1) server driven
the client reports the fvoured content type using a header in their request and the server tries to satisfy that
2) client driven
the server reponds to a request with a list of possible variants. the user then chooses one of the variants best suited

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

whats a CDN

A

A content delivery network (CDN) provides fast delivery of internet con-
tent. A CDN allows for the quick transfer of assets needed for loading Internet content. They can be seen as ”reverse” edge proxys.

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

Describe the different connection management strategies used

by the HTTP versions 1.0, 1.1 and 2

A

HTTP 1.0 In this version of HTTP connections are short lived. For
each request a new connection is established between the client and
the server, which is closed as soon as the server has sent a response.
2. HTTP 1.1 In this version of HTTP multiple requests can be sent
in a consistent connection. Request processing is pipe-lined and the
connection is closed after the requests have been processed.
3. HTTP 2.0 In this version of HTTP only one connection is established
over which multiple multiplexed requests are sent and responded to. if one resourse cannot be sent, then in http1.1 it’ll block the rest of the requests but in http2.0 it won’t.

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

Under which conditions are HTTP requests safe/idempotent?

Which HTTP methods are considered safe/idempotent?

A

Safe: A HTTP request is considered safe if it does not alter the server
state. This means it leads to read-only operations.
The requests GET, HEAD, OPTIONS, TRACE are safe.

Idempotent: Idempotent requests have no side effects. This means the
same request can be repeated any number of times yielding the same re-
sult, the server will stay in the same state.
The requests GET, HEAD, OPTIONS, PUT, DELETE are idempotent.

NOTE: All safe methods are idempotent but not vice versa. POST and
PATCH are neither.

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

What are the differences between PUT and POST in terms of
request URI semantics, and pragmatics (i.e. how they are to be
used)

A

PUT: URI in a PUT request identifies the entity (within the resource) enclosed with the request. PUT should be used to create new entities or replace an old one on the
server. N requests of PUT will result in 1 entity with the provided data.

POST: URI in a POST request identifies the resource that will handle the
entity enclosed in the request. POST should be used to send data to the server and replace entities. N requests of POST will result in N different entities with the provided data.

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

Name and describe the main methods used in HTTP

A
  1. DELETE: This request is used to delete an entity from the server.
    It modifies the server state therefore it is not safe. Since the server
    cannot delete the same entity twice, DELETE is idempotent. The
    servers response only indicates that the resource has been marked for
    deletion, not that it has been deleted.
  2. GET: This request is used to retrieve a representation of a resource
    from the server. The resource is only retrieved and not changed at
    all. This makes GET a safe and idempotent request.
  3. POST: This request is used to send data to the server to update or
    create an entity. The data sent is stored in the body of the HTTP
    request. This means that this request is not safe, POST is not idem-
    potent since 2 POST requests with the same data create 2 distinct
    entities.
  4. PUT: This request is also used to send data to the server to update
    or create an entity. The data sent is stored in the body of the HTTP
    request. This means that this request is not safe. However, opposed
    to POST, 2 PUT requests with the same data only create 1 entity
    with the data, this makes PUT idempotent.
  5. PATCH: This request is used to send data to the server and partially
    update an entity. The data sent is stored in the body of the HTTP
    request. This means that this request is not safe. A PATCH request
    can be idempotent but does not have to be. An example of a non
    idempotent PATCH request would be appending data to an entity,
    while a PATCH request of the form PATCH /users/42 {”name”:
    ”john doe”} would be idempotent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

name and describe the support http methods:

A
  1. CONNECT: This request establishes a tunnel to the server identified
    by the target resource. It is not safe nor idempotent.
  2. HEAD: This request is almost identical to the GET request, however
    it does not retrieve the response body. This means if GET /users
    would return a list of users, then HEAD /users would make the
    same request but not return the list of users. HEAD is useful to
    check what a GET request would return without actually making a
    GET request (e.g. downloading a large file) or to validate cached
    response messages. Like GET this request is safe and idempotent.
  3. OPTIONS: This requests returns the possible communication op-
    tions of the target resource. This request is safe and therefore also
    idempotent.
  4. TRACE: This request returns only status codes resulting from the
    request. It performs a message loop-back test along the path to
    the target resource, providing a useful debugging mechanism. This
    method is safe and therefore also idempotent.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the different status codes for HTTP responses and

when are they used?

A
  1. 1xx Informational: Informs client that the request has been received
    and will be processed further.
  2. 2xx Sucess: Informs client that the request has been successfully re-
    ceived, accepted and understood.
  3. 3xx Redirection: Informs the client that further action must be taken
    in order to complete the request.
  4. 4xx Client Error: Informs the client that the request contains bad
    syntax or cannot be fulfilled.
  5. 5xx Server Error: Informs the client that the server failed to fulfill an
    apparently valid request
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

name 5 general http headers:

A
  1. Chache-Control: The Cache-Control HTTP header holds directives
    (instructions) for caching in both requests and responses. A given
    directive in a request does not mean the same directive should be in
    the response.
  2. Connection: The Connection general header controls whether or not
    the network connection stays open after the current transaction fin-
    ishes. If the value sent is keep-alive, the connection is persistent and
    not closed, allowing for subsequent requests to the same server to be
    done. The server will drop connection after response if close is set.
    8
  3. Transfer-Encoding: The Transfer-Encoding header specifies the form
    of encoding used to safely transfer the message body to the user. If
    set to chunked then the message body is sent as sequence of chunks.
    If set to gzip then the message body is coded in gzip-format.
  4. Via: The Via general header is added by proxies, both forward and re-
    verse proxies, and can appear in the request headers and the response
    headers. It is used for tracking message forwards, avoiding request
    loops, and identifying the protocol capabilities of senders along the
    request/response chain.
  5. Date: The Date general HTTP header contains the date and time at
    which the message was originated.
17
Q

what is caching

A

Caching is the re usage of previously fetched resources. Web caches reduce
latency and network traffic and thus lessen the time needed to display a
representation of a resource. The cache returns a resource that it stores
when it contains it, instead of redirecting the request to the main server.
Therefore, it is crucial that the resources only stay in the cache as long as
they did not change.

18
Q

what types of cache exist?

A
  1. Private cache: This type of cache is dedicated to one user only. A
    browser cache holds all documents downloaded via HTTP by the
    user.
  2. Shared cache: This type of cache stores data to be re used by more
    then one user. For example, an ISP or your company might have set
    up a web proxy as part of its local network infrastructure to serve
    many users so that popular resources are reused a number of times,
    reducing network traffic and latency.
19
Q

How is the principle of Semantic Transparency for HTTP defined? Under which conditions is it violated by the use of caches?

A

The principle of semantic transparency describes that the usage of a proxy or cache cannot have impact on the user or origin server. Each request
should yield the same result as if it has been served from the main server.
if cache holds a resource no longer valid, then it returns a different resource than if it were given by the origin serve thus undermining the principle of semantic transparency

20
Q

How can a server stop a proxy or client from caching a response?

A

A server should stop a caching when the resource is known to constantly
change. This can be done in two ways.
The header can carry a past date as the expiry date.
The cache-control header field is set to must-revalidate

21
Q

what does a web accelerator do?

A

prefetch common used websites from the web to reduce waiting time.

22
Q

the forward proxy differs from the reverse proxy in that:

A

the forward proxies all connect to the web server or immediately to the application host. (multiple copies of the webserver) that all implement the same logic so they are N multiple web servers talking to 1 webserver. this allows scalability for the amount of requests coming in.
the reserve proxy puts one proxy before multiple web servers to act as the same point of entry. The reverse proxy make the clients unaware that they are talking to one of the forward proxies (copies of the webserver). the reverse proxy thus decides what forward proxy (which of the copies of the web server) we are going to connect to.

23
Q

why do we do all this caching and proxy shit?

A

to reduce network traffic and reduce waiting time

24
Q

how to ensure cache consistency?

A
  • timestamps for expiry (saying the lifetime of a response is 0) because in cache there is freshness control that only allows something to become cache as long as it within the lifetime of the response
  • validity checking
  • add Age header (how long ago the initial response was sent) so the cache knows how long ago the response was sent. The you let it expire constantly so the cache control understands it cannot serve a request from cache. otherwise you can also specify as a server cache-control must revalidate.
25
Q

what is the problem of the cache determined expiry?

A

the headers that are necessary to tell the cache-control that you shouldn’t use cache, aren’t mandatory in the header. so otherwise you’ll have to use heuristics.

26
Q

what is a content deliverably network

A

it gets resources from origin servers and distributes those resources to other servers that are closer to a particular client. So then the proxy that the client connected to won’t connect to the original origina server but rather the closest by cdn node containing the resource