MIME類型就是設定某種擴展名 的文件用一種應用程序來打開的方式類型,當該擴展名文件被訪問的時候,瀏覽器會自動使用指定應用程序來打開。多用于指定一些客戶端自定義的文件名,以及一些媒體文件打開方式。
下面列出常用的文件對應的MIME類型:
Mime- Types(mime類型) | Dateiendung(擴 展名) | Bedeutung |
---|---|---|
application/msexcel | *.xls *.xla | Microsoft Excel Dateien |
application/mshelp | *.hlp *.chm | Microsoft Windows Hilfe Dateien |
application/mspowerpoint | *.ppt *.ppz *.pps *.pot | Microsoft Powerpoint Dateien |
application/msword | *.doc *.dot | Microsoft Word Dateien |
application/octet-stream |
*.exe | exe |
application/pdf | Adobe PDF-Dateien | |
application/post****** | *.ai *.eps *.ps | Adobe Post******-Dateien |
application/rtf | *.rtf | Microsoft RTF-Dateien |
application/x-httpd-php | *.php *.phtml | PHP-Dateien |
application/x-java****** | *.js | serverseitige Java******-Dateien |
application/x-shockwave-flash | *.swf *.cab | Flash Shockwave-Dateien |
application/zip | *.zip | ZIP-Archivdateien |
audio/basic | *.au *.snd | Sound-Dateien |
audio/mpeg | *.mp3 | MPEG-Dateien |
audio/x-midi | *.mid *.midi | MIDI-Dateien |
audio/x-mpeg | *.mp2 | MPEG-Dateien |
audio/x-wav | *.wav | Wav-Dateien |
image/gif | *.gif | GIF-Dateien |
image/jpeg | *.jpeg *.jpg *.jpe | JPEG-Dateien |
image/x-windowdump | *.xwd | X-Windows Dump |
text/css | *.css | CSS Stylesheet-Dateien |
text/html | *.htm *.html *.shtml | -Dateien |
text/java****** | *.js | Java******-Dateien |
text/plain | *.txt | reine Textdateien |
video/mpeg | *.mpeg *.mpg *.mpe | MPEG-Dateien |
video/vnd.rn-realvideo | *.rmvb | realplay-Dateien |
video/quicktime | *.qt *.mov | Quicktime-Dateien |
video/vnd.vivo | *viv *.vivo | Vivo-Dateien |
更多....查找請用ctrl+F
MIME類型大全
application/vnd.lotus-1-2-3
3gp video/3gpp
aab application/x-authoware-bin
aam application/x-authoware-map
aas application/x-authoware-seg
ai application/post******
aif audio/x-aiff
aifc audio/x-aiff
aiff audio/x-aiff
als audio/X-Alpha5
amc application/x-mpeg
ani application/octet-stream
asc text/plain
asd application/astound
asf video/x-ms-asf
asn application/astound
asp application/x-asap
asx video/x-ms-asf
au audio/basic
avb application/octet-stream
avi video/x-msvideo
awb audio/amr-wb
bcpio application/x-bcpio
bin application/octet-stream
bld application/bld
bld2 application/bld2
bmp application/x-MS-bmp
bpk application/octet-stream
bz2 application/x-bzip2
cal image/x-cals
ccn application/x-cnc
cco application/x-cocoa
cdf application/x-netcdf
cgi magnus-internal/cgi
chat application/x-chat
class application/octet-stream
clp application/x-msclip
cmx application/x-cmx
co application/x-cult3d-object
cod image/cis-cod
cpio application/x-cpio
cpt application/mac-compactpro
crd application/x-mscardfile
csh application/x-csh
csm chemical/x-csml
csml chemical/x-csml
css text/css
cur application/octet-stream
dcm x-lml/x-evm
dcr application/x-director
dcx image/x-dcx
dhtml text/html
dir application/x-director
dll application/octet-stream
dmg application/octet-stream
dms application/octet-stream
doc application/msword
dot application/x-dot
dvi application/x-dvi
dwf drawing/x-dwf
dwg application/x-autocad
dxf application/x-autocad
dxr application/x-director
ebk application/x-expandedbook
emb chemical/x-embl-dl-nucleotide
embl chemical/x-embl-dl-nucleotide
eps application/post******
eri image/x-eri
es audio/echospeech
esl audio/echospeech
etc application/x-earthtime
etx text/x-setext
evm x-lml/x-evm
evy application/x-envoy
exe application/octet-stream
fh4 image/x-freehand
fh5 image/x-freehand
fhc image/x-freehand
fif image/fif
fm application/x-maker
fpx image/x-fpx
fvi video/isivideo
gau chemical/x-gaussian-input
gca application/x-gca-compressed
gdb x-lml/x-gdb
gif image/gif
gps application/x-gps
gtar application/x-gtar
gz application/x-gzip
hdf application/x-hdf
hdm text/x-hdml
hdml text/x-hdml
hlp application/winhlp
hqx application/mac-binhex40
htm text/html
html text/html
hts text/html
ice x-conference/x-cooltalk
ico application/octet-stream
ief image/ief
ifm image/gif
ifs image/ifs
imy audio/melody
ins application/x-NET-Install
ips application/x-ip******
ipx application/x-ipix
it audio/x-mod
itz audio/x-mod
ivr i-world/i-vrml
j2k image/j2k
jad text/vnd.sun.j2me.app-de******or
jam application/x-jam
jar application/java-archive
jnlp application/x-java-jnlp-file
jpe image/jpeg
jpeg image/jpeg
jpg image/jpeg
jpz image/jpeg
js application/x-java******
jwc application/jwc
kjx application/x-kjx
lak x-lml/x-lak
latex application/x-latex
lcc application/fastman
lcl application/x-digitalloca
lcr application/x-digitalloca
lgh application/lgh
lha application/octet-stream
lml x-lml/x-lml
lmlpack x-lml/x-lmlpack
lsf video/x-ms-asf
lsx video/x-ms-asf
lzh application/x-lzh
m13 application/x-msmediaview
m14 application/x-msmediaview
m15 audio/x-mod
m3u audio/x-mpegurl
m3url audio/x-mpegurl
ma1 audio/ma1
ma2 audio/ma2
ma3 audio/ma3
ma5 audio/ma5
man application/x-troff-man
map magnus-internal/imagemap
mbd application/mbedlet
mct application/x-mascot
mdb application/x-msaccess
mdz audio/x-mod
me application/x-troff-me
mel text/x-vmel
mi application/x-mif
mid audio/midi
midi audio/midi
mif application/x-mif
mil image/x-cals
mio audio/x-mio
mmf application/x-skt-lbs
mng video/x-mng
mny application/x-msmoney
moc application/x-mocha
mocha application/x-mocha
mod audio/x-mod
mof application/x-yumekara
mol chemical/x-mdl-molfile
mop chemical/x-mopac-input
mov video/quicktime
movie video/x-sgi-movie
mp2 audio/x-mpeg
mp3 audio/x-mpeg
mp4 video/mp4
mpc application/vnd.mpohun.certificate
mpe video/mpeg
mpeg video/mpeg
mpg video/mpeg
mpg4 video/mp4
mpga audio/mpeg
mpn application/vnd.mophun.application
mpp application/vnd.ms-project
mps application/x-mapserver
mrl text/x-mrml
mrm application/x-mrm
ms application/x-troff-ms
mts application/metastream
mtx application/metastream
mtz application/metastream
mzv application/metastream
nar application/zip
nbmp image/nbmp
nc application/x-netcdf
ndb x-lml/x-ndb
ndwn application/ndwn
nif application/x-nif
nmz application/x-scream
nokia-op-logo image/vnd.nok-oplogo-color
npx application/x-netfpx
nsnd audio/nsnd
nva application/x-neva1
oda application/oda
oom application/x-AtlasMate-Plugin
pac audio/x-pac
pae audio/x-epac
pan application/x-pan
pbm image/x-portable-bitmap
pcx image/x-pcx
pda image/x-pda
pdb chemical/x-pdb
pdf application/pdf
pfr application/font-tdpfr
pgm image/x-portable-graymap
pict image/x-pict
pm application/x-perl
pmd application/x-pmd
png image/png
pnm image/x-portable-anymap
pnz image/png
pot application/vnd.ms-powerpoint
ppm image/x-portable-pixmap
pps application/vnd.ms-powerpoint
ppt application/vnd.ms-powerpoint
pqf application/x-cprplayer
pqi application/cprplayer
prc application/x-prc
proxy application/x-ns-proxy-autoconfig
ps application/post******
ptlk application/listenup
pub application/x-mspublisher
pvx video/x-pv-pvx
qcp audio/vnd.qcelp
qt video/quicktime
qti image/x-quicktime
qtif image/x-quicktime
r3t text/vnd.rn-realtext3d
ra audio/x-pn-realaudio
ram audio/x-pn-realaudio
rar application/x-rar-compressed
ras image/x-cmu-raster
rdf application/rdf+xml
rf image/vnd.rn-realflash
rgb image/x-rgb
rlf application/x-richlink
rm audio/x-pn-realaudio
rmf audio/x-rmf
rmm audio/x-pn-realaudio
rmvb audio/x-pn-realaudio
rnx application/vnd.rn-realplayer
roff application/x-troff
rp image/vnd.rn-realpix
rpm audio/x-pn-realaudio-plugin
rt text/vnd.rn-realtext
rte x-lml/x-gps
rtf application/rtf
rtg application/metastream
rtx text/richtext
rv video/vnd.rn-realvideo
rwc application/x-rogerwilco
s3m audio/x-mod
s3z audio/x-mod
sca application/x-supercard
scd application/x-msschedule
sdf application/e-score
sea application/x-stuffit
sgm text/x-sgml
sgml text/x-sgml
sh application/x-sh
shar application/x-shar
shtml magnus-internal/parsed-html
shw application/presentations
si6 image/si6
si7 image/vnd.stiwap.sis
si9 image/vnd.lgtwap.sis
sis application/vnd.symbian.install
sit application/x-stuffit
skd application/x-Koan
skm application/x-Koan
skp application/x-Koan
skt application/x-Koan
slc application/x-salsa
smd audio/x-smd
smi application/smil
smil application/smil
smp application/studiom
smz audio/x-smd
snd audio/basic
spc text/x-speech
spl application/futuresplash
spr application/x-sprite
sprite application/x-sprite
spt application/x-spt
src application/x-wais-source
stk application/hyperstudio
stm audio/x-mod
sv4cpio application/x-sv4cpio
sv4crc application/x-sv4crc
svf image/vnd
svg image/svg-xml
svh image/svh
svr x-world/x-svr
swf application/x-shockwave-flash
swfl application/x-shockwave-flash
t application/x-troff
tad application/octet-stream
talk text/x-speech
tar application/x-tar
taz application/x-tar
tbp application/x-timbuktu
tbt application/x-timbuktu
tcl application/x-tcl
tex application/x-tex
texi application/x-texinfo
texinfo application/x-texinfo
tgz application/x-tar
thm application/vnd.eri.thm
tif image/tiff
tiff image/tiff
tki application/x-tkined
tkined application/x-tkined
toc application/toc
toy image/toy
tr application/x-troff
trk x-lml/x-gps
trm application/x-msterminal
tsi audio/tsplayer
tsp application/dsptype
tsv text/tab-separated-values
tsv text/tab-separated-values
ttf application/octet-stream
ttz application/t-time
txt text/plain
ult audio/x-mod
ustar application/x-ustar
uu application/x-uuencode
uue application/x-uuencode
vcd application/x-cdlink
vcf text/x-vcard
vdo video/vdo
vib audio/vib
viv video/vivo
vivo video/vivo
vmd application/vocaltec-media-desc
vmf application/vocaltec-media-file
vmi application/x-dreamcast-vms-info
vms application/x-dreamcast-vms
vox audio/voxware
vqe audio/x-twinvq-plugin
vqf audio/x-twinvq
vql audio/x-twinvq
vre x-world/x-vream
vrml x-world/x-vrml
vrt x-world/x-vrt
vrw x-world/x-vream
vts workbook/formulaone
wav audio/x-wav
wax audio/x-ms-wax
wbmp image/vnd.wap.wbmp
web application/vnd.xara
wi image/wavelet
wis application/x-InstallShield
wm video/x-ms-wm
wma audio/x-ms-wma
wmd application/x-ms-wmd
wmf application/x-msmetafile
wml text/vnd.wap.wml
wmlc application/vnd.wap.wmlc
wmls text/vnd.wap.wml******
wmlsc application/vnd.wap.wml******c
wml****** text/vnd.wap.wml******
wmv audio/x-ms-wmv
wmx video/x-ms-wmx
wmz application/x-ms-wmz
wpng image/x-up-wpng
wpt x-lml/x-gps
wri application/x-mswrite
wrl x-world/x-vrml
wrz x-world/x-vrml
ws text/vnd.wap.wml******
wsc application/vnd.wap.wml******c
wv video/wavelet
wvx video/x-ms-wvx
wxl application/x-wxl
x-gzip application/x-gzip
xar application/vnd.xara
xbm image/x-xbitmap
xdm application/x-xdma
xdma application/x-xdma
xdw application/vnd.fujixerox.docuworks
xht application/xhtml+xml
xhtm application/xhtml+xml
xhtml application/xhtml+xml
xla application/vnd.ms-excel
xlc application/vnd.ms-excel
xll application/x-excel
xlm application/vnd.ms-excel
xls application/vnd.ms-excel
xlt application/vnd.ms-excel
xlw application/vnd.ms-excel
xm audio/x-mod
xml text/xml
xmz audio/x-mod
xpi application/x-xpinstall
xpm image/x-xpixmap
xsit text/xml
xsl text/xml
xul text/xul
xwd image/x-xwindowdump
xyz chemical/x-pdb
yz1 application/x-yz1
z application/x-compress
zac application/x-zaurus-zac
zip application/zip
我們在開發web系統時有時會有以下需求:
要解決上述需求就可以使用Content-disposition來解決。第一個需求的解決辦法是
Response.AddHeader "content-disposition","attachment; filename=fname.ext"
public static void ToDownload(string serverfilpath,string filename)
{
FileStream fileStream = new FileStream(serverfilpath, FileMode.Open);
long fileSize = fileStream.Length;
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + UTF_FileName(filename) + "\";");
////attachment --- 作為附件下載
////inline --- 在線打開
HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
byte[] fileBuffer = new byte[fileSize];
fileStream.Read(fileBuffer, 0, (int)fileSize);
HttpContext.Current.Response.BinaryWrite(fileBuffer);
fileStream.Close();
HttpContext.Current.Response.End();
}
public static void ToOpen(string serverfilpath, string filename)
{
FileStream fileStream = new FileStream(serverfilpath, FileMode.Open);
long fileSize = fileStream.Length;
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=\"" + UTF_FileName(filename) + "\";");
HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
byte[] fileBuffer = new byte[fileSize];
fileStream.Read(fileBuffer, 0, (int)fileSize);
HttpContext.Current.Response.BinaryWrite(fileBuffer);
fileStream.Close();
HttpContext.Current.Response.End();
}
private static string UTF_FileName(string filename)
{
return HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8);
}
簡單的對上述代碼做一下解析,ToDownload方法為將一個服務器上的文件(serverfilpath為服務器上的物理地址),以某文件名(filename)在瀏覽器上彈出“文件下載”對話框,而ToOpen是將服務器上的某文件以某文件名在瀏覽器中顯示/打開的。注意其中我使用了UTF_FileName方法,該方法很簡單,主要為了解決包含非英文/數字名稱的問題,比如說文件名為“衣明志.doc”,使用該方法客戶端就不會出現亂碼了。
需要注意以下幾個問題:
可參看以下幾篇文檔:
HTTP協議是什么?
簡單來說,就是一個基于應用層的通信規范:雙方要進行通信,大家都要遵守一個規范,這個規范就是HTTP協議。
HTTP協議能做什么?
很多人首先一定會想到:瀏覽網頁。沒錯,瀏覽網頁是HTTP的主要應用,但是這并不代表HTTP就只能應用于網頁的瀏覽。HTTP是一種協議,只要通信的雙方都遵守這個協議,HTTP就能有用武之地。比如咱們常用的QQ,迅雷這些軟件,都會使用HTTP協議(還包括其他的協議)。
HTTP協議如何工作?
大家都知道一般的通信流程:首先客戶端發送一個請求(request)給服務器,服務器在接收到這個請求后將生成一個響應(response)返回給客戶端。
在這個通信的過程中HTTP協議在以下4個方面做了規定:
1. Request和Response的格式
Request格式:
HTTP請求行
(請求)頭
空行
可選的消息體
注:請求行和標題必須以<CR><LF> 作為結尾(也就是,回車然后換行)。空行內必須只有<CR><LF>而無其他空格。在HTTP/1.1 協議中,所有的請求頭,除Host外,都是可選的。
實例:
GET / HTTP/1.1
Host: gpcuster.cnblogs.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Mon, 25 May 2009 03:19:18 GMT
Response格式:
HTTP狀態行
(應答)頭
空行
可選的消息體
實例:
HTTP/1.1 200 OK
Cache-Control: private, max-age=30
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Expires: Mon, 25 May 2009 03:20:33 GMT
Last-Modified: Mon, 25 May 2009 03:20:03 GMT
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 25 May 2009 03:20:02 GMT
Content-Length: 12173
消息體的內容(略)
詳細的信息請參考:RFC 2616。
關于HTTP headers的簡要介紹,請查看:Quick reference to HTTP headers
2. 建立連接的方式
HTTP支持2中建立連接的方式:非持久連接和持久連接(HTTP1.1默認的連接方式為持久連接)。
1) 非持久連接
讓我們查看一下非持久連接情況下從服務器到客戶傳送一個Web頁面的步驟。假設該貝面由1個基本HTML文件和10個JPEG圖像構成,而且所有這些對象都存放在同一臺服務器主機中。再假設該基本HTML文件的URL為:gpcuster.cnblogs.com/index.html。
下面是具體步騾:
1.HTTP客戶初始化一個與服務器主機gpcuster.cnblogs.com中的HTTP服務器的TCP連接。HTTP服務器使用默認端口號80監聽來自HTTP客戶的連接建立請求。
2.HTTP客戶經由與TCP連接相關聯的本地套接字發出—個HTTP請求消息。這個消息中包含路徑名/somepath/index.html。
3.HTTP服務器經由與TCP連接相關聯的本地套接字接收這個請求消息,再從服務器主機的內存或硬盤中取出對象/somepath/index.html,經由同一個套接字發出包含該對象的響應消息。
4.HTTP服務器告知TCP關閉這個TCP連接(不過TCP要到客戶收到剛才這個響應消息之后才會真正終止這個連接)。
5.HTTP客戶經由同一個套接字接收這個響應消息。TCP連接隨后終止。該消息標明所封裝的對象是一個HTML文件。客戶從中取出這個文件,加以分析后發現其中有10個JPEG對象的引用。
6.給每一個引用到的JPEG對象重復步騾1-4。
上述步驟之所以稱為使用非持久連接,原因是每次服務器發出一個對象后,相應的TCP連接就被關閉,也就是說每個連接都沒有持續到可用于傳送其他對象。每個TCP連接只用于傳輸一個請求消息和一個響應消息。就上述例子而言,用戶每請求一次那個web頁面,就產生11個TCP連接。
2) 持久連接
非持久連接有些缺點。首先,客戶得為每個待請求的對象建立并維護一個新的連接。對于每個這樣的連接,TCP得在客戶端和服務器端分配TCP緩沖區,并維持TCP變量。對于有可能同時為來自數百個不同客戶的請求提供服務的web服務器來說,這會嚴重增加其負擔。其次,如前所述,每個對象都有2個RTT的響應延長——一個RTT用于建立TCP連接,另—個RTT用于請求和接收對象。最后,每個對象都遭受TCP緩啟動,因為每個TCP連接都起始于緩啟動階段。不過并行TCP連接的使用能夠部分減輕RTT延遲和緩啟動延遲的影響。
在持久連接情況下,服務器在發出響應后讓TCP連接繼續打開著。同一對客戶/服務器之間的后續請求和響應可以通過這個連接發送。整個Web頁面(上例中為包含一個基本HTMLL文件和10個圖像的頁面)自不用說可以通過單個持久TCP連接發送:甚至存放在同一個服務器中的多個web頁面也可以通過單個持久TCP連接發送。通常,HTTP服務器在某個連接閑置一段特定時間后關閉它,而這段時間通常是可以配置的。持久連接分為不帶流水線(without pipelining)和帶流水線(with pipelining)兩個版本。如果是不帶流水線的版本,那么客戶只在收到前一個請求的響應后才發出新的請求。這種情況下,web頁面所引用的每個對象(上例中的10個圖像)都經歷1個RTT的延遲,用于請求和接收該對象。與非持久連接2個RTT的延遲相比,不帶流水線的持久連接已有所改善,不過帶流水線的持久連接還能進一步降低響應延遲。不帶流水線版本的另一個缺點是,服務器送出一個對象后開始等待下一個請求,而這個新請求卻不能馬上到達。這段時間服務器資源便閑置了。
HTTP/1.1的默認模式使用帶流水線的持久連接。這種情況下,HTTP客戶每碰到一個引用就立即發出一個請求,因而HTTP客戶可以一個接一個緊挨著發出各個引用對象的請求。服務器收到這些請求后,也可以一個接一個緊挨著發出各個對象。如果所有的請求和響應都是緊挨著發送的,那么所有引用到的對象一共只經歷1個RTT的延遲(而不是像不帶流水線的版本那樣,每個引用到的對象都各有1個RTT的延遲)。另外,帶流水線的持久連接中服務器空等請求的時間比較少。與非持久連接相比,持久連接(不論是否帶流水線)除降低了1個RTT的響應延遲外,緩啟動延遲也比較小。其原因在于既然各個對象使用同一個TCP連接,服務器發出第一個對象后就不必再以一開始的緩慢速率發送后續對象。相反,服務器可以按照第一個對象發送完畢時的速率開始發送下一個對象。
3. 緩存的機制
HTTP/1.1中緩存的目的是為了在很多情況下減少發送請求,同時在許多情況下可以不需要發送完整響應。前者減少了網絡回路的數量;HTTP利用一個“過期(expiration)”機制來為此目的。后者減少了網絡應用的帶寬;HTTP用“驗證(validation)”機制來為此目的。
HTTP定義了3種緩存機制:
l Freshness allows a response to be used without re-checking it on the origin server, and can be controlled by both the server and the client. For example, the Expires response header gives a date when the document becomes stale, and the Cache-Control: max-age directive tells the cache how many seconds the response is fresh for.
l Validation can be used to check whether a cached response is still good after it becomes stale. For example, if the response has a Last-Modified header, a cache can make a conditional request using the If-Modified-Since header to see if it has changed.
l Invalidation is usually a side effect of another request that passes through the cache. For example, if URL associated with a cached response subsequently gets a POST, PUT or DELETE request, the cached response will be invalidated.
關于web緩存方面的內容可以參考:Caching Tutorial for Web Authors and Webmasters(英文版)(中文版)
4. 響應授權激發機制
這些機制能被用于服務器激發客戶端請求并且使客戶端授權。
詳細的信息請參考:RFC 2617: HTTP Authentication: Basic and Digest Access
5. 基于HTTP的應用
1 HTTP代理
3 HTTPS傳輸協議原理
對稱加密:密鑰只有一個,加密解密為同一個密碼,且加解密速度快,典型的對稱加密算法有DES、AES等
非對稱加密:密鑰成對出現(且根據公鑰無法推知私鑰,根據私鑰也無法推知公鑰),加密解密使用不同密鑰(公鑰加密需要私鑰解密,私鑰加密需要公鑰解密),相對對稱加密速度較慢,典型的非對稱加密算法有RSA、DSA等
4 開發web程序時常用的Request Methods
(Head方法)要求響應與相應的GET請求的響應一樣,但是沒有的響應體(response body)。這用來獲得響應頭(response header)中的元數據信息(meta-infomation)有(很)幫助,(因為)它不需要傳輸所有的內容。
(Trace方法告訴服務器端)返回收到的請求。客戶端可以(通過此方法)察看在請求過程中中間服務器添加或者改變哪些內容。
6 基于Socket編程編寫遵循HTTP的程序
后記:
我這篇文章只是對HTTP協議做了一個大概介紹,很多細節都有遺漏,請有興趣的朋友閱讀RFC 2616。
學習HTTP協議的好書:
1.O'Reilly - HTTP Pocket Reference:這是一本比較簡短的介紹HTTP協議的書,可以作為入門讀物
2.O'Reilly - HTTP The Definitive Guide:這是一本寶典級別的書,因為它包含的內容實在多,可以作為全面學習的HTTP協議的首選讀物
3.Sams - HTTP Developers Handbook:這是比HTTP The Definitive Guide稍微比HTTP The Definitive Guide簡單。不過從我的感覺,這本書比HTTP The Definitive Guide要好,因為它篇幅比較少,介紹的是HTTP精髓,我認為這本書應該是web程序員的首選讀物