面试:你了解中兴吗_HTTP简介:您需要了解的所有内容
面试:你了解中兴吗
In this article, I will walk you through how the world wide web works at a fundamental level.
在本文中,我将向您介绍基本的万维网工作原理。
The core technology is HTTP - Hypertext Transfer Protocol. It's the communication protocol you use when you browse the web.
核心技术是HTTP-超文本传输协议。 这是您浏览网络时使用的通信协议。
At a fundamental level, when you visit a website, your browser makes an HTTP request to a server. Then that server responds with a resource (an image, video, or the HTML of a web page) - which your browser then displays for you.
从根本上讲,当您访问网站时,浏览器会向服务器发出HTTP请求。 然后,该服务器以资源(图像,视频或网页HTML)进行响应-然后您的浏览器会为您显示该资源。
This is HTTP's message-based model. Every HTTP interaction includes a request and a response.
这是HTTP的基于消息的模型。 每个HTTP交互都包括一个请求和一个响应。
By its nature, HTTP is stateless.
HTTP本质上是无状态的。
Stateless means that all requests are separate from each other. So each request from your browser must contain enough information on its own for the server to fulfill the request. That also means that each transaction of the message based model of HTTP is processed separately from the others.
无状态意味着所有请求都是相互独立的。 因此,来自浏览器的每个请求必须单独包含足够的信息,服务器才能满足该请求。 这也意味着基于消息的HTTP模型的每个事务都与其他事务分开处理。
网址 (URLs)
The URL (Uniform Resource Locator) is probably the most known concept of the Web. It is also one of most important and useful concepts. A URL is a web address used to identify resources on the Web.
URL(统一资源定位符)可能是Web上最知名的概念。 它也是最重要和有用的概念之一。 URL是用于标识Web资源的Web地址。
The idea of the web is structured around resources. From its beginnings the Web was the platform for sharing text/HTML files, documents, images etc, and as such it can be considered a collection of resources.
Web的思想围绕资源而构建。 从一开始,Web就是用于共享文本/ HTML文件,文档,图像等的平台,因此可以将其视为资源的集合。
Protocol — Most often they are HTTP (or HTTPS for a secure version of HTTP).
协议 -大多数情况下,它们是HTTP(或HTTPS(用于HTTP的安全版本))。
Other notable protocols are:
其他值得注意的协议是:
File Transfer Protocol (FTP) — is a standard protocol used for transferring files between a client and a server over a network.
文件传输协议(FTP)-是一种标准 用于传输的协议 网络上客户端和服务器之间的文件。
- Simple Mail Transfer Protocol (SMTP) is a standard for email transmission.简单邮件传输协议(SMTP)是电子邮件传输的标准。
Domain — Name that is used to identify one or more IP addresses where the resource is located.
域 -名称,用于标识资源所在的一个或多个IP地址。
Path —Specifies the resource location on the server. It uses the same logic as a resource location used on the device where you are reading this article (i.e. /search/cars/VWBeetle.pdf or C:/my cars/VWBeetle.pdf).
路径-指定服务器上的资源位置。 它使用与您在其中阅读本文的设备上使用的资源位置相同的逻辑(即/search/cars/VWBeetle.pdf或C:/ my cars / VWBeetle.pdf)。
Parameters — Additional data used to identify or filter the resource on the server.
参数 -用于标识或过滤服务器上资源的其他数据。
Note: When searching for articles and more information about HTTP, you may encounter the term URI (or uniform resource identifier). URI is sometimes being used instead of URL but mostly in formal specifications and by people who want to show off. :)
注意 :在搜索有关HTTP的文章和更多信息时,您可能会遇到术语URI(或统一资源标识符)。 有时使用URI代替URL,但大多数情况是在正式规范中以及要炫耀的人们使用URI。 :)
HTTP请求 (HTTP Requests)
In HTTP, every request must have an URL address. Additionally, the request needs a method. The four main HTTP methods are:
在HTTP中,每个请求都必须具有URL地址。 此外,请求需要一个方法。 四种主要的HTTP方法是:
- GET得到
- PUT放
- POST开机自检
- DELETE删除
I will explain these methods, and more, in the HTTP Methods section of this article.
我将在本文的“ HTTP方法”部分中解释这些方法,以及更多内容。
And these methods directly correspond to actions:
这些方法直接对应于动作:
- read读
- update更新
- create创造
- delete删除
All HTTP messages have one or more headers, followed by an optional message body. The body contains the data that will be sent with the request or the data received with the response.
所有HTTP消息都有一个或多个标头,后跟可选的消息正文。 正文包含将与请求一起发送的数据或与响应一起接收的数据。
The first part of every HTTP request holds three items:
每个HTTP请求的第一部分包含三个项目:
Example:
例:
- GET /adds/search-result?item=vw+beetle HTTP/1.1GET / adds / search-result?item = vw + beetle HTTP / 1.1
When a URL contains a “?” sign, it means it contains a query. That means it sends parameters of the requested resource.
网址中包含“?”时 符号,表示它包含一个查询。 这意味着它将发送所请求资源的参数。
- The first part is a method which tells which HTTP method is used. Most commonly used is the GET method. GET method retrieves a resource from the web server and since GET doesn’t have a message body nothing after the header is needed.第一部分是一种方法,用于说明使用哪种HTTP方法。 最常用的是GET方法。 GET方法从Web服务器检索资源,并且由于GET在没有标头之后没有任何消息正文。
- The second part is a requested URL.第二部分是请求的URL。
- The third part is a HTTP version being used. Version 1.1. is the most common version for most browsers, however, version 2.0 is taking over.第三部分是正在使用的HTTP版本。 版本1.1。 是大多数浏览器最常用的版本,但是2.0版正在取代。
There are also some other interesting things in an HTTP request:
HTTP请求中还有一些其他有趣的东西:
Referer header — tells the URL from where the request has originated.
引荐来源标头 -告知请求发起来源的网址。
User-Agent header — additional information about the browser being used to generate the request.
User-Agent标头 -有关用于生成请求的浏览器的其他信息。
Host header — uniquely identifies a host name; it is necessary when multiple web pages are hosted on the same server.
主机头 -唯一标识主机名; 在同一服务器上托管多个网页时,有必要。
Cookie header — submits additional parameters to the client.
Cookie标头 -向客户端提交其他参数。
HTTP响应 (HTTP Responses)
Just like in HTTP requests, HTTP responses also consist of three items:
就像HTTP请求一样,HTTP响应也包含三项:
Example:
例:
HTTP/1.1 200 OK
HTTP / 1.1 200 OK
- The first part is the HTTP version being used.第一部分是所使用的HTTP版本。
- The second part is the numeric code of the result for the request.第二部分是请求结果的数字代码。
- The third part is a textual description of the second part.第三部分是第二部分的文字描述。
There are some other interesting things in an HTTP response:
HTTP响应中还有一些其他有趣的事情:
Server header — information about which web server software is being used.
服务器标头 -有关正在使用哪种Web服务器软件的信息。
Set-Cookie header — issues the cookie to the browser.
Set-Cookie标头 -将cookie发送给浏览器。
Message body — it is common for an HTTP response to hold a message body.
消息正文 -HTTP响应通常保存消息正文。
Content-Length header — tells the size of the message body in bytes.
Content-Length标头 -以字节为单位告知消息正文的大小。
HTTP方法 (HTTP Methods)
The most common methods are GET and POST. But there are a few others, too.
最常见的方法是GET和POST。 但是,还有其他一些。
GET — You use this method to request data from a specified resource where data is not modified it in any way. GET requests do not change the state of resource.
GET —您使用此方法从指定的资源请求数据,而不会以任何方式修改数据。 GET请求不会更改资源状态。
POST — You use this method to send data to a server to create a resource.
POST-使用此方法将数据发送到服务器以创建资源。
PUT — You use this method to update the existing resource on a server by using the content in the body of the request. Think of this as a way to "edit" something.
PUT —您使用此方法通过使用请求正文中的内容来更新服务器上的现有资源。 可以将其视为“编辑”某些内容的一种方式。
HEAD — You use this method the same way you use GET, but with the distinction that the return of a HEAD method should not contain body in the response. But the return will contain same headers as if GET was used. You use the HEAD method to check whether the resource is present prior of making a GET request.
HEAD —使用此方法的方式与使用GET的方式相同,但区别在于HEAD方法的返回结果不应在响应中包含主体。 但是返回将包含与使用GET相同的标头。 您可以使用HEAD方法在发出GET请求之前检查资源是否存在。
TRACE — You use this method for diagnostic purposes. The response will contain in its body the exact content of the request message.
跟踪—您将此方法用于诊断目的。 响应将在其主体中包含请求消息的确切内容。
OPTIONS — You use this method to describe the communication options (HTTP methods) that are available for the target resource.
选项 —您使用此方法来描述可用于目标资源的通信选项(HTTP方法)。
PATCH — You use this method to apply partial modifications to a resource.
修补程序-您使用此方法对资源进行部分修改。
DELETE —You use this method to delete the specified resource.
DELETE —您使用此方法删除指定的资源。
休息 (REST)
Representational state transfer (REST) is an architecture style where requests and responses contain representations of the current state of the systems resource.
代表性状态转移(REST)是一种体系结构样式,其中请求和响应包含系统资源当前状态的代表性。
“Regular” way:
“常规”方式:
http://carapp.com/search?make=wv&model=beetle
http://carapp.com/search?make=wv&model=beetle
REST-style:
REST风格:
http://carapp.com/search/vw/beetle
http://carapp.com/search/vw/beetle
You can learn more about REST here if you're curious.
如果您好奇的话,可以在这里了解更多关于REST的信息 。
HTTP头 (HTTP Headers)
There are three main components that make up the request/response structure. These include:
请求/响应结构由三个主要部分组成。 这些包括:
- First line第一行
- Headers标头
- Body/Content正文/内容
We already talked about the first line in HTTP requests and responses, and body function was mentioned too. Now we'll talk about HTTP headers.
我们已经讨论过HTTP请求和响应的第一行,并且还提到了body函数。 现在,我们将讨论HTTP标头。
The HTTP headers are added after the first line and are defined as name:value pairs separated by a colon. HTTP headers are used to send additional parameters along with the request or response.
HTTP标头添加在第一行之后,并定义为以冒号分隔的name:value对。 HTTP标头用于与请求或响应一起发送其他参数。
As I already said, the body of the message includes the data to be sent with the request or the data received along with the response.
正如我已经说过的那样,消息的主体包括要与请求一起发送的数据或随响应一起接收的数据。
There are different types of headers that are grouped based on their usage into 4 broad categories:
根据标头的用法,可以将标头分为4大类:
General header — Headers that can be used in both requests and response messages and that are independent of the data being exchanged.
常规标头 -既可以在请求消息中也可以在响应消息中使用的标头,它们与正在交换的数据无关。
Request header — These headers define parameters for the data requested or parameters that give important information about the client making the request.
请求标头 -这些标头定义了所请求数据的参数或提供了有关发出请求的客户端的重要信息的参数。
Response header — These headers contain information about the incoming response.
响应标头 -这些标头包含有关传入响应的信息。
Entity header — The entity headers describe the content that makes up the body of the message.
实体标头 -实体标头描述了组成邮件正文的内容。
HTTP状态码 (HTTP status codes)
Browsing the web, you may have encountered "404 error: not found" pages or "500 errors: server is not responding" pages.
浏览Web时,您可能会遇到“ 404错误:未找到”页面或“ 500错误:服务器未响应”页面。
These are HTTP status codes.
这些是HTTP状态代码。
Every HTTP response message must contain an HTTP status code in its first line, telling us the result of the request.
每个HTTP响应消息的第一行必须包含HTTP状态代码,以告诉我们请求的结果。
There are five groups of status codes which are grouped by the first digit:
有五组状态代码,它们按第一位分组:
- 1xx — Informational.1xx-信息性
- 2xx — The request was successful.2xx —请求成功。
- 3xx — The client is redirected to a different resource.3xx —客户端被重定向到其他资源。
- 4xx — The request contains an error of some kind.4xx —请求包含某种错误。
- 5xx — The server encountered an error fulfilling the request.5xx —服务器在执行请求时遇到错误。
Here's a full list of HTTP Status Response Codes and their explanation.
这是HTTP状态响应代码及其说明的完整列表 。
HTTPS(安全超文本传输协议) (HTTPS (Hypertext Transfer Protocol Secure))
The secure version of HTTP protocol is HyperText Transfer Protocol Secure (HTTPS). HTTPS provides encrypted communication between a browser (client) and the website (server).
HTTP协议的安全版本是安全的超文本传输协议(HTTPS)。 HTTPS在浏览器(客户端)和网站(服务器)之间提供加密的通信。
In HTTPS, the communication protocol is encrypted using Transport Layer Security (TLS) or Secure Sockets Layer (SSL).
在HTTPS中,使用传输层安全性(TLS)或安全套接字层(SSL)对通信协议进行加密。
The protocol is therefore also often called HTTP over TLS, or HTTP over SSL.
因此,该协议通常也称为TLS上的HTTP或SSL上的HTTP。
Both the TLS and SSL protocols use an asymmetric encryption system. Asymmetric encryption systems use a public key (encryption key) and a private key (decryption keys) to encrypt a message.
TLS和SSL协议均使用非对称加密系统。 非对称加密系统使用公用密钥(加密密钥)和专用密钥(解密密钥)对消息进行加密。
Anyone can use the public key to encrypt a message. However, private keys are secret, and that means that only the intended receiver can decrypt the message.
任何人都可以使用公共密钥来加密消息。 但是,私钥是秘密的,这意味着只有预定的接收者才能解密该消息。
SSL / TLS握手 (SSL/TLS handshake)
When you request a HTTPS connection to a website, the website sends its SSL certificate to your browser. That process where your browser and website initiate communication is called the “SSL/TLS handshake.”
当您请求与网站的HTTPS连接时,该网站会将其SSL证书发送到您的浏览器。 您的浏览器和网站启动通信的过程称为“ SSL / TLS握手”。
The SSL/TLS handshake involves a series of steps where browser and website validate each other and start communication through the SSL/TLS tunnel.
SSL / TLS握手涉及一系列步骤,其中浏览器和网站相互验证并开始通过SSL / TLS隧道进行通信。
As you probably noticed, when a trusted secure tunnel is used during in a HTTPS connection, the green padlock icon is displayed in the browsers address bar.
您可能已经注意到,在HTTPS连接期间使用受信任的安全隧道时,绿色的挂锁图标会显示在浏览器的地址栏中。
HTTPS的好处 (Benefits of HTTPS)
The major benefits of a HTTPS are:
HTTPS的主要好处是:
- Customer information, like credit card numbers and other sensitive information, is encrypted and cannot be intercepted.客户信息(例如信用卡号和其他敏感信息)已加密,不能被截获。
- Visitors can verify you are a registered business and that you own the domain.访问者可以验证您是注册企业,并且您拥有该域。
- Customers know they are not suppose to visit sites without HTTPS, and therefore, they are more likely to trust and complete purchases from sites that use HTTPS.客户知道他们不应该访问没有HTTPS的站点,因此,他们更有可能信任和完成从使用HTTPS的站点进行的购买。
Thank you for reading! Check out more articles like this on my freeCodeCamp profile. And check out other fun stuff I build on my GitHub page.
感谢您的阅读! 在我的freeCodeCamp个人资料中查看更多类似的文章。 并查看我在GitHub页面上构建的其他有趣的东西。
翻译自: https://www.freecodecamp.org/news/http-and-everything-you-need-to-know-about-it/
面试:你了解中兴吗
相关文章:

