狀態(tài)碼
1xx: 請(qǐng)求已接收,繼續(xù)處理
2xx: 成功
3xx: 重定向
4xx: 客戶端錯(cuò)誤(請(qǐng)求有語法錯(cuò)誤逾礁,或請(qǐng)求無法完成)
5xx: 服務(wù)端錯(cuò)誤
常見的狀態(tài)碼:
200 OK: 請(qǐng)求成功
304 Not modified:服務(wù)器上的數(shù)據(jù)與瀏覽器緩存相比沒有修改说铃,直接從緩存中讀取了
400 Bad Request:請(qǐng)求有語法錯(cuò)誤,不能被服務(wù)端理解
401 Unauthorized:用戶未被授權(quán)嘹履,必須與 WWW-Authenticate報(bào)頭域一起使用
403 Forbidden:服務(wù)端拒絕提供服務(wù)
404 Not found:資源不存在
500 Internal server error:服務(wù)器發(fā)生了不可預(yù)期的錯(cuò)誤
503 Server unavailable:服務(wù)器目前不能提供服務(wù)腻扇,一段時(shí)間后恢復(fù)正常
更多狀態(tài)碼: http://www.runoob.com/http/http-status-codes.html
同源策略
不同的端口、不同的協(xié)議砾嫉、不同的域名(要精確匹配)都是不同源的幼苛,明確端口和隱式80端口的同源與否依賴瀏覽器而定。
為了舉例焕刮,下面的表格給出了與URL"http://www.example.com/dir/page.html"的對(duì)比舶沿。
對(duì)比URL|結(jié)果|結(jié)果
---|----------------|-------------------|---------------------|----------------
http://www.example.com/dir/page2.html |同源|相同的協(xié)議墙杯,主機(jī),端口
http://www.example.com/dir2/other.html |同源|相同的協(xié)議括荡,主機(jī)高镐,端口
http://username:password@www.example.com/dir2/other.html| 同源 |相同的協(xié)議,主機(jī)一汽,端口
http://www.example.com:81/dir/other.html |不同源 |相同的協(xié)議避消,主機(jī)低滩,端口不同
https://www.example.com/dir/other.html |不同源 |協(xié)議不同
http://en.example.com/dir/other.html |不同源| 不同主機(jī)
http://example.com/dir/other.html |不同源 |不同主機(jī)(需要精確匹配)
http://v2.www.example.com/dir/other.html |不同源 |不同主機(jī)(需要精確匹配)
http://www.example.com:80/dir/other.html |看情況 |端口明確召夹,依賴瀏覽器實(shí)現(xiàn)