未登录,请登录后再发表信息
最新评论 (0)
播放视频

【互联网科普系列】HTTP协议与HTML语言

The Internet: HTTP and HTML

互联网:HTTP和HTML
The Internet: HTTP and HTML
我是贾丝明 XBOX One项目团队中的程序管理人员
I’m Jasmine and I’m a program manager on the XBOX One engineering team.
我们最大的一个功能就是 XOBX LIVE
One of our biggest feature is called XBOX LIVE
它是一个连接世界所有玩家的在线服务
It’s an online service that connects gamers from all around the world
我们依靠互联网让它变为现实
And we rely on the internet to make that happen
这可不是一件容易的任务它的背后隐藏着很多东西
This is no easy task and there are a lot of things happening behind the scenes
互联网完全改变了人们的交互交流方式但是它具体是怎么工作的呢
The internet is totally changing how people interact and connect. But how does it work?
全世界的电脑究竟如何做到互相交流的?
How do the computers all across the world actually communicate with each other?
让我们看下网页浏览
Let’s look at web browsing
首先 打开一个浏览器
First, you open a web browser
就是那个让你看网页的app
It’s the app you use to access the web pages.
下一步 键入网址或者URL
Next, you type in the web address, or URL,
URL的意思是你想浏览网站的统一资源定位符就像tumblr.com
which stands for Uniform Resource Locator of the website you want to visit like tumblr.com.
[音乐]
*Music*
你好我是David KarpTumblr的创始人
Hi, I’m David Karp, the founder of Tumblr
今天我们讲一下这些我们每天看的网页的工作原理
And we’re here today to talk about how those web browsers we use everyday actually work
你可能很好奇当你输入网址按下回车键究竟发生了什么
So you’ve probably wondered what actually happens when you type an address into your web browser and then hit enter
它真的就像你想象的那样
And it really is about as crazy as you can imagine
就在那一瞬间 你的电脑开始与另一台叫做服务器的电脑开始交流
So in that moment your computer starts talking to another computer
他们通常相隔千里
called a server, that’s usually thousands of miles away
在几毫秒之内 你的电脑向服务器请求一个网站
And in milliseconds your computer asks that server for a website,
同时 服务器开始以HTTP为语言返回对话
and that server starts to talk back to your computer in a language called HTTP
HTTP的意思是 超文本传输协议
HTTP stands for HyperText Transfer Protocol
你可以认为它是一种一台电脑向另一台电脑请求文件的语言
You can kind of think of it as the language that one computer uses to ask another computer for a document.
其实它是非常简洁明了的
And it’s actually really pretty straightforward
如果你拦截你的电脑与互联网上的服务器的对话
If you were to intercept the conversation between your computer and a web server on the internet
它大多由叫做 GET 的请求组成
it’s mainly made up of something called “GET” requests
这些都是简单直接的单词 GET 和 你想请求的文件的名字
Those are really very simply the word GET and the name of the document that you’re requesting
假如你想登录Tumblr 同时加载我们的登录页面
So if you try to login to Tumblr and load our login page
所有要做的事情就是向Tumblr的服务器发送一个GET请求就像这样 GET /login
all you’re doing is sending a GET request to Tumblr’s server that says GET /login
这会告诉Tumblr的服务器 你想要Tumblr服务器login页面的所有HTML代码
And that tells Tumblr’s server that you want all of the HTML code for the Tumblr login page
HTML即 超文本标记语言
So HTML stands for Hyper Text Markup Language
你可以认为这是一种用来告诉浏览器怎么去组织页面显示的语言
and you can think of that as the language you use to tell a web browser how to make a page look
你可以想象某些东西比如 维基百科 其实就是一个巨大的简单的文档
If you think about something like Wikipedia, which is really just a big simple document
那么HTML可以用来加大加粗标题
and HTML is the language that you use to make that title big and bold
引用正确的字体链接文本指向其它页面
to make the font the right font, to link certain text to certain other pages
加粗某些文本
to make some text bold
标记某些文本为斜体把一个图片放在中间 向右对齐
to make some text italic, to put an image in the middle of the page, to align the image to the right
向左对齐
to align the image to the left
网页里的文字会被直接包含在HTML中
The text of a web page is included directly in the HTML
但是其他的部分例如 图片和视频它们则需要请求另外的统一定位符(URL)来获得
but other parts like images or videos are separate files with their own URLs that need to be requested.
浏览器对他们中的每一项发送一个HTTP请求并且在返回时显示它们
The browser sends separate HTTP requests for each of these and displays them as they arrive.
如果一个网页有大量的不同的图片
If a web page has a lot of different images
它们每个产生一个HTTP请求这会导致加载变慢
each of them causes a separate HTTP request and the page loads slower
在你浏览网页时 有时候你不用GET请求来请求网页
Now sometimes when you browse the web, you’re not just requesting pages with GET requests
有时你需要发送一些信息例如当你填写一个表单或者搜索框时
Sometimes you send information like when you fill out a form or type a search query
你的浏览器会通过HTTP POST请求 以纯文本的形式发送这些信息
Your browser sends this information in plain text to the web server using an HTTP POST request
我们继续讨论登录tumblr的事儿
Let’s say you login to Tumblr
你做的第一件事就是发起一个POST请求
Well the first thing you do is you make a POST request
这是一个对Tumblr登录页面的POST
that is a POST to Tumblr’s login page
上面附有一些信息包括你的邮件地址 你的密码
that has some data attached to it. It has your email address, it has your password.
这些东西发送到Tumblr
That goes to Tumblr’s server
Tumblr服务器认出了你哦!你是David
Tumblr’s server figures out that okay, you’re David
它发送一个网页给你的浏览器并且说成啦!登录的人是David
It sends a web page back to your browser that says, Success! Logged in as David
但是也有一小撮不可见的cookie数据随着网页返回
But along with that web page, it also attaches a little bit of invisible cookie data
不过只有你的浏览器能看见和保存下来
that your browser sees and knows to save.
Cookie非常重要因为这是网站记住你是谁的唯一方式
And it’s really important because it’s really the only way that a website can remember who you are.
对于Tumblr来说所有的cookie其实就像一个身份证
All that cookie data really is, is an ID card for Tumblr
这是识别你是David的唯一数字
It’s a number that identifies you as David.
你的电脑保存这个数字并且当你下次刷新跳转到Tumblr的时候
And your web browser holds on to that number and the next time you refresh Tumblr, the next time you go to Tumblr.com
你的浏览器知道自动的将这个身份数字添加到发送给Tumlbr服务器的请求里
your web browser knows to automatically attach that ID number with the request that it sends over to Tumblr’s servers.
所以现在Tumblr服务器看见了从你的浏览器发送的请求 看见了这个身份数字
So now Tumblr’s servers sees the request coming from your browser, sees the ID number, and knows
它就知道了:“嗯 这个请求是David发的”
“Ok, this is a request from David.”
现在 互联网是完全开放的 所有的链接可以被分享 并且信息用纯文本的方式进行传输
Now, the internet is completely open all of its connections are shared and information is sent in plain text
这让黑客窃取通过互联网发送的任何信息变得可能
This makes it possible for hackers to snoop on any personal information that you send over the internet.
但是安全的网站可以阻止这些为了让你的浏览器在安全频道上交流
But safe websites prevent this, by asking your web browser to communicate on a secure channel
可以使用安全套接字层 和它的后继 传输层安协议(SSL & TLS)
using something called Secure Sockets Layer and its successor Transport Layer Security.
你可以认为SSL和TLS是一个包裹了你的信息的安全层
You can think of SSL and TLS as a layer of security wrapped around your communications
它防止你的信息被窃取和篡改SSL和TLS传输被激活时 你会看到你的
to protect them from snooping or tampering. SSL and TLS are active when you see the little
浏览器地址栏会有一个小锁 就在HTTPS旁边
lock that appears in your browser address bar, next to the HTTPS
HTTPS协议确保了你的HTTP请求是安全的和被保护的
The HTTPS protocols ensure your HTTP requests scure and protected
当你的浏览器向一个网站发起安全请求时网站首先提供了一个数字证书
when a website your bowser to engage in a secure connection, it first provides a digital certificate
就像一个官方的身份证 声明它是这个网站的
which is like an official ID card proving that it’s the website it claims to be
数字证书通过证书机构发放
Digital certificates are published by certificate authorities
必须是可信的实体才能认证网站身份并且为他们颁发证书
which are trusted entities that verify the identities of websites and issue certificates for them
就像政府颁发身份证和护照一样
Just like a government can issue IDs or passports
如果一个没有认证数字证书的网站想要发起一个安全连接
Now if a website tries to start a scure connection without a published issued digital certificate
你的浏览器就会警告你
Your browser will warn you
以上就是网页浏览基础
That’s the basics of web browsing
这是我们天天看到的互联网的一部分下面总结
The part of the internet we see day to day. To summarize
HTTP和DNS管理着发送和接受HTML 多媒体文件 或者互联网上的任何东西
HTTP and DNS manage the sending and receiving of HTML, media files, or anything on the web
让这一切变得可能的是背后的TCP/IP和路由网络
What makes this possible under the hood are TCP/IP and router networks
他们以小包的形式拆散和传输信息
that break down and transport information in smallpackets
这些包由二进制的01序列组成
Those packets themselves are made up of binary, sequences of 1s and 0s
通过电线 光纤 无线的物理网络发送
that are physically sent through electric wires, fiber optic cables, and wireless networks.
幸运的是 一旦你了解了一层是怎样工作的
Fortunately, once you’ve learned how one layer of the internet works
你可以使用它 而不需要记住所有的细节
you can rely on it without remembering all the details
并且我们相信 所有的这些层将会联合在一起
And we can trust that all those layers will work together
大规模的、稳定的传输我们要的信息
to successively deliver information at scale and with reliability

发表评论

译制信息
视频概述

本视频介绍了我们浏览的网页是如何发送接受的以及服务器与电脑之间是怎么交互的

听录译者

收集自网络

翻译译者

【B】Cod

审核员

知易行难

视频来源

https://www.youtube.com/watch?v=kBXQZMmiA4s

相关推荐