img-responsive class图片响应式
在BootStrap中,给<img>添加 .img-responsive样式就可以实现图片响应式。1<img src"..." class"img-responsive">转载于:https://www.cnblogs.com/zouyun/p/7761393.html

小程序开发卡券
前期准备 小程序内领取卡券 1.开发者须有一个有卡券权限的公众号(服务号)和认证后的小程序账号; 2.开发者须申请一个开放平台账号,并将小程序和公众号绑定在同一个开放平台账号下,关于开放平台的介绍请参照࿱…

php学习之道:WSDL具体解释(三)
通过声明方式定义绑定(binding)属性 假设你在服务中採用SOAP binding。你能够使用JAX-WS来指定一定数量的属性binding。这些属性指定相应你在WSDL中指定的属性。某些设置。比方參数类型,能够约束你实现的方法。这些设置也影响声明的效用。 SO…
什么是棉绒,它如何节省您的时间?
One of the biggest challenges in software development is time. It’s something we can’t easily get more of, but linting can help us make the most out of the time we have.时间是软件开发中最大的挑战之一。 这是我们无法轻易获得的更多东西,但是棉绒可…
可持久化线段树(主席树)【舰娘系列】【自编题】
[pixiv] https://www.pixiv.net/member_illust.php?modemedium&illust_id60083619 向大(hei)佬(e)势力学(di)习(tou) 前段时间做了一套大佬自己出的题(大佬竟然是个宅男2333),蒟蒻的我自然是只得了30分的暴力分:-( fleet 舰队 【题目描…

