Migrated
This commit is contained in:
90
Web Engineering/Foundations of the Web.md
Normal file
90
Web Engineering/Foundations of the Web.md
Normal file
@ -0,0 +1,90 @@
|
||||
---
|
||||
type: practical
|
||||
---
|
||||
The web $\neq$ The internet
|
||||
|
||||

|
||||
As portrayed in CN
|
||||
|
||||
|
||||
## URIs
|
||||
A **URI (Uniform Resource Identifier)** identifies a resource, either by its name or location, and includes both URLs and URNs. A **URL (Uniform Resource Locator)** is a type of URI that specifies the exact location of a resource on the web, including its access method (e.g., HTTP, FTP).
|
||||
|
||||
Bad naming...
|
||||
|
||||
* URLs and URNs are **URI Schemes**
|
||||
* URLs - `transport://user:password@host:port/path[?search][#fragmentid]`
|
||||
* URNs - Is a logical address of a resource
|
||||
|
||||
|
||||
## HTTP
|
||||
- Port 80 usually
|
||||
- TCP
|
||||
### MIME
|
||||
**MIME (Multipurpose Internet Mail Extensions)** is a standard that extends email and web protocols to support text in character sets other than ASCII, as well as attachments like images, audio, video, and other file types.
|
||||
|
||||
**HTTP does not have these built-in!**
|
||||
|
||||
- No state retained between request/response pairs
|
||||
- Connections **can** persist
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
| Term | Explanation |
|
||||
| ------------- | ----------------------------------------------- |
|
||||
| Origin Server | Server where resources reside |
|
||||
| Proxy | Program that can act on behalf of origin server |
|
||||
| Gateway | Intermediary for some other server |
|
||||
| Tunnel | Relay between two connections (blindly) |
|
||||
|
||||
---
|
||||
### Content negotiation
|
||||
- Content can be available in multiple variants
|
||||
- Representation is to be served based on the **content negotiation mechanism**
|
||||
|
||||
|
||||
| Type of content negotiation | Description |
|
||||
| --------------------------- | -------------------------------------------------------------------- |
|
||||
| Server-driven | Client includes headers and server tries to find stuff based on them |
|
||||
| Client-driven | Server responds with a list of available types and client picks |
|
||||
|
||||
---
|
||||
|
||||
### Messages & methods
|
||||
|
||||
Cool diagram expressing how protocols are being nested:
|
||||

|
||||
|
||||
#### Request message (BNF)
|
||||
|
||||
```js
|
||||
|
||||
HTTP-message = request-line | status-line message-header* CRLF message-body? message-header = general-header | entity-header | request-header | response-header (general | entity | request | response)-header = field-name ":" field-content CRLF
|
||||
```
|
||||
|
||||
|
||||
#### **General Headers**
|
||||
- `Cache-Control`: Caching directives.
|
||||
- `Connection`: Manage persistent connections.
|
||||
- `Transfer-Encoding`: Encoding (e.g., `chunked`, `gzip`).
|
||||
- `Via`: Tracks intermediaries and routing.
|
||||
|
||||
#### **Entity Headers**
|
||||
- `Content-Encoding`: Compression (e.g., `gzip`).
|
||||
- `Content-MD5`: Body integrity check.
|
||||
- `Expires`: Response expiry date.
|
||||
- `Last-Modified`: Last entity update timestamp.
|
||||
|
||||
|
||||
|
||||
### Request methods
|
||||
- GET, DELETE, POST, PUT, etc.
|
||||
- They NEED to be used accordingly, although you are not forced to do it at all
|
||||
- Idempotent[^1] requests are side-effects free
|
||||
|
||||

|
||||
|
||||
|
||||
[^1]: Describing an action which, when performed multiple times, has no further effect on its subject after the first time it is performed.
|
Reference in New Issue
Block a user