HTTP 协议版本变化学习笔记

互联网发展至今,HTTP 协议已经发展了多个版本,分别为 HTTP/1.0、HTTP/1.1、HTTP/2.0、HTTP/3.0,本文将对这几个版本的变化进行学习笔记。 HTTP/1.0HTTP/1.0 是最早的 HTTP 协议版本,它的特点是: 每次请求都会建立一个新的 TCP 连接,请求结束后立即断开连接。 每个请求都会包含完整的请求头和请求体。 不支持持久连接,每次请求都需要重新建立连接。 不支持管道化,即同一个连接中不能同时发送多个请求。 HTTP/1.1HTTP/1.1 是对 HTTP/1.0 的改进,它的特点是: 支持持久连接(Keep-Alive),即同一个连接可以发送多个请求。 支持管道化,即同一个连接中可以同时发送多个请求。但是,由于 HTTP/1.1 中的管道化存在队头阻塞问题,所以很少被使用。默认为关闭状态,并且大多数浏览器也不支持。 所以我们认为 HTTP/1.1 不支持管道化 。 HTTP/1.1 的缺点: 队头阻塞问题:如果一个请求响应时间过长,那么后面的请求就会被阻塞。 明文传输:HTTP/1.1 的数据传输是纯文本且未加密的,容易被窃听。比如状态码 200 会被分为 2、0、0 三个字节传输。这点会在 HTTP/2.0 中得到改进。 头部冗余:每次请求都需要携带完整的请求头,头部信息冗余。 HTTPS在讲述 HTTP/2.0 之前,我们先来了解一下 HTTPS。 HTTPS 是在 HTTP 的基础上加入了 SSL/TLS 加密层,使得数据传输更加安全。HTTPS 的特点是: 数据加密:HTTPS 使用 SSL/TLS 加密传输数据,保证数据传输的安全性。 身份认证:HTTPS 使用证书机制对服务器和客户端进行身份认证,防止中间人攻击。 数据完整性:HTTPS 使用数字签名对数据进行完整性校验,防止数据被篡改。 加密方式:对称加密、非对称加密、数字签名。 通信前使用非对称加密协商对称加密的密钥,通信过程使用对称加密传输数据,保证数据传输的安全性。 HTTP/2.0HTTP/2.0 是对 HTTP/1.1 的重大升级,它的特点是: 头部压缩:HTTP/2.0 使用 HPACK 算法对头部进行压缩,如果请求头中包含相同的字段,只需要发送一次,后续请求只需要发送索引,接着从静态表或动态表中获取对应的值。解决了 HTTP/1.1 中头部冗余的问题。 ...

2024年06月27日 · 1 分钟 · Cassius0924

TCP 的常见拥塞控制算法学习笔记

TCP 的拥塞控制算法有几种: Tahoe Reno NewReno SACK BIC CUBIC BBR 笔记 MSS: Maximum Segment Size,最大分段大小。 ...

2024年06月27日 · 1 分钟 · Cassius0924

Windows Socket API 和 Linux Socket API

本文章主要介绍 Windows 下和 Linux 下的 Socket 编程区别,即 Windows Socket API 和 Linux Socket API 的区别。 头文件Windows 环境下的 Socket 编程需要以下头文件: <WinSock2.h> <WS2tcpip.h> 笔记 如果使用 MSVC 编译器,那么还需要使用预处理指令 #pragma comment(lib, "Ws2_32.lib") 来链接 Ws2_32.lib 库。 ...

2024年06月16日 · 2 分钟 · Cassius0924

macOS ClashX Pro 配置指南