读书笔记——《黑客大曝光》(1/8)
第一部分 收集情报 案例研究 Tor系统基于洋葱路由器,是第二代低延迟匿名系统,用户可通过它在互联网上进行匿名通信。Tor网络的使用者必须在他们的系统上运行一个洋葱代理,这个代理允许它们在Tor网络上进行通信,并协商一个虚拟链路…

H5 自动播放背景音频,兼容安卓和苹果手机, ios createInnerAudioContext 无法自动播放解决
原因应该是IOS不允许自动播放音频,有两种解决方法 在main.js Vue.prototype.innerAudioContext = uni.createInnerAudioContext(); //创建播放器对象 Vue.prototype.playAudio = function(audioUrl) {console.log(播放)var innerAudioContext = Vue.prototype.innerAudioCont…

粒子耗尽 粒子滤波_如何使用粒子的强大蓝牙API
粒子耗尽 粒子滤波This post is originally from www.jaredwolff.com 这篇文章最初来自www.jaredwolff.com I was defeated. 我被打败了。 I had spent the whole night trying to get a Bluetooth Low Energy project working. It was painful. It was frustrating. I was r…

Android笔记(adb命令--reboot loader)
Android 的机器通过adb进入升级模式的方法 # adb shell # reboot loader 通过上面两个命令就进入升级模式了,通过工具升级就好了 为什么会写这简单的一篇呢?因为今天干了一件很傻很傻的事,特别记录下来。 业务那边今天急着要把机器寄给客户&a…

