foundations of the web Flashcards
what is an ISP and what does it do?
internet service provider. this acts as a gateaway. it provides internet services such as internet transit and web hosting
what is POP
point of presence: artificial interface point between the local networks and the ISPs network.
what is an IXP
internet eXchange points. where networks of isp’s connect.
How are the terms URI, URL, and URN defined, what is their
purpose, and what is the relation between them
- 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. - 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. - 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.
what is a proxy server?
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
what are the most well known proxies and what do they do (2)?
- 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)
what is http?
hypertext transfer protocol
which types of content negation exist for http
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
whats a CDN
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.
Describe the different connection management strategies used
by the HTTP versions 1.0, 1.1 and 2
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.
Under which conditions are HTTP requests safe/idempotent?
Which HTTP methods are considered safe/idempotent?
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.
What are the differences between PUT and POST in terms of
request URI semantics, and pragmatics (i.e. how they are to be
used)
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.
Name and describe the main methods used in HTTP
- 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. - 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. - 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. - 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. - 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
name and describe the support http methods:
- CONNECT: This request establishes a tunnel to the server identified
by the target resource. It is not safe nor idempotent. - 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. - OPTIONS: This requests returns the possible communication op-
tions of the target resource. This request is safe and therefore also
idempotent. - 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.
What are the different status codes for HTTP responses and
when are they used?
- 1xx Informational: Informs client that the request has been received
and will be processed further. - 2xx Sucess: Informs client that the request has been successfully re-
ceived, accepted and understood. - 3xx Redirection: Informs the client that further action must be taken
in order to complete the request. - 4xx Client Error: Informs the client that the request contains bad
syntax or cannot be fulfilled. - 5xx Server Error: Informs the client that the server failed to fulfill an
apparently valid request