HTTP and HTTPS

Full stack development of dre 2021-07-20 04:12:26
http https


The foundation of network HTTP and HTTPS

Preface

Recently, I have learned HTTP and HTTPS Relevant knowledge , Because there is more content , Here's a summary of my mistakes

One 、HTTP

1.1 Definition

stay MDN Explain it like this

Hypertext transfer protocol (HTTP) It's a program for transferring hypermedia documents ( for example HTML) Application layer protocol . It is for Web Browser and Web Designed for communication between servers , But it can also be used for other purposes .HTTP Follow the classic client - Server model , The client opens a connection to make a request , Then wait until you receive a response from the server .HTTP Stateless protocol , This means that the server does not keep any data between the two requests ( state )

1.2 characteristic

  • Hypertext transfer protocol

  • be based on TCP/IP Application layer protocol of communication protocol

  • HTTP The default port number is 80

  • It's a stateless protocol

    Be careful : Stateless means having no memory for transactions , Such as adding, deleting, modifying and checking , Every time a browser makes a request , All return the same response content , Each response content is independent , The previous request could not get the content information of the previous request , This is not allowed in data interaction scenarios .

    Take a chestnut :

    Login status of the website 、 Add items to cart 、 Modify user information and other transaction scenarios , All of these need to be recorded after one operation , To ensure that when the browser refreshes or clicks on other pages , The previous request status will be recorded , Ensure the interaction between the two pages .

1.3 Request mode

The way describe
GET Request the specified page information , And return the entity body .
POST Submit data to the specified resource for processing request ( For example, submit a form or upload a file ). Data is contained in the request body .POST Requests may result in the creation of new resources or the modification of existing resources .

difference :

  • cache ---- GET Requests can be cached , and POST Will not be cached
  • visibility ---- GET The request data for is in URL China is visible to all , and POST The request data will not be displayed in URL in .
  • history ---- GET Request to keep in browser history , and POST It will not be saved to the browser record
  • Browser Bookmarks ---- GET Requests can be bookmarked , and POST Can't be bookmarked
  • Data length ---- GET Request has length limit , and POST The request has no limit on the length of the data
  • Security ---- GET comparison POST unsafe

1.4 HTTP1.0、HTTP1.1 The difference between

  • HTTP1.1 comparison HTTP1.0 Save bandwidth

  • Different cache processing
    stay HTTP1.0 Medium main use header Inside If-Modified-Since,Expires As the criterion of cache judgment .
    stay HTTP1.1 More cache control strategies are introduced, such as Entity tag,If-Unmodified-Since, If-Match, If-None-Match Wait for more alternative cache headers to control the cache policy .

  • Different connection modes and pipeline processing of requests
    HTTP1.0 Supports transient connections , Every time a browser sends a request, it needs to set up TCP Connect , Wait for the server to complete the request before disconnecting , And the server doesn't track and record past requests .
    HTTP1.1 Supports long connections , New request headers need to be added to help implement , And in the same TCP You can transfer multiple HTTP Requests and responses .

  • Host Head treatment is different
    stay HTTP1.0 Each server is bound to a unique IP Address , therefore , In the request message URL Host name not passed hostname.
    stay HTTP1.1 Both request and response messages support Host Header fields , And if there is no Host The header field will report an error :400 Bad Request.

  • New error notification management

    stay HTTP1.1 Added in 24 Error status response code .

1.5 HTTP1.1、HTTP2.0 The difference between

  • HTTP1.1 The parsing of text protocol is all kinds of parsing based on text protocol , and HTTP2.0 Protocol parsing for is in binary format , More powerful .

  • HTTP2.0 Support multiplexing : A connection can handle multiple requests concurrently .

    There can be more than one connection request, And can be mixed up randomly , Each is different request There are corresponding id, The server can use request_id To identify , Greatly speed up the transmission rate .

  • HTTP2.0 Supports header data compression : HTTP2.0 Yes header The data is compressed , Speed up network transmission .

    HTTP1.1 Medium header You need to carry a lot of information , And send it repeatedly every time .http2.0 Use encode To reduce the transmission of header size . And the client and the server can cache one copy each header filed surface , Avoided header Repeat transmission of , It can also reduce the size of the transmission .

  • HTTP2.0 Support server push : Through analysis html When resources in , When parsing to the import file , Return the required file (css perhaps js etc. ), Instead of making another request .