样式集(八)弹窗,规则弹窗,半透明弹窗
效果图: 代码: <view class"popupBlock" v-if"showPopupBlock"><view class"xxx"><image class"xxxImg" click"showPopupBlockfalse" mode"widthFix" src"../../stat…

typeof操作符的返回值
使用typeof操作符 对一个值使用typeof操作符可能返回下列某个字符串: 1):undefined——如果这个值未定义 2):boolean——如果这个值是布尔值 3):string——如果这个值是字符串 4):number——如果这个值是数值 5):object——如果这个值是对象或null,数组,…

定制开发软件所有权_职业所有权软件开发人员指南
定制开发软件所有权介绍 (Introduction) 您的职业正在流向大海吗? (Is Your Career Drifting Out To Sea?) Like a frog whos slowly being boiled in a pot but doesnt realize it, 2 years into my career I slowly came to discover that I wasnt progressing a…

转:在线框架引用 bootstrap/jq/jqmobile/css框架
bootstrap百度调用 <script src"http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script><link href"http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel"stylesheet" /> 使用 Bootstrap 中文…

曲线图实现,可滚动曲线图,自定义数据
实现可以拖动的曲线图,自定义X轴数据的缩进,自定义X轴显示多少格。 效果图 数据格式,数据说明代码可见 曲线图实现 u-charts.js 可以在官网下载 <template><view class="qiun-columns"><view class=""><view class="qiu…

