浏览器工作流程_浏览器如何工作

浏览器工作流程

by Alex Nadalin

通过亚历克斯·纳达林

浏览器如何工作 (How Browsers Work)

Web应用程序安全性简介 (An Introduction to Web Application Security)

Let’s open this series on Web Application Security with an explanation of what browsers do and how they do it. Since most of your customers will interact with your web application through a browser, it’s imperative to understand the basics of these wonderful programs.

让我们打开有关Web应用程序安全性的系列文章,其中解释了浏览器的工作方式以及它们的工作方式。 由于大多数客户将通过浏览器与Web应用程序进行交互,因此必须了解这些出色程序的基础。

The browser is a rendering engine. Its job is to download a web page and render it in a way that’s understandable by a human being.

浏览器是渲染引擎 。 它的工作是下载网页并以人类可以理解的方式呈现它。

Even though this is an almost-criminal oversimplification, it’s all we need to know for now.

即使这几乎是一种犯罪性的过分简化,但这也是我们现在所需要知道的。

  • The user enters an address in the browser bar.

    用户在浏览器栏中输入一个地址。
  • The browser downloads the “document” at that URL and renders it.

    浏览器通过该URL下载“文档”并进行呈现。

You might be used to working with one of the most popular browsers such as Chrome, Firefox, Edge or Safari, but that does not mean that there aren’t different browsers out there.

您可能已经习惯了使用最流行的浏览器之一,例如Chrome,Firefox,Edge或Safari,但这并不意味着没有其他浏览器。

lynx, for example, is a lightweight, text-based browser that works from your command line. At the heart of lynx lies the same exact principles that you would find in any other “mainstream” browsers. A user enters a web address (URL), the browser fetches the document and renders it — the only difference being the fact that lynx does not use a visual rendering engine but rather a text-based interface, which makes websites like Google look like this:

例如, lynx是一种轻量级的基于文本的浏览器,可从您的命令行运行。 lynx的核心是您在任何其他“主流”浏览器中都可以找到的相同原理。 用户输入网址(URL),浏览器将获取文档并进行呈现-唯一的区别是,lynx不使用视觉呈现引擎,而是使用基于文本的界面,这使得类似Google的网站看起来像这样:

We broadly understand what a browser does, but let’s take a closer look at the steps these ingenious applications do for us.

我们大致了解浏览器的功能,但让我们仔细看看这些巧妙的应用程序为我们执行的步骤。

浏览器做什么? (What does a browser do?)

Long story short, a browser’s job mainly consists of:

长话短说,浏览器的工作主要包括:

  • DNS resolution

    DNS解析
  • HTTP exchange

    HTTP交换
  • Rendering

    渲染图
  • Rinse and repeat

    冲洗并重复
DNS解析 (DNS Resolution)

This process makes sure that once the user enters a URL, the browser knows which server it has to connect to. The browser contacts a DNS server to find that google.com translates to 216.58.207.110, an IP address the browser can connect to.

此过程可确保一旦用户输入URL,浏览器就会知道它必须连接到哪个服务器。 浏览器联系DNS服务器,发现google.com转换为浏览器可以连接到的IP地址216.58.207.110

HTTP交换 (HTTP Exchange)

Once the browser has identified which server is going to serve our request, it will initiate a TCP connection with it and begin the HTTP exchange. This is nothing but a way for the browser to communicate with the server what it needs, and for the server to reply back.

一旦浏览器确定了哪个服务器将满足我们的请求,它将与之启动TCP连接并开始HTTP交换 。 这不过是浏览器与服务器进行通信以及服务器进行回复的一种方式。

HTTP is simply the name of the most popular protocol for communicating on the web, and browsers mostly talk via HTTP when communicating with servers. An HTTP exchange involves the client (our browser) sending a request, and the server replying back with a response.

HTTP只是最流行的网络通信协议名称,浏览器在与服务器通信时大多通过HTTP进行通信。 HTTP交换涉及客户端(我们的浏览器)发送请求 ,而服务器则通过响应进行回复

For example, after the browser has successfully connected to the server behind google.com, it will send a request that looks like the following:

例如,浏览器成功连接到google.com后面的服务器后,它将发送如下请求:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值