mixed-port: 7890 # Linux 和 macOS 的 redir 代理端口 redir-port: 7892 # 允许局域网的连接 allow-lan: true # 规则模式:Rule(规则) / Global(全局代理)/ Direct(全局直连) mode: rule # 设置日志输出级别 (默认级别:silent,即不输出任何内容,以避免因日志内容过大而导致程序内存溢出)。 # 5 个级别:silent / info / warning / error / debug。级别越高日志输出量越大,越倾向于调试,若需要请自行开启。 log-level: info # Clash 的 RESTful API external-controller: '0.0.0.0:9090' # RESTful API 的口令 secret: '' dns: enable: true ipv6: true listen: '0.0.0.0:53' use-hosts: true enhanced-mode: fake-ip fake-ip-range: 198.18.0.1/16 nameserver: - 202.120.224.6 - 114.114.114.114 - 223.5.5.5 - 'tcp://223.5.5.5' fallback: - 'tls://223.5.5.5:853' - 'https://223.5.5.5/dns-query' fallback-filter: geoip: true ipcidr: - 240.0.0.0/4 # proxy provider start here proxy-providers: feiniao: type: http path: ./profiles/feiniao.yaml url: https://apiv1.v27qae.com/flydsubal/c8lr21z6wpiebqqx?clash=1&extend=1 interval: 36000 health-check: enable: true url: http://www.gstatic.com/generate_204 interval: 3600 yiyuan: type: http path: ./profiles/yiyuan.yaml url: https://sub1.smallstrawberry.com/api/v1/client/subscribe?token=d6e73f953b6053a3b263b73f9509375d decode-url: true interval: 36000 health-check: enable: true url: http://www.gstatic.com/generate_204 interval: 3600 # proxy provider end proxies: # socks5 - name: windowsServer type: socks5 server: 10.127.78.177 port: 7890 # username: username # password: password # tls: true # skip-cert-verify: true # udp: true # - {name: 🇮🇪 中国-爱尔兰 IPLC C04, server: ir04.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB} # - {name: 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C02, server: hkhe02.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB} # - {name: 🇮🇪 中国-爱尔兰 IPLC C03, server: ir03.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB} # - {name: 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C09, server: hkhe09.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB} # - {name: 🇨🇳 中国-香港 IEPL Equinix HK8 C 02 1Gbps HBO TVB, server: sg12.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true} # - {name: 🇨🇳 中国-爱尔兰 IPLC C05, server: ir05.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true} # - {name: 🇨🇳 中国-香港 IPLC Equinix HK2 C 06 1Gbps HBO TVB, server: sg06.cathayroute.com, port: 33400, type: ss, cipher: rc4-md5, password: SRCFiB, udp: true} proxy-groups: - name: Proxies type: select proxies: - 机场节点 - 自动选择 - 故障转移 # - name: 手动节点 # type: select # proxies: # - 🇮🇪 中国-爱尔兰 IPLC C04 # - 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C02 # - 🇮🇪 中国-爱尔兰 IPLC C03 # - 🇭🇰 香港 油尖旺御金·国峯 名氣通電訊 C09 # - 🇨🇳 中国-香港 IEPL Equinix HK8 C 02 1Gbps HBO TVB # - 🇨🇳 中国-爱尔兰 IPLC C05 # - 🇨🇳 中国-香港 IPLC Equinix HK2 C 06 1Gbps HBO TVB - name: feiniao type: select use: - feiniao - name: yiyuan type: select use: - yiyuan - name: 机场节点 type: select proxies: - feiniao - yiyuan - name: 故障转移 type: fallback url: 'http://www.gstatic.com/generate_204' interval: 7200 proxies: - feiniao - yiyuan - name: 自动选择 type: url-test url: 'http://www.gstatic.com/generate_204' interval: 300 use: - feiniao - yiyuan rule-providers: reject: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt" path: ./ruleset/reject.yaml interval: 86400 icloud: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt" path: ./ruleset/icloud.yaml interval: 86400 apple: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt" path: ./ruleset/apple.yaml interval: 86400 google: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt" path: ./ruleset/google.yaml interval: 86400 proxy: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt" path: ./ruleset/proxy.yaml interval: 86400 direct: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt" path: ./ruleset/direct.yaml interval: 86400 private: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt" path: ./ruleset/private.yaml interval: 86400 gfw: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt" path: ./ruleset/gfw.yaml interval: 86400 tld-not-cn: type: http behavior: domain url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt" path: ./ruleset/tld-not-cn.yaml interval: 86400 telegramcidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt" path: ./ruleset/telegramcidr.yaml interval: 86400 cncidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt" path: ./ruleset/cncidr.yaml interval: 86400 lancidr: type: http behavior: ipcidr url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt" path: ./ruleset/lancidr.yaml interval: 86400 applications: type: http behavior: classical url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt" path: ./ruleset/applications.yaml interval: 86400 rules: - DOMAIN-SUFFIX,visualstudio.com,DIRECT - DOMAIN-SUFFIX,azure.com,DIRECT - DOMAIN-SUFFIX,vscode.dev,Proxies - RULE-SET,applications,DIRECT - DOMAIN,clash.razord.top,DIRECT - DOMAIN,yacd.haishan.me,DIRECT - RULE-SET,private,DIRECT - RULE-SET,reject,REJECT - RULE-SET,tld-not-cn,Proxies - RULE-SET,gfw,Proxies - RULE-SET,telegramcidr,Proxies - MATCH,DIRECT

2024年06月16日 · 3 分钟 · Cassius0924

VS Code 设置网络代理指南

当你使用 VS Code 时,有时你可能需要配置网络代理来访问特定的网络资源(魔法)。 例如在局域网远程开发时使用 GitHub Copilot Chat 插件并且远程主机无魔法时就可以进行配置网络代理。 配置教程打开设置,搜索 proxy 找到 Http: Proxy,填入代理地址即可。 注意在远程开发时只能设置远程主机的Http代理,无法设置 VS Code 本机的网络代理。

2024年06月16日 · 1 分钟 · Cassius0924