MongoDB 删除数据库
MongoDB 删除数据库 语法 MongoDB 删除数据库的语法格式如下: db.dropDatabase() 删除当前数据库,默认为 test,你可以使用 db 命令查看当前数据库名。 实例 以下实例我们删除了数据库 runoob。 首先,查看所有数据库: &…

安装meme_通过构建Meme生成器学习React
安装memeMemes are great - theyre such a fun way of describing ideas and opinions. So its no coincidence that I picked a meme generator app as the capstone project in my free React course on Scrimba. The app works by pulling a random meme image from an API …

Thunder团队第三周 - Scrum会议7
Scrum会议7 小组名称:Thunder 项目名称:i阅app Scrum Master:胡佑蓉 工作照片: 邹双黛在照相,所以图片中没有该同学。 参会成员: 王航:http://www.cnblogs.com/wangh013/ 李传康:htt…

修改u-charts的点的大小和线的粗细
效果图: 修改源码,找到u-charts.js , 修改他画布的点的大小,在这两行框的地方,改了就好了 完整代码: <template><view class"qiun-columns"><view class""><vie…

Swift中使用typealias定义一个闭包closure
在OC中我们定义一个Blocks是这样定义的: typedef void (^ZWProgressHUDCompletionBlock)();在Swift中定义一个闭包是这种: typealias ZWProgressHUDCompletionBlock()->Void转载请注明。。。欢迎大家增加交流群:爱疯、爱Coding:…

