当前位置:网站首页>Network protocol concept
Network protocol concept
2022-07-07 11:25:00 【Full stack programmer webmaster】
## Concept
Hypertext Transfer Protocol, Hypertext transfer ( Transfer ) agreement , It is a protocol formulated by the client and server to transmit text . structure WWW The specific three technologies are as follows :
WWW: world wide web, web – HTML: Hypertext Markup Language, Hypertext markup language – HTTP: Hypertext Transfer Protocol, Hypertext transfer ( Transfer ) agreement (HTTP yes TCP/IP Application layer protocol ) – URL: Uniform Resource Locator, Uniform resource locator symbol
> URI: Uniform Resource Identitier, Unified resource identifier ,URL yes URI Subset
## TCP/IP
“` application layer (http/https/websocket/ftp…) => Definition : Text transfer protocol | Transport layer (tcp/udp) => Definition : port | The network layer (ip) => Definition :IP | The link layer (mac& Data packets ) => Definition : Data packets ,MAC Address | Physical layer ( optical cable / cable / Switch / route / terminal …) => Definition : Physics “`
TCP/IP:
– Explain a : Represent the tcp The protocol and ip agreement – Explain two : If you follow the five layer network architecture ,TCP/IP Represents the general name of all protocol clusters except the application layer
TCP/IP connect: TCP/IP Three handshakes of : “` Be marked with syn Data packets of ————-> Be marked with syn/ack Data packets of client <————- server Be marked with ack Data packets of ————–> “`
TCP/IP finish: TCP/IP Four handshakes : “` fin <————- ack client( or server) ————-> server( or client) fin ————-> ack <————- “`
## HTTP message
HTTP The message consists of three parts : – Start Line – Headers – Entity Body
HTTP There are two types of messages : – Request message – response message
### Request message Start Line
grammar : < Method > < request URL> < edition >
#### HTTP Method
+ get: Access to resources , Do not carry http body, Support query parameters , size 2KB + post: Transfer resources ,http body, The default size is 8M,1000 individual input variable + put: Transfer resources ,http body, Resource update + delete: Delete resources , Do not carry http body + patch: Transfer resources ,http body, Existing resources are partially updated + head: obtain http header, Do not carry http body + options: Get supported method, Do not carry http body + trace: track , Return the request loopback information , Do not carry http body + connect: Establish tunnel communication
### response message Start Line
grammar : < Method > < Status code > < The reason the phrase >
#### HTTP Status Code
+ 200: ok + 301: Permanent redirection + 302: Temporary redirection + 303: Temporary redirection , Asked to use get Request resources + 304: not modified, Return cache , It has nothing to do with redirection + 307: Temporary redirection , Strict disobedience post To get + 400: Parameter error + 401: Not through http authentication + 403: forbidden, unauthorized + 404: not found, No resources exist + 500: internet server error, Code error + 502: bad gateway,fastcgi What's coming back web server Don't understand + 503: service unavailable, Service not available + 504: gateway timeout,fastcgi Response timeout
### HTTP Header Fields
Common general head
+ Cache-Control: – no-cache: Do not cache expired caches – no-store: Don't cache + Pragma: no-cache, Do not use cache ,http1.1 Previous history field + Connection: – The control is no longer forwarded to the agent header field – Keep-Alive/Close: Persistent connection + Date: establish http Date of message
Common request headers
+ Accept: Media types and priorities that can be handled + Host: Target host domain name + Referer: Where did the request originate from the original resource URI + User-Agent: The name of the user agent that created the request + Cookie: cookie Information
Common response headers
+ Location: Redirect address + Server: Requested service web server Information about + Set-Cookie: To set up cookie Information – NAME: Key value pairs to set – expires: cookie Expiration time – path: Specify send cookie The catalog of – domain: Specify send cookie Domain name of – Secure: Only https Send next cookie – HostOnly: After designation javascript Can't read cookie + Keep-Alive:
HTTP At the beginning of the agreement, it will be disconnected after each connection TCP Connect , after HEADER Of connection Field definition Keep-Alive(HTTP 1.1 Default Persistent connection ), Representatives will not disconnect if neither party actively disconnects TCP Connect , It reduces every time you create HTTP When connecting TCP Connection consumption .
## Cookie/Session
+ Cookie: The working mechanism is user identification and state management , In order to manage the user's status, the server will pass through the client , Write some temporary data into the device Set-Cookie, When users access services , The service can retrieve the previously stored cookie. + Session: because http It's stateless , Context cannot be maintained between requests , So there it is session As session control , The server stores the user's session information .
## HTTPs
Concept : stay http The agreement adds ssl(secure socket layer) layer .
“` SSL layer | application layer | Transport layer | The network layer | The link layer | Physical layer “`
HTTPS The certification process “`
Initiate request —————————> server Issue a certificate <————————— server Certificate digital signature ( Encrypt with certificate authority public key ) —————————> Certification body Certificate digital signature verification passed client( Built in certificate authority certificate ) <————————— Certification body Public key encryption random cipher string ( The shared secret key of the future ) —————————> server Private key decryption ( Asymmetric encryption ) SSL End of agreement HTTP Agreement start <————————— server( Symmetric encryption ) Shared secret key encryption HTTP —————————> server( Symmetric encryption ) “`
+ Check the certificate certificate : The public secret key of the certificate authority verifies the digital signature of the certificate + Public key encryption establishes a connection : Asymmetric encryption + Shared key encryption
## Websocket
+ be based on http The protocol establishes the connection ,header Of upgrade The field conversion protocol is websocket + Full duplex communication , The client establishes a connection
## HTTP2
+ Multiplexing : Multiple requests share one tcp Connect + Full duplex communication + must https:// + The head of compression + Binary transmission
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113826.html Link to the original text :https://javaforall.cn
边栏推荐
- electron添加SQLite数据库
- oracle常见锁表处理方式
- PR Lecture Notes
- QT | multiple windows share a prompt box class
- 博客搬家到知乎
- 對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
- 科普达人丨一文弄懂什么是云计算?
- [untitled]
- [STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
- The concept, implementation and analysis of binary search tree (BST)
猜你喜欢
The post-90s resigned and started a business, saying they would kill cloud database
[untitled]
关于测试人生的一站式发展建议
解决VSCode只能开两个标签页的问题
PostgreSQL中的表复制
在我有限的软件测试经历里,一段专职的自动化测试经验总结
RationalDMIS2022 高级编程宏程序
How to add aplayer music player in blog
通过 Play Integrity API 的 nonce 字段提高应用安全性
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
随机推荐
[untitled]
Go Slice 比较
深度学习秋招面试题集锦(一)
Avoid mutating a prop directly since the value will be overwritten whenever the parent component
常用sql语句整理:mysql
Vscode 尝试在目标目录创建文件时发生一个错误:拒绝访问【已解决】
【愚公系列】2022年7月 Go教学课程 005-变量
学习笔记|数据小白使用DataEase制作数据大屏
关于测试人生的一站式发展建议
The sixth training assignment
uniapp 在onLaunch中跳转页面后,点击事件失效解决方法
互联网协议
【问道】编译原理
Verilog design responder [with source code]
Android interview knowledge points
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)
Project ERROR: Unknown module(s) in QT: core gui
electron 添加 SQLite 数据库
After the uniapp jumps to the page in onlaunch, click the event failure solution
Drive HC based on de2115 development board_ SR04 ultrasonic ranging module [source code attached]