Two 、HTTPS

2.1 Definition

HTTPS( Safe HTTP) yes HTTP Encrypted version of the protocol . It usually uses SSL (en-US) perhaps TLS To encrypt all communication between client and server . This secure link allows clients to safely exchange sensitive data with the server , For example, online banking or online mall operations involving money .

2.2 characteristic

  • Content encryption : Using mixed encryption technology , The middleman can't directly view the plaintext content
  • Verify identity : Through the certificate authentication client access is their own server
  • Protect data integrity : Prevent the content transmitted from being impersonated or tampered by the middleman

3、 ... and 、HTTP and HTTPS The difference between

  • HTTP Of URL With http:// start , and HTTPS Of URL With https:// start
  • HTTP It's not safe , and HTTPS Is safe
  • HTTP The standard port is 80 , and HTTPS The standard port for is 443
  • stay OSI In the network model ,HTTP Working on the application layer , and HTTPS The secure transport mechanism based on transport layer
  • HTTP Can't encrypt , and HTTPS Encrypt the transmitted data
  • HTTP No certificate required , and HTTPS need CA Institutions wosign Issued by SSL certificate

Four 、 Status code

classification Classification description
1** Information , The server receives the request , Requester is required to continue
2** success , Operation received and processed successfully
3** Redirect , Further action is required to complete the request
4** Client error , The request contains a syntax error or could not be completed
5** Server error , The server encountered an error while processing the request

1**: Information status code

Status code name describe
100 continue Initial request accepted , Please continue sending the rest
101 Handover protocol Request this requires the server to switch protocol , The server has determined to switch

2**: Success status code

Status code name describe
200 success The server has successfully processed the request
201 Created The request succeeded and the server created a new resource
202 Accepted Request accepted by server , But not yet processed
203 Unauthorized information The server successfully processed the request , But the information returned may come from another source
204 There is no content The server successfully processed the request , But nothing is returned
205 Reset Content Server processed successfully , The user terminal should reset the document view
206 Part content Server successfully processed part GET request

3**: Redirect the status code

Status code name describe
300 Multiple choice Request for , The server can perform many operations
301 A permanent move The requested page has permanently jumped to the new url
302 Temporary movement The server is currently responding to requests from pages in different locations , But requests continue to use the original location for future requests
303 View other locations The requester should use separate GET When requesting to retrieve a response , The server returns this code
304 not changed Since last request , The requested page has not been modified
305 Using agents The requester can only use a proxy to access the requested web page
307 Temporary redirection The server is currently responding to requests from pages in different locations , But the requester should continue to use the original location for future requests

4**: Client error status code

Status code name describe
400 Wrong request The server does not understand the syntax of the request
401 unauthorized The request requires the user's authentication
403 prohibit Server rejects request
404 Not found The server could not find the requested page
405 Method disable Disable the method specified in the request
406 Don't accept Unable to respond to the requested page with the requested content attribute
407 Proxy authorization required The request requires proxy authentication
408 request timeout Server timed out waiting for request
409 Conflict Server conflicts when completing request
410 deleted The resource requested by the client no longer exists
411 Effective length required The server does not accept requests without valid length header fields
412 Preconditions not met The server does not meet one of the prerequisites set by the requester in the request
413 Request entity too large Because the request entity is too large , Server cannot process , So reject the request
414 request url Too long Requested url Too long , Server cannot process
415 Format... Is not supported The server was unable to process the media format attached to the request
416 Invalid scope Invalid range requested by client
417 Not meeting expectations The server cannot meet the request header field requirements

5**: Server error status code