react中使用构建缓存_如何在React中构建热图
react中使用构建缓存Heat maps are a great way of visualizing correlations among two data sets. With colors and gradients, it is possible to see patterns in the data almost instantly.热图是可视化两个数据集之间相关性的一种好方法。 使用颜色和渐变,可…
oracle rman异机恢复
Oracle源主机Oracle目标主机主机平台CentOS6.2(final)CentOs6.2(FInal)主机名 vickrmanIP地址192.168.1.11192.168.1.10实例名字orclorclOracle版本号11.2.0.411。2.0.4Oracle数据文件存储filesystemfilesystem控制文件路径/u01/a…

高阶函数-lambda表达式
#2.6 map()# 第一个参数传入一个函数,,第二个参数为一个可迭代对象li_1 (1,3,5,7)def funcA(x): return x*xm1 map(funcA,li_1)print(type(m1))print(m1())# 2.6 reduce()# 第一个参数传入一个函数,第二个参数 可以迭代对象 ,…

CSS动画效果无限循环放大缩小
效果图: CSS动画效果无限循环放大缩小 <image class"anima" mode"widthFix" click"nav" src"/static/1_btn.png"></image>.anima {animation-name: likes; // 动画名称animation-direction: alternate; // 动…

solidity 编程练习_学习Solidity编程语言并开始为区块链开发
solidity 编程练习Learn to program in Solidity in this full tutorial from Dapp University. Solidity is an object-oriented programming language for writing smart contracts. It is used for implementing smart contracts on various blockchain platforms, most not…

性能测试之二——常用的性能测试策略
性能测试的常用策略有: 1、基准测试 单用户测试需要打开控制台,获取Analysis结果() 2、并发测试 多用户在同一时间做同一事情或执行同一操作,针对同一业务(LR精确到毫秒),一般测试并…

KBEngine服务器环境搭建
1.概要及环境 KBEngine是一款开源服务端引擎(中文官网http://kbengine.org/cn/),能够在Linux、Windows下部署,为了学习方便,我们在本机Windows下进行服务器环境的搭建。 1)服务端源代码 https://github.com…

小程序判断屏幕是长屏还是短屏手机,iPhone X 类型还是 iPhone 6类型
直接看代码 globalData: {udgeBigScreen: false,//判断屏幕 }, onLaunch: function(e) {/**判断屏幕大小 */var judgeBigScreen () > {let result false;const res wx.getSystemInfoSync();const rate res.windowHeight / res.windowWidth;let limit res.w…

桌面应用程序 azure_如何开始使用Microsoft Azure-功能应用程序,HTTP触发器和事件队列...
桌面应用程序 azure"Serverless" architecture is all the rage in tech land at the moment, including heavy usage at my new workplace. “无服务器”架构目前在科技界风靡一时,包括在我的新工作场所中大量使用。 Microsoft jumped into this space …

开始Flask项目
新建Flask项目。设置调试模式。理解Flask项目主程序。使用装饰器,设置路径与函数之间的关系。使用Flask中render_template,用不同的路径,返回首页、登录员、注册页。用视图函数反转得到URL,url_for(‘login’),完成导航…

JavaScript中的加法运算
<head runat"server"> <title>JavaScript实现加法计算器</title> <script type"text/javascript"> function Sum() { var txtbox1 document.getElementById("txtbox1"); var txtbox2 document.getElementById("…