004.计算机网络基础(重点总结)
1.网络层次划分
2.OSI-七层模型
01.为什么要分层?
001.计算机或计算机网络,包含各种硬件设备如:计算机、网卡、交换机、路由器等,硬件本身并不能工作,通过操作系统和各种协议让计算机网络运行起来 (想象成:要让一个公司运行起来,出来办公硬件,还需要多个部门人员协同合作)
002.协议多且复杂,为了更好操作、理解学习,按照功能不能分为7层(想像成:一个公司分成7个部门,有些公司分成5个部门-TCP/IP五层模型,有些公司分成4个部门-TCP/IP四层模型,协议可以理解为每个部门遵从的部门规范,文档规范等)
02.七层模型详解
3.举例说明
在浏览器中输入 www.baidu.com 后执行的全部过程
现在假设如果我们在客户端(客户端)浏览器中输入http://www.baidu.com,而baidu.com为要访问的服务器(服务器),下面详细分析客户端为了访问服务器而执行的一系列关于协议的操作:
01.客户端浏览器通过DNS解析到www.baidu.com的IP地址220.181.27.48,通过这个IP地址找到客户端到服务器的路径。客户端浏览器发起一个HTTP会话到220.161.27.48,然后通过TCP进行封装数据包,输入到网络层。
02.在客户端的传输层,把HTTP会话请求分成报文段,添加源和目的端口,如服务器使用80端口监听客户端的请求,客户端由系统随机选择一个端口如5000,与服务器进行交换,服务器把相应的请求返回给客户端的5000端口。然后使用IP层的IP地址查找目的端。
03.客户端的网络层不用关系应用层或者传输层的东西,主要做的是通过查找路由表确定如何到达服务器,期间可能经过多个路由器,这些都是由路由器来完成的工作,不作过多的描述,无非就是通过查找路由表决定通过那个路径到达服务器。
04.客户端的链路层,包通过链路层发送到路由器,通过邻居协议查找给定IP地址的MAC地址,然后发送ARP请求查找目的地址,如果得到回应后就可以使用ARP的请求应答交换的IP数据包现在就可以传输了,然后发送IP数据包到达服务器的地址。
————————————————
本段转载来自:****博主「粘衣_乱飞」的原创文章
原文链接:https://blog.****.net/qq_33098049/article/details/82181517
4.TCP/IP协议
TCP/IP协议是互联网的基础协议,没有TCP/IP协议就无法上网
5.HTTP协议
可以理解成,网络报文可以用很多语言写,如英语、中文、日语、韩语,HTTP协议可以理解为英语,全世界通用
01.超文本传输协议(HTTP,HyperText Transfer Protocol),所有www文件都必须遵从这个协议
02.无状态的协议,第一次发送的请求和第二次发送的请求是独立的,第二个请求并不能继承上一个请求的处理状态
03.HTTP是基于TCP/IP通信协议来传输数据(HTML文件、图片文件、查询结果等)
04.HTTP工作原理:客户端(浏览器/应用程序)--URL(HTTP使用URI-统一资源标识符来传输数据和建立连接,URL是一种常用的 ,URL-统一资源定位符,全球性地址)--HTTP服务端(WEB服务器-Apache服务器,IIS服务器/应用程序)
05.几个基础概念:什么是域名?什么是网站名?什么是URL?
如: http://mail.163.com/index.html
001.http:这个是协议
002.mail:这个是服务器名
003.163.com:这个是域名
004.mail.163.com:这个是网站名=服务器名+域名
005./:这个是根目录
006.index.html:这个是根目录下的默认网页
007.http://mail.163.com/index.html:这个叫做URL,统一资源定位符(类似于:A发一封报价单(英文写的)给xxx省xxx市xxx区xxx栋的B)
06.客户端请求消息
https://www.jianshu.com/p/eb3e5ec98a66 客户端发送一个HTTP请求到服务器的请求消息包括以下格式:请求行(request line)、请求头部(header)、空行和请求数据四个部分组成,下图给出了请求报文的一般格式。请求头分为:general 、requestHeader
07.服务器响应消息
HTTP响应也由四个部分组成,分别是:状态行、消息报头、空行和响应正文。
08.HTTP Request Header 请求头
Header |
解释 |
示例 |
Accept |
指定客户端能够接收的内容类型 |
Accept: text/plain, text/html |
Accept-Charset |
浏览器可以接受的字符编码集。 |
Accept-Charset: iso-8859-5 |
Accept-Encoding |
指定浏览器可以支持的web服务器返回内容压缩编码类型。 |
Accept-Encoding: compress, gzip |
Accept-Language |
浏览器可接受的语言 |
Accept-Language: en,zh |
Accept-Ranges |
可以请求网页实体的一个或者多个子范围字段 |
Accept-Ranges: bytes |
Authorization |
HTTP授权的授权证书 |
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
Cache-Control |
指定请求和响应遵循的缓存机制 |
Cache-Control: no-cache |
Connection |
表示是否需要持久连接。(HTTP 1.1默认进行持久连接) |
Connection: close |
Cookie |
HTTP请求发送时,会把保存在该请求域名下的所有cookie值一起发送给web服务器。 |
Cookie: $Version=1; Skin=new; |
Content-Length |
请求的内容长度 |
Content-Length: 348 |
Content-Type |
请求的与实体对应的MIME信息 |
Content-Type: application/x-www-form-urlencoded |
Date |
请求发送的日期和时间 |
Date: Tue, 15 Nov 2010 08:12:31 GMT |
Expect |
请求的特定的服务器行为 |
Expect: 100-continue |
From |
发出请求的用户的Email |
From: [email protected] |
Host |
指定请求的服务器的域名和端口号 |
Host: www.zcmhi.com |
If-Match |
只有请求内容与实体相匹配才有效 |
If-Match: “737060cd8c284d8af7ad3082f209582d” |
If-Modified-Since |
如果请求的部分在指定时间之后被修改则请求成功,未被修改则返回304代码 |
If-Modified-Since: Sat, 29 Oct 2010 19:43:31 GMT |
If-None-Match |
如果内容未改变返回304代码,参数为服务器先前发送的Etag,与服务器回应的Etag比较判断是否改变 |
If-None-Match: “737060cd8c284d8af7ad3082f209582d” |
If-Range |
如果实体未改变,服务器发送客户端丢失的部分,否则发送整个实体。参数也为Etag |
If-Range: “737060cd8c284d8af7ad3082f209582d” |
If-Unmodified-Since |
只在实体在指定时间之后未被修改才请求成功 |
If-Unmodified-Since: Sat, 29 Oct 2010 19:43:31 GMT |
Max-Forwards |
限制信息通过代理和网关传送的时间 |
Max-Forwards: 10 |
Pragma |
用来包含实现特定的指令 |
Pragma: no-cache |
Proxy-Authorization |
连接到代理的授权证书 |
Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
Range |
只请求实体的一部分,指定范围 |
Range: bytes=500-999 |
Referer |
先前网页的地址,当前请求网页紧随其后,即来路 |
Referer: http://www.zcmhi.com/archives/71.html |
TE |
客户端愿意接受的传输编码,并通知服务器接受接受尾加头信息 |
TE: trailers,deflate;q=0.5 |
Upgrade |
向服务器指定某种传输协议以便服务器进行转换(如果支持) |
Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 |
User-Agent |
User-Agent的内容包含发出请求的用户信息 |
User-Agent: Mozilla/5.0 (Linux; X11) |
Via |
通知中间网关或代理服务器地址,通信协议 |
Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) |
Warning |
关于消息实体的警告信息 |
Warn: 199 Miscellaneous warning |
09.HTTP Responses Header 响应头
Header |
解释 |
示例 |
Accept-Ranges |
表明服务器是否支持指定范围请求及哪种类型的分段请求 |
Accept-Ranges: bytes |
Age |
从原始服务器到代理缓存形成的估算时间(以秒计,非负) |
Age: 12 |
Allow |
对某网络资源的有效的请求行为,不允许则返回405 |
Allow: GET, HEAD |
Cache-Control |
告诉所有的缓存机制是否可以缓存及哪种类型 |
Cache-Control: no-cache |
Content-Encoding |
web服务器支持的返回内容压缩编码类型。 |
Content-Encoding: gzip |
Content-Language |
响应体的语言 |
Content-Language: en,zh |
Content-Length |
响应体的长度 |
Content-Length: 348 |
Content-Location |
请求资源可替代的备用的另一地址 |
Content-Location: /index.htm |
Content-MD5 |
返回资源的MD5校验值 |
Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== |
Content-Range |
在整个返回体中本部分的字节位置 |
Content-Range: bytes 21010-47021/47022 |
Content-Type |
返回内容的MIME类型 |
Content-Type: text/html; charset=utf-8 |
Date |
原始服务器消息发出的时间 |
Date: Tue, 15 Nov 2010 08:12:31 GMT |
ETag |
请求变量的实体标签的当前值 |
ETag: “737060cd8c284d8af7ad3082f209582d” |
Expires |
响应过期的日期和时间 |
Expires: Thu, 01 Dec 2010 16:00:00 GMT |
Last-Modified |
请求资源的最后修改时间 |
Last-Modified: Tue, 15 Nov 2010 12:45:26 GMT |
Location |
用来重定向接收方到非请求URL的位置来完成请求或标识新的资源 |
Location: http://www.zcmhi.com/archives/94.html |
Pragma |
包括实现特定的指令,它可应用到响应链上的任何接收方 |
Pragma: no-cache |
Proxy-Authenticate |
它指出认证方案和可应用到代理的该URL上的参数 |
Proxy-Authenticate: Basic |
refresh |
应用于重定向或一个新的资源被创造,在5秒之后重定向(由网景提出,被大部分浏览器支持) |
Refresh: 5; url= http://www.zcmhi.com/archives/94.html |
Retry-After |
如果实体暂时不可取,通知客户端在指定时间之后再次尝试 |
Retry-After: 120 |
Server |
web服务器软件名称 |
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) |
Set-Cookie |
设置Http Cookie |
Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1 |
Trailer |
指出头域在分块传输编码的尾部存在 |
Trailer: Max-Forwards |
Transfer-Encoding |
文件传输编码 |
Transfer-Encoding:chunked |
Vary |
告诉下游代理是使用缓存响应还是从原始服务器请求 |
Vary: * |
Via |
告知代理客户端响应是通过哪里发送的 |
Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) |
Warning |
警告实体可能存在的问题 |
Warning: 199 Miscellaneous warning |
WWW-Authenticate |
表明客户端请求实体应该使用的授权方案 |
WWW-Authenticate: Basic |
10.HTTP content-type
文件扩展名 |
Content-Type(Mime-Type) |
文件扩展名 |
Content-Type(Mime-Type) |
.*( 二进制流,不知道下载文件类型) |
application/octet-stream |
.tif |
image/tiff |
.001 |
application/x-001 |
.301 |
application/x-301 |
.323 |
text/h323 |
.906 |
application/x-906 |
.907 |
drawing/907 |
.a11 |
application/x-a11 |
.acp |
audio/x-mei-aac |
.ai |
application/postscript |
.aif |
audio/aiff |
.aifc |
audio/aiff |
.aiff |
audio/aiff |
.anv |
application/x-anv |
.asa |
text/asa |
.asf |
video/x-ms-asf |
.asp |
text/asp |
.asx |
video/x-ms-asf |
.au |
audio/basic |
.avi |
video/avi |
.awf |
application/vnd.adobe.workflow |
.biz |
text/xml |
.bmp |
application/x-bmp |
.bot |
application/x-bot |
.c4t |
application/x-c4t |
.c90 |
application/x-c90 |
.cal |
application/x-cals |
.cat |
application/vnd.ms-pki.seccat |
.cdf |
application/x-netcdf |
.cdr |
application/x-cdr |
.cel |
application/x-cel |
.cer |
application/x-x509-ca-cert |
.cg4 |
application/x-g4 |
.cgm |
application/x-cgm |
.cit |
application/x-cit |
.class |
java/* |
.cml |
text/xml |
.cmp |
application/x-cmp |
.cmx |
application/x-cmx |
.cot |
application/x-cot |
.crl |
application/pkix-crl |
.crt |
application/x-x509-ca-cert |
.csi |
application/x-csi |
.css |
text/css |
.cut |
application/x-cut |
.dbf |
application/x-dbf |
.dbm |
application/x-dbm |
.dbx |
application/x-dbx |
.dcd |
text/xml |
.dcx |
application/x-dcx |
.der |
application/x-x509-ca-cert |
.dgn |
application/x-dgn |
.dib |
application/x-dib |
.dll |
application/x-msdownload |
.doc |
application/msword |
.dot |
application/msword |
.drw |
application/x-drw |
.dtd |
text/xml |
.dwf |
Model/vnd.dwf |
.dwf |
application/x-dwf |
.dwg |
application/x-dwg |
.dxb |
application/x-dxb |
.dxf |
application/x-dxf |
.edn |
application/vnd.adobe.edn |
.emf |
application/x-emf |
.eml |
message/rfc822 |
.ent |
text/xml |
.epi |
application/x-epi |
.eps |
application/x-ps |
.eps |
application/postscript |
.etd |
application/x-ebx |
.exe |
application/x-msdownload |
.fax |
image/fax |
.fdf |
application/vnd.fdf |
.fif |
application/fractals |
.fo |
text/xml |
.frm |
application/x-frm |
.g4 |
application/x-g4 |
.gbr |
application/x-gbr |
. |
application/x- |
.gif |
image/gif |
.gl2 |
application/x-gl2 |
.gp4 |
application/x-gp4 |
.hgl |
application/x-hgl |
.hmr |
application/x-hmr |
.hpg |
application/x-hpgl |
.hpl |
application/x-hpl |
.hqx |
application/mac-binhex40 |
.hrf |
application/x-hrf |
.hta |
application/hta |
.htc |
text/x-component |
.htm |
text/html |
.html |
text/html |
.htt |
text/webviewhtml |
.htx |
text/html |
.icb |
application/x-icb |
.ico |
image/x-icon |
.ico |
application/x-ico |
.iff |
application/x-iff |
.ig4 |
application/x-g4 |
.igs |
application/x-igs |
.iii |
application/x-iphone |
.img |
application/x-img |
.ins |
application/x-internet-signup |
.isp |
application/x-internet-signup |
.IVF |
video/x-ivf |
.java |
java/* |
.jfif |
image/jpeg |
.jpe |
image/jpeg |
.jpe |
application/x-jpe |
.jpeg |
image/jpeg |
.jpg |
image/jpeg |
.jpg |
application/x-jpg |
.js |
application/x-javascript |
.jsp |
text/html |
.la1 |
audio/x-liquid-file |
.lar |
application/x-laplayer-reg |
.latex |
application/x-latex |
.lavs |
audio/x-liquid-secure |
.lbm |
application/x-lbm |
.lmsff |
audio/x-la-lms |
.ls |
application/x-javascript |
.ltr |
application/x-ltr |
.m1v |
video/x-mpeg |
.m2v |
video/x-mpeg |
.m3u |
audio/mpegurl |
.m4e |
video/mpeg4 |
.mac |
application/x-mac |
.man |
application/x-troff-man |
.math |
text/xml |
.mdb |
application/msaccess |
.mdb |
application/x-mdb |
.mfp |
application/x-shockwave-flash |
.mht |
message/rfc822 |
.mhtml |
message/rfc822 |
.mi |
application/x-mi |
.mid |
audio/mid |
.midi |
audio/mid |
.mil |
application/x-mil |
.mml |
text/xml |
.mnd |
audio/x-musicnet-download |
.mns |
audio/x-musicnet-stream |
.mocha |
application/x-javascript |
.movie |
video/x-sgi-movie |
.mp1 |
audio/mp1 |
.mp2 |
audio/mp2 |
.mp2v |
video/mpeg |
.mp3 |
audio/mp3 |
.mp4 |
video/mpeg4 |
.mpa |
video/x-mpg |
.mpd |
application/vnd.ms-project |
.mpe |
video/x-mpeg |
.mpeg |
video/mpg |
.mpg |
video/mpg |
.mpga |
audio/rn-mpeg |
.mpp |
application/vnd.ms-project |
.mps |
video/x-mpeg |
.mpt |
application/vnd.ms-project |
.mpv |
video/mpg |
.mpv2 |
video/mpeg |
.mpw |
application/vnd.ms-project |
.mpx |
application/vnd.ms-project |
.mtx |
text/xml |
.mxp |
application/x-mmxp |
.net |
image/pnetvue |
.nrf |
application/x-nrf |
.nws |
message/rfc822 |
.odc |
text/x-ms-odc |
.out |
application/x-out |
.p10 |
application/pkcs10 |
.p12 |
application/x-pkcs12 |
.p7b |
application/x-pkcs7-certificates |
.p7c |
application/pkcs7-mime |
.p7m |
application/pkcs7-mime |
.p7r |
application/x-pkcs7-certreqresp |
.p7s |
application/pkcs7-signature |
.pc5 |
application/x-pc5 |
.pci |
application/x-pci |
.pcl |
application/x-pcl |
.pcx |
application/x-pcx |
|
application/pdf |
|
application/pdf |
.pdx |
application/vnd.adobe.pdx |
.pfx |
application/x-pkcs12 |
.pgl |
application/x-pgl |
.pic |
application/x-pic |
.pko |
application/vnd.ms-pki.pko |
.pl |
application/x-perl |
.plg |
text/html |
.pls |
audio/scpls |
.plt |
application/x-plt |
.png |
image/png |
.png |
application/x-png |
.pot |
application/vnd.ms-powerpoint |
.ppa |
application/vnd.ms-powerpoint |
.ppm |
application/x-ppm |
.pps |
application/vnd.ms-powerpoint |
.ppt |
application/vnd.ms-powerpoint |
.ppt |
application/x-ppt |
.pr |
application/x-pr |
.prf |
application/pics-rules |
.prn |
application/x-prn |
.prt |
application/x-prt |
.ps |
application/x-ps |
.ps |
application/postscript |
.ptn |
application/x-ptn |
.pwz |
application/vnd.ms-powerpoint |
.r3t |
text/vnd.rn-realtext3d |
.ra |
audio/vnd.rn-realaudio |
.ram |
audio/x-pn-realaudio |
.ras |
application/x-ras |
.rat |
application/rat-file |
.rdf |
text/xml |
.rec |
application/vnd.rn-recording |
.red |
application/x-red |
.rgb |
application/x-rgb |
.rjs |
application/vnd.rn-realsystem-rjs |
.rjt |
application/vnd.rn-realsystem-rjt |
.rlc |
application/x-rlc |
.rle |
application/x-rle |
.rm |
application/vnd.rn-realmedia |
.rmf |
application/vnd.adobe.rmf |
.rmi |
audio/mid |
.rmj |
application/vnd.rn-realsystem-rmj |
.rmm |
audio/x-pn-realaudio |
.rmp |
application/vnd.rn-rn_music_package |
.rms |
application/vnd.rn-realmedia-secure |
.rmvb |
application/vnd.rn-realmedia-vbr |
.rmx |
application/vnd.rn-realsystem-rmx |
.rnx |
application/vnd.rn-realplayer |
.rp |
image/vnd.rn-realpix |
.rpm |
audio/x-pn-realaudio-plugin |
.rsml |
application/vnd.rn-rsml |
.rt |
text/vnd.rn-realtext |
.rtf |
application/msword |
.rtf |
application/x-rtf |
.rv |
video/vnd.rn-realvideo |
.sam |
application/x-sam |
.sat |
application/x-sat |
.sdp |
application/sdp |
.sdw |
application/x-sdw |
.sit |
application/x-stuffit |
.slb |
application/x-slb |
.sld |
application/x-sld |
.slk |
drawing/x-slk |
.smi |
application/smil |
.smil |
application/smil |
.smk |
application/x-smk |
.snd |
audio/basic |
.sol |
text/plain |
.sor |
text/plain |
.spc |
application/x-pkcs7-certificates |
.spl |
application/futuresplash |
.spp |
text/xml |
.ssm |
application/streamingmedia |
.sst |
application/vnd.ms-pki.certstore |
.stl |
application/vnd.ms-pki.stl |
.stm |
text/html |
.sty |
application/x-sty |
.svg |
text/xml |
.swf |
application/x-shockwave-flash |
.tdf |
application/x-tdf |
.tg4 |
application/x-tg4 |
.tga |
application/x-tga |
.tif |
image/tiff |
.tif |
application/x-tif |
.tiff |
image/tiff |
.tld |
text/xml |
.top |
drawing/x-top |
.torrent |
application/x-bittorrent |
.tsd |
text/xml |
.txt |
text/plain |
.uin |
application/x-icq |
.uls |
text/iuls |
.vcf |
text/x-vcard |
.vda |
application/x-vda |
.vdx |
application/vnd.visio |
.vml |
text/xml |
.vpg |
application/x-vpeg005 |
.vsd |
application/vnd.visio |
.vsd |
application/x-vsd |
.vss |
application/vnd.visio |
.vst |
application/vnd.visio |
.vst |
application/x-vst |
.vsw |
application/vnd.visio |
.vsx |
application/vnd.visio |
.vtx |
application/vnd.visio |
.vxml |
text/xml |
.wav |
audio/wav |
.wax |
audio/x-ms-wax |
.wb1 |
application/x-wb1 |
.wb2 |
application/x-wb2 |
.wb3 |
application/x-wb3 |
.wbmp |
image/vnd.wap.wbmp |
.wiz |
application/msword |
.wk3 |
application/x-wk3 |
.wk4 |
application/x-wk4 |
.wkq |
application/x-wkq |
.wks |
application/x-wks |
.wm |
video/x-ms-wm |
.wma |
audio/x-ms-wma |
.wmd |
application/x-ms-wmd |
.wmf |
application/x-wmf |
.wml |
text/vnd.wap.wml |
.wmv |
video/x-ms-wmv |
.wmx |
video/x-ms-wmx |
.wmz |
application/x-ms-wmz |
.wp6 |
application/x-wp6 |
.wpd |
application/x-wpd |
.wpg |
application/x-wpg |
.wpl |
application/vnd.ms-wpl |
.wq1 |
application/x-wq1 |
.wr1 |
application/x-wr1 |
.wri |
application/x-wri |
.wrk |
application/x-wrk |
.ws |
application/x-ws |
.ws2 |
application/x-ws |
.wsc |
text/scriptlet |
.wsdl |
text/xml |
.wvx |
application/javascript |
.xdp |
application/vnd.adobe.xdp |
.xdr |
text/xml |
.xfd |
application/vnd.adobe.xfd |
.xfdf |
application/vnd.adobe.xfdf |
.xhtml |
text/html |
.xls |
application/vnd.ms-excel |
.xls |
application/x-xls |
.xlw |
application/x-xlw |
.xml |
text/xml |
.xpl |
audio/scpls |
.xq |
text/xml |
.xql |
text/xml |
.xquery |
text/xml |
.xsd |
text/xml |
.xsl |
text/xml |
.xslt |
text/xml |
.xwd |
application/x-xwd |
.x_b |
application/x-x_b |
.sis |
application/vnd.symbian.install |
.sisx |
application/vnd.symbian.install |
.x_t |
application/x-x_t |
.ipa |
application/vnd.iphone |
.apk |
application/vnd.android.package-archive |
.xap |
application/x-silverlight-app |
11.状态码的五个分类
001.HTTP状态码,网页服务器返回到浏览器的用于表示响应状态的标志,由3位十进制数字组成
002.五种类型
1XX 信息,服务器收到请求,需要请求者继续执行操作
2XX 成功,操作被成功接受并响应
3XX 重定向,需要进一步的操作以完成请求
4XX 客户端错误,请求包含语法错误或无法完成请求
5XX 服务器错误,服务器在处理请求的过程中发生错误
注意:
·状态码的取值范围为100~599
·常用的状态码
·200---请求成功
·301---资源(网页等)被永久转移到URL
·404---请求的资源不存在
·500---内部服务器错误
状态码列表:
状态码 |
状态码英文名称 |
中文描述 |
100 |
Continue |
继续。客户端应继续其请求 |
101 |
Switching Protocols |
切换协议。服务器根据客户端的请求切换协议。只能切换到更高级的协议,例如,切换到HTTP的新版本协议 |
200 |
OK |
请求成功。一般用于GET与POST请求 |
201 |
Created |
已创建。成功请求并创建了新的资源 |
202 |
Accepted |
已接受。已经接受请求,但未处理完成 |
203 |
Non-Authoritative Information |
非授权信息。请求成功。但返回的meta信息不在原始的服务器,而是一个副本 |
204 |
No Content |
无内容。服务器成功处理,但未返回内容。在未更新网页的情况下,可确保浏览器继续显示当前文档 |
205 |
Reset Content |
重置内容。服务器处理成功,用户终端(例如:浏览器)应重置文档视图。可通过此返回码清除浏览器的表单域 |
206 |
Partial Content |
部分内容。服务器成功处理了部分GET请求 |
300 |
Multiple Choices |
多种选择。请求的资源可包括多个位置,相应可返回一个资源特征与地址的列表用于用户终端(例如:浏览器)选择 |
301 |
Moved Permanently |
永久移动。请求的资源已被永久的移动到新URI,返回信息会包括新的URI,浏览器会自动定向到新URI。今后任何新的请求都应使用新的URI代替 |
302 |
Found |
临时移动。与301类似。但资源只是临时被移动。客户端应继续使用原有URI |
303 |
See Other |
查看其它地址。与301类似。使用GET和POST请求查看 |
304 |
Not Modified |
未修改。所请求的资源未修改,服务器返回此状态码时,不会返回任何资源。客户端通常会缓存访问过的资源,通过提供一个头信息指出客户端希望只返回在指定日期之后修改的资源 |
305 |
Use Proxy |
使用代理。所请求的资源必须通过代理访问 |
306 |
Unused |
已经被废弃的HTTP状态码 |
307 |
Temporary Redirect |
临时重定向。与302类似。使用GET请求重定向 |
400 |
Bad Request |
客户端请求的语法错误,服务器无法理解 |
401 |
Unauthorized |
请求要求用户的身份认证 |
402 |
Payment Required |
保留,将来使用 |
403 |
Forbidden |
服务器理解请求客户端的请求,但是拒绝执行此请求 |
404 |
Not Found |
服务器无法根据客户端的请求找到资源(网页)。通过此代码,网站设计人员可设置"您所请求的资源无法找到"的个性页面 |
405 |
Method Not Allowed |
客户端请求中的方法被禁止 |
406 |
Not Acceptable |
服务器无法根据客户端请求的内容特性完成请求 |
407 |
Proxy Authentication Required |
请求要求代理的身份认证,与401类似,但请求者应当使用代理进行授权 |
408 |
Request Time-out |
服务器等待客户端发送的请求时间过长,超时 |
409 |
Conflict |
服务器完成客户端的PUT请求是可能返回此代码,服务器处理请求时发生了冲突 |
410 |
Gone |
客户端请求的资源已经不存在。410不同于404,如果资源以前有现在被永久删除了可使用410代码,网站设计人员可通过301代码指定资源的新位置 |
411 |
Length Required |
服务器无法处理客户端发送的不带Content-Length的请求信息 |
412 |
Precondition Failed |
客户端请求信息的先决条件错误 |
413 |
Request Entity Too Large |
由于请求的实体过大,服务器无法处理,因此拒绝请求。为防止客户端的连续请求,服务器可能会关闭连接。如果只是服务器暂时无法处理,则会包含一个Retry-After的响应信息 |
414 |
Request-URI Too Large |
请求的URI过长(URI通常为网址),服务器无法处理 |
415 |
Unsupported Media Type |
服务器无法处理请求附带的媒体格式 |
416 |
Requested range not satisfiable |
客户端请求的范围无效 |
417 |
Expectation Failed |
服务器无法满足Expect的请求头信息 |
500 |
Internal Server Error |
服务器内部错误,无法完成请求 |
501 |
Not Implemented |
服务器不支持请求的功能,无法完成请求 |
502 |
Bad Gateway |
作为网关或者代理工作的服务器尝试执行请求时,从远程服务器接收到了一个无效的响应 |
503 |
Service Unavailable |
由于超载或系统维护,服务器暂时的无法处理客户端的请求。延时的长度可包含在服务器的Retry-After头信息中 |
504 |
Gateway Time-out |
充当网关或代理的服务器,未及时从远端服务器获取请求 |
505 |
HTTP Version not supported |
服务器不支持请求的HTTP协议的版本,无法完成处理 |
11.报文中重要的几个字段
001.Cookies,请求报文中,用于存放cookies内容,辨别用户身份
002.Content-Type,表示后面的文档属于什么MIME(扩展名)类型
003.Location,表示客户应当到哪里去提取文档
004.Set-Cookie,设置和页面关联的Cookie