Status code name describe
500 Server error Server internal error , Unable to complete request
501 Not yet implemented The server does not have the function to complete the request
502 Bad Gateway There was an error with the server acting as a gateway or proxy
503 Service not available The server is currently unavailable
504 gateway timeout Gateway or proxy server , Not getting requests in time
505 Version is not supported The server does not support HTTP Protocol version
版权声明
本文为[Full stack development of dre]所创,转载请带上原文链接,感谢
https://qdmana.com/2021/05/20210530143242875v.html

  1. 微信小程序界面设计小程序中的WXSS(css)选择器课程-伪类-:disabled | :enabled 伪类
  2. 微信小程序界面设计小程序中的WXSS(css)选择器课程-伪类-:first-child 伪类
  3. 微信小程序界面设计小程序中的WXSS(css)选择器课程-伪类-:first-of-type 伪类
  4. 微信小程序界面设计小程序中的WXSS(css)选择器课程-伪类-:focus 伪类
  5. 微信小程序界面设计小程序中的WXSS(css)选择器课程-派生选择器
  6. 微信小程序界面设计小程序中的WXSS(css)选择器课程-伪类-:nth-child() 伪类
  7. 微信小程序界面设计小程序中的WXSS(css)选择器课程-选择器的分组
  8. HTML基础-简介
  9. ASP实战之HTML入门-黄菊华-专题视频课程
  10. 微信小程序WxParse解析富文本(html)代码在线视频教程
  11. HTML语言基础.上
  12. HTML语言基础.下
  13. HTML!
  14. 【网页前端设计Front end】HTML语言基础.上(看不懂你来打我)
  15. 【网页前端设计Front end】HTML语言基础.下(看不懂你来打我)
  16. 【django轻量级框架】HTML上传文件拦截到本地
  17. HTML5基础知识实战演练教程-黄菊华-专题视频课程
  18. 基于WEB的HTML5购物网站、H5电商购物平台网上商城网站毕业设计(1)商城首页
  19. 基于WEB的HTML5购物网站、H5电商购物平台网上商城网站毕业设计(2)商城分类
  20. 微信小程序框架weui的基础使用
  21. 一文入魂!彻底巩固你的Nginx知识体系!
  22. Nginx是什么?有哪些核心技术?
  23. Nginx配置如何一键生成
  24. 就这一次把网路的几种IO模型以及Nginx基本原理彻底搞清楚
  25. 优质高效,阿里性能怪兽宝典(Redis+Nginx)限时开源,手慢无!
  26. Nginx的配置文件nginx.conf配置解释
  27. 安装的nginx 地址重写
  28. nginx防盗链
  29. nginx动静分离
  30. nginx优化
  31. Nginx虚拟主机
  32. Nginx 反向代理
  33. IDEA实现热部署前端界面(Tomcat、IDEA)
  34. JavaScript中call与apply的区别
  35. JavaScript代码无分号问题
  36. 在Chrome浏览器中禁用JavaScript
  37. JavaScript为内置对象添加原型方法
  38. JavaScript原型数据共享与方法共享探究
  39. JavaScript把局部变量变成全局变量
  40. JavaScript函数自调用
  41. JavaScript继承的几种方法
  42. 逆向递归看JavaScript原型
  43. JavaScript函数进阶
  44. JavaScript中的call、apply、bind
  45. JavaScript高阶函数——函数当参数、返回值、其他成员
  46. JavaScript沙箱模式
  47. JavaScript闭包——点赞小案例
  48. JavaScript函数闭包
  49. JavaScript正则验证密码强弱度
  50. JavaScript表单信息验证案例——使用正则
  51. JavaScript伪数组和数组
  52. CSS代码书写规范
  53. jQuery——jQuery基本概念
  54. jQuery——jQuery选择器 ※
  55. jQuery——jQuery的CSS,class,属性操作及案例应用
  56. jQuery动画代码详解
  57. jQuery节点操作、弹幕案例
  58. jQuery事件机制
  59. jQuery链式编程,each方法,多库共存
  60. New open source project in July: can you keep up with the speed of building wheels at the front end?