HTTP,服务器相关

2018-07-12  本文已影响0人  饥人谷_7w7

URL组成;


image.png

Server + Client + HTTP+DNS:


image.png
请求方式 命令 请求内容 响应内容
GET(默认) curl -s -v -H "Frank: xxx" -- "https://www.baidu.com" GET / HTTP/1.1 Host: www.baidu.com User-Agent: curl/7.54.0 Accept: / Frank: xxx HTTP/1.1 200 OK Accept...Ranges: bytes...<!DOCTYPE html><html> <head> 后面太长,省略了……
POST curl -X POST -s -v -H "Frank: xxx" -- "https://www.baidu.com" POST / HTTP/1.1 Host: www.baidu.com User-Agent: curl/7.54.0Accept: / HTTP/1.1 200 OK Accept-Ranges: bytes...
带数据请求 curl -s -v -H -d "777" -- "https://www.baidu.com" POST / HTTP/1.1 Host:www.baidu.com...回车行1234567890 HTTP/1.1 302 Found...Connection: Keep-AliveContent-Length: 17931..
... ... ... ...

请求内容格式:
1 动词 路径 协议/版本
2 Key1: value1
2 Key2: value2
2 Key3: value3
2 Content-Type: application/x-www-form-urlencoded
2 Host: www.baidu.com
2 User-Agent: curl/7.54.0
3
4 要上传的数据

响应内容格式:
1 协议/版本号 状态码 状态解释
2 Key1: value1
2 Key2: value2
2 Content-Length: 17931
2 Content-Type: text/html
3
4 要下载的内容

状态码说明:

Chrome中查看响应内容:
查看 Response Headers,点击「view source」,你会看到响应的前两部分
查看 Response 或者 Preview,你会看到响应的第 4 部分


Request请求头:
content-type:application/x-www-form-urlencoded
(将中文转译,,,成UTF-8,,每个字%隔开)

参考:https://blog.csdn.net/qq_24145735/article/details/50363528?locationNum=13&fps=1

上一篇 下一篇

猜你喜欢

热点阅读