What is a client?
A machine that requests data or services from a server. In the case of the web, browsers are clients that request HTML pages from servers.
Can a single machine be both a client and a server?
Yes, a machine can be both a client and a server at the same time. For instance, a single machine could act as a server for end users and as a client for a database.
What is a server?
A server is a machine that provides data or services for a client.
What is the client-server model?
The client-server model is a paradigm where clients request data or services from servers, and servers provide data or services to clients. (Request response cycle)
What happens when you go to www.google.com?
We run through the system of Domain Name System (DNS)
Your browser looks in local cache to see if website was visited before and is IP address is known. If the IP address can’t be found, we go through the rest of the Domain Name System process
Break down this url:
https://www.algoexpert.io:443/frontend
https: scheme/protocol
www: subdomain
algoexpert: domain
.io: top-level domain
443: port
/frontend: path
What is an IP address?
A unique identifier for a computer on the internet
How to find an IP address for a computer on the internet?
We use the Domain Name System (DNS)
What is TCP?
TCP stands for Transmission Control Protocol. It is a way for the client and server to make sure they’re on the same page on how they’re going to send information from one computer to the other.
TCP is a connection-oriented protocol, which means that it requires a connection to be established between two devices before data can be sent.
What is HTTP?
Common Status Codes:
200, 201
200 : OK
201: Created
Common Status Codes:
301, 302
301: Moved Permanently
302: Found (Moved Temporarily)
Common Status Codes:
400, 401, 403, 404
400: Bad Request
401: Unauthorized
403: Forbidden
Common Status Codes:
500, 503
500: Internal Server Error
503: Service Unavailable
What is HTTPS?
What is an API?
Allows computers to communicate with each other
What is REST?
**Remember first two!!!
- Client-server model (independent of each other)
- Stateless (each request must contain all of the information necessary to be understood by the server, rather than be dependent on the server remembering prior requests)
What is Same-Origin Policy?
A policy limiting the ability of a page from reading resources from different origins. Two resources are from the same origin only if they have the same protocol, host, and port.
What is Same-Origin Policy?
A policy limiting the ability of a page from reading resources from different origins. Two resources are from the same origin only if they have the same protocol, host, and port.
What is an XSS attack?
XSS stands for cross-site scripting attack. It is An attack where an attacker is able to run code on a vulnerable site, thus circumventing the same-origin policy.
E.g: Attackers inject javascript code into UI
What is a CSRF attack?
CSRF stands for cross-site request forgery attack. An attack sends a request to a server and is able to convince the server its client sent it.
How to prevent a CSRF attack?
Utilizing a CSRF token, which is a unique token given to the client that a forged request would not be able to replicate.
What is CORS?
CORS stands for cross-origin resource sharing. A server can allow cross-origin requests by including the access-control-allow-origin header.
How to prevent an XSS attack?