简体   繁体   English

HTTP请求/响应流

[英]HTTP request/response flow

I'm trying to dissect a single HTTP request made to some website --> www.somesite.com ... If I understand correctly, the browser will issue a GET request as such: 我试图剖析对某个网站-> www.somesite.com发出的单个HTTP请求...如果我正确理解,浏览器将发出GET请求,如下所示:

GET http://www.somesite.com/index.html HTTP/1.1 GET http://www.somesite.com/index.html HTTP / 1.1

Ultimately the server will send a response as such: 最终,服务器将发送如下响应:

HTTP/1.1 200 OK HTTP / 1.1 200 OK

Date: Fri, 21 Feb 2014 10:00:00 GMT 日期:2014年2月21日,星期五,格林尼治标准时间10:00:00

Content-Type: text/html 内容类型:text / html

Content-Length: 1354 内容长度:1354

<html>
<body>
.
.
.
</body>
</html>

Assuming this index.html contains images and css and javascript assets, if the response was simply 200 OK, how does the client know to go back and fetch the other assets? 假设此index.html包含图像,css和javascript资产,如果响应仅仅是200 OK,那么客户端如何知道回去并获取其他资产? Meaning, how does the client know that index.html has been served in its entirety when all it did was simply issue the first GET request? 意思是,当仅执行第一个GET请求时,客户端如何知道index.html已全部提供?

Well, it is hard to understand, what you want to know. 好吧,您想知道的东西很难理解。 The first get will either return data or redirect elsewhere. 第一次获取将返回数据或重定向到其他地方。 When browser receives HTML page, it will parse it to element tree and saves links to download (css, js, images). 当浏览器收到HTML页面时,它将解析为元素树并保存要下载的链接(css,js,图像)。 It downloads them and if they contain references to other resources (js, css, images), it will download them as well. 它会下载它们,如果它们包含对其他资源(js,css,图像)的引用,它也会下载它们。 When the queue is empty, browser finishes downloading. 队列为空时,浏览器完成下载。

Does this high level description answear your question? 这种高水平的描述会回答您的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM