add posts
0
public/api/i/2025/09/18/119exsd-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 206 KiB |
0
public/api/i/2025/09/20/10gf9ih-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
0
public/api/i/2025/09/20/10gsu60-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
0
public/api/i/2025/09/20/10h4100-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
0
public/api/i/2025/09/20/10hjla3-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
0
public/api/i/2025/09/20/10hnekj-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
0
public/api/i/2025/09/20/10i2nlq-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
0
public/api/i/2025/09/20/10i6pio-1.webp
Normal file → Executable file
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
BIN
public/api/i/2025/09/21/u993u3-1.webp
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/api/i/2025/09/21/ua8smj-1.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
public/api/i/2025/09/21/uab784-1.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/api/i/2025/09/21/uduata-1.webp
Normal file
|
After Width: | Height: | Size: 38 KiB |
36
src/content/posts/计算机网络/HTTP中GET和POST的区别是什么.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
title: HTTP中GET和POST的区别是什么
|
||||||
|
published: 2025-09-21
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: [计算机网络,HTTP]
|
||||||
|
category: '计算机网络'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
# HTTP中GET和POST的区别是什么
|
||||||
|
## 从HTTP定义看
|
||||||
|
从HTTP定义看
|
||||||
|
GET用来获取资源。通常用来请求数据,不改变服务器状态
|
||||||
|
POST用来提交数据到服务器,通常会改变服务器状态或者产生副作用(比如创建或者更新资源)
|
||||||
|
|
||||||
|
## 参数传递
|
||||||
|
GET是通过URL拼接来实现参数传递的,暴露在请求URL中,有可见性,长度有限。(2048字节)
|
||||||
|
POST把参数放在请求体里面,通常不可见而且长度理论上也没有限制,更适合传递大量数据(nginx默认限制为1M)。
|
||||||
|
|
||||||
|
## 安全性
|
||||||
|
GET: 参数可见,数据容易暴露在浏览器历史记录,日志和缓存中,不适合传递敏感信息。
|
||||||
|
POST: 数据放在请求体中,相对安全,但需要HTTPS才能保证数据加密传输。
|
||||||
|
|
||||||
|
## 幂等性
|
||||||
|
GET: 幂等的(重复请求不会改变服务器状态)
|
||||||
|
POST: 非幂等的(多次请求可能导致重复创建资源或者执行多次相同的操作)
|
||||||
|
|
||||||
|
|
||||||
|
## RESTful API设计中的角色分工
|
||||||
|
- GET 用来查询或者检索资源数据
|
||||||
|
- POST: 用来创建资源或者执行某些动作
|
||||||
|
- PUT和PATCH: 用来更新资源 PUT替换整个资源,PATCH更新部分资源
|
||||||
|
- DELETE: 用来删除资源。
|
||||||
|
|
||||||
32
src/content/posts/计算机网络/HTTP请求中包含哪些内容请求头和请求体有哪些内容.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
title: HTTP请求中包含哪些内容请求头和请求体有哪些内容
|
||||||
|
published: 2025-09-21
|
||||||
|
description: ''
|
||||||
|
image: ''
|
||||||
|
tags: [HTTP,计算机网络,请求头,请求体]
|
||||||
|
category: '计算机网络'
|
||||||
|
draft: false
|
||||||
|
lang: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
# HTTP请求由以下几部分组成:
|
||||||
|
- 请求行(请求方法,请求资源路径,HTTP协议版本)
|
||||||
|
- 请求头
|
||||||
|
- 空行
|
||||||
|
- 请求体
|
||||||
|
|
||||||
|
# 常见请求头与请求体
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# URI URL URN
|
||||||
|
URI
|
||||||
|
├─ URL(通过“位置+协议”定位资源)
|
||||||
|
└─ URN(通过“唯一名称”标识资源,与位置无关)
|
||||||