First chapter: HTTP overview

Source: Internet
Author: User

Chapter One: HTTP Overview Introduction
web浏览器、服务器和相关的web应用程序都是通过http相互通信的,http是现代全球英特网中使用的公共语言。
Main contents of this chapter
1、web客户端与服务器是如何通信的2、资源(表示web内容)来自何方3、web事务(请求与响应)是怎样工作的4、http通信所使用的报文(请求报文/响应报文)5、底层TCP网络协议6、不同的http协议变体
1.2web Client and server
web内容都是存储在web服务器上的。web服务器所使用的是http协议,因此也经常称web服务器为http服务器。web客户端:通常可以认为是浏览器(IE、Firefox、Chrome)http服务器:种类很多(apache、nginx、tomcat等)

Client Server model

1.3 Resources
web服务器是web资源的宿主

Web resources are divided into

1、静态资源(html、txt、png等)2、动态资源(服务器生成资源比如访问数据库或第三方网关获取的数据)

MIME (Media type)

MIME是一种文本标记,表示一种主要的对象类型和一种特定的子类型,中间由一条斜杠(/)分隔比如:text/html,text/plain,image/jpeg,image/gif

URI (Uniform Resource Identifier)

URL(统一资源定位符)也是最最常用的    通常包含三部分:方案、服务器地址、资源地址    比如:http://www.baidu.com/index.phpURN(统一资源名)并不流行
1.4 Transactions (HTTP transactions)
http事务指的是一次完整的请求响应过程,并不是我们通常理解的数据库事务概念。

1.4.1 Method

1.4.2 Status Code

1.4.3web pages can contain multiple objects

1.5 Messages
http报文是由一行一行的简单字符串组成的。http报文是纯文本,不是二进制代码,所以很方便对其进行读写。

Message classification

请求报文响应报文

Message format

起始行首部字段(我自己这么叫:请求头/响应头)主体(请求体/响应体)备注:起始行和首部都是文本形式而且都是结构化的,而主体不是,主体中可以是任意二进制数据内容当然也可以是文本内容。

Request Message Format

Response message Format

1.6 Connecting 1.6.1 TCP/IP
http是个应用层协议.http无需惯性网络通信的具体细节,它把联网的细节都交给了通用可靠的因特网传输协议TCP/IP.

TCP/IP network model



1.6.2 Connection
基本的浏览器连接处理1、浏览器从URL中解析出服务器主机名2、浏览器将服务器主机名转换为ip地址3、浏览器将端口号从URL中解析出来4、浏览器建立一条与web服务器的TCP连接5、浏览器向服务器发送http请求报文6、服务器向浏览器发送http响应报文7、关闭连接、浏览器显示文档浏览器

Establish a TCP connection three times handshake

1.7 Protocol version
http版本主要有http 0.9:已经不用了http 1.0:有遗留http 1.1:目前主流http 2.0:正在大力推广备注:我们常听到的https并非指某个版本而是在http协议加上了基于ssl或tls封装。

H**TTPS Communication Principle * *

1.8web Structural components
代理:位于客户端和服务器之间的http中间实体缓存:http的仓库,使常用的页面和内容副本可以保存在离客户端更近的地方网关:连接其它应用程序的特殊web服务器隧道:对http通信报文进行盲转发的特殊代理Agent代理:发起自动http请求的半智能web客户端
Main features of the HTTP protocol
1、支持客户端/服务器端通信模式2、协议简单方便快速3、灵活:Http协议允许客户端和服务器端传输任意类型任意格式的数据对象,由Content-Type指定数据类型4、面向无连接(服务器响应之后立即断开,http1.0之后可以指定为无连接或长连接)5、面向无状态(客户端和服务器都不记忆状态,客户端传输数据就更少也更简单高效了,与此同时也引出了新的问题。)
Summarize
本章主要简单介绍了http协议和http协议涉及到的内容。

First chapter: HTTP overview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.