Skip to content

Commit 6b5df11

Browse files
committed
Web topic updated,
1 parent dbe03ab commit 6b5df11

1 file changed

Lines changed: 67 additions & 6 deletions

File tree

‎topics/related/web.md‎

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,73 @@
22

33
### Resources
44

5-
tcp
6-
udp
7-
http
8-
http 2
9-
http verbs
10-
http caching
5+
- [IP Adress Basics](http://www.deepakvadgama.com/blog/ipaddress-basics-for-developers/)
6+
- [HTTP Overview](https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview)
7+
- [HTTP Statuses](https://httpstatuses.com)
8+
- [HTTP Caching](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching)
9+
10+
### TCP
11+
12+
- Transmission Control Protocol
13+
- Based on connections (involves 3-way handshake)
14+
- Guaranteed delivery of packets
15+
- Flow/Congestion control
16+
- 'TCP Fast Open' improves connection times
17+
- Good for sites, applications etc.
18+
19+
### UDP
20+
21+
- User Datagram Protocol
22+
- Delivery not guaranteed
23+
- Stateless, not connection based
24+
- Doesn't support ordering (to be handled by application)
25+
- Good for games, videos etc.
26+
27+
### HTTP Verbs
28+
29+
- HEAD, OPTIONS, GET, POST, PUT, DELETE
30+
31+
### HTTP Caching
32+
33+
- **ETag**: Fingerprint of the resource (eg: MD5 checksum), to indicate if resource is changed.
34+
- **no-cache, must-revalidate**: Re-use response only after re-validating if resource is updated.
35+
- **no-store**: Do not cache, and re-download for each request.
36+
- **max-age**: Amount in seconds the resource can be cached.
37+
38+
39+
### [HTTP Statuses](https://httpstatuses.com)
40+
41+
- 200: Ok
42+
- 400: Bad request
43+
- 401: Not authenticated
44+
- 403: Not authorized
45+
- 404: Not found
46+
- 500: Internal server error
47+
48+
### HTTP 2
49+
50+
- Why?: Top sites average 100 requests per page. Browsers allow max 6 connections. Min 35ms round trip per request. 80 byte header.
51+
- No head of line blocking.
52+
- Binary
53+
- Header compression. Does not send repeated headers.
54+
- Priority based
55+
- Prefetch
56+
- Server Push
57+
58+
### HTTPS (TLS)
59+
60+
- Transport Layer Security
61+
- Server port 443
62+
- Certificate: Public-Private key. Signed by Certificate Authority (Verisign, Symantec, Thawte etc). These well known CAs are shipped and managed by the browser.
63+
- Additional handshake on top of TCP
64+
65+
66+
### Security
67+
- **Origin**: protocol + host + port
68+
- **Same Origin Policy**: JavaScript can only access same origin. Can’t access other iframes. If you request JS from other origin the response cannot be read.
69+
- **CORS (Cross Origin Resource Sharing)**: Allow to get JS/CSS from other origins. Important for API providers.
70+
- **CSRF (Cross Site Request Forgery)**: Request originates from cross-site (potentially malicious) site. Can be avoided by Synchronized Token Pattern: Store token in cookie (can be read only by origin site) and pass that token along with every request as HTTP Param or Header (X-CSRF-TOKEN).
71+
- **XSS (Cross Site Scripting)**: Malicious scripts are injected into the HTML/JS resources. Can be avoided by escaping injected strings etc.
1172

1273

1374

0 commit comments

Comments
 (0)