Blame
|
1 | # HTTP Requests |
||||||
| 2 | ||||||||
| 3 | The following are notes from MDN's articles on HTTP requests. |
|||||||
| 4 | ||||||||
| 5 | ||||||||
| 6 | ||||||||
| 7 | ||||||||
| 8 | ||||||||
| 9 | ### Compression |
|||||||
| 10 | - Important way to increase performance of a website |
|||||||
| 11 | - Lowers bandwidth |
|||||||
| 12 | - Not a concern of the web developer but rather of the browser and server. |
|||||||
| 13 | ||||||||
| 14 | #### File format compression |
|||||||
| 15 | - loss-less compression |
|||||||
| 16 | - lossy compression: jpeg meme |
|||||||
| 17 | ||||||||
| 18 | Some formats can be used for both types such as webp. |
|||||||
| 19 | Lossy compression is usually more efficient than loss-less. |
|||||||
| 20 | ||||||||
| 21 | Do not double compress (mostly)! |
|||||||
| 22 | ex: do not compress a jpeg, its already a compressed format. |
|||||||
| 23 | ||||||||
| 24 | #### End to end compression |
|||||||
| 25 | - compress body of message at server and do not decompress until client. |
|||||||
| 26 | - gzip and br |
|||||||
| 27 | - Browsers use proactive content negotiation, agent sends accept-encoding, server uses content-encoding. |
|||||||
| 28 | ||||||||
| 29 | ||||||||
| 30 | #### Compression dictionary transport |
|||||||
| 31 | modern compression standards can use dictionaries of frequently used data over just using data in the file. |
|||||||
| 32 | Typical for http responses. |
|||||||
| 33 | ||||||||
| 34 | ||||||||
| 35 | #### Hop by hop compression |
|||||||
| 36 | Similar to end to end compression. |
|||||||
| 37 | Difference is compression doesn't happen at resource server but rather in any of the nodes on the way to the client. |
|||||||
| 38 | See TE header and transfer encoding |
|||||||
| 39 | ||||||||
| 40 | In practice this is a transparent thing for the server and client, its rarely used. |
|||||||
| 41 | Mostly used when sending responses in chunks. |
|||||||
| 42 | Typically happens at proxy level (cloudflare?) |
|||||||
