当前位置:网站首页>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
边栏推荐
猜你喜欢
Verilog design responder [with source code]
Activity lifecycle
OneDNS助力高校行业网络安全
Array object sorting
90后,辞职创业,说要卷死云数据库
一度辍学的数学差生,获得今年菲尔兹奖
2021-04-23
Learning notes | data Xiaobai uses dataease to make a large data screen
Drive HC based on de2115 development board_ SR04 ultrasonic ranging module [source code attached]
自动化测试框架
随机推荐
oracle常见锁表处理方式
Verilog 实现数码管显视驱动【附源码】
使用引用
Use metersphere to keep your testing work efficient
Creative information was surveyed by 2 institutions: greatdb database has been deployed in 9 places
面试被问到了解哪些开发模型?看这一篇就够了
Debezium同步之Debezium架构详解
Electron adding SQLite database
Force buckle 1002 Find common characters
高考作文,高频提及科技那些事儿……
About the application of writing shell script JSON in JMeter
When initializing 'float', what is the difference between converting to 'float' and adding 'f' as a suffix?
Verilog design responder [with source code]
STM32入门开发 NEC红外线协议解码(超低成本无线传输方案)
毕业季|与青春作伴,一起向未来!
[untitled]
学习笔记|数据小白使用DataEase制作数据大屏
数据库同步工具 DBSync 新增对MongoDB、ES的支持
‘module‘ object is not callable错误
CentOS系统下Redis安装和自启动配置的步骤