亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁(yè) > 學(xué)院 > 基礎(chǔ)常識(shí) > 正文

http協(xié)議之cookie標(biāo)準(zhǔn)RFC6265介紹

2020-07-05 18:03:33
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

 

cookie是現(xiàn)代web系統(tǒng)開(kāi)發(fā)中非常重要的一個(gè)技術(shù),最近對(duì)cookie標(biāo)準(zhǔn)RFC6265進(jìn)行了了解,從中選取了部分內(nèi)容。

1.cookie的主要作用

因?yàn)镠TTP協(xié)議是無(wú)狀態(tài)的,對(duì)于一個(gè)瀏覽器發(fā)出的多次請(qǐng)求,WEB服務(wù)器無(wú)法區(qū)分是不是來(lái)源于同一個(gè)瀏覽器。所以,需要額外的數(shù)據(jù)用于維護(hù)會(huì)話(huà)。 Cookie 正是這樣的一段隨HTTP請(qǐng)求一起被傳遞的額外數(shù)據(jù)。

2.cookie的主要作用

除了name、value這兩個(gè)必備屬性外,還有下面幾個(gè)可選屬性(這些屬性名都是大小寫(xiě)不敏感的,并且只要設(shè)置了瀏覽器是必須處理的),分別控制cookie的生存周期、可見(jiàn)性、安全性。

2.1) expires:絕對(duì)過(guò)期時(shí)間

如果這個(gè)屬性的值不能被轉(zhuǎn)換為日期,客戶(hù)端會(huì)忽略該屬性。當(dāng)同一個(gè)cookie兩次請(qǐng)求的expires值不相同時(shí),新的 可能 會(huì)替換舊的。
If the attribute-value failed to parse as a cookie date, ignore the cookie-av.
If the expiry-time is later than the last date the user agent can represent, the user agent MAY replace the expiry-time with the last representable date.
If the expiry-time is earlier than the earliest date the user agent can represent, the user agent MAY replace the expiry-time with the earliest representable date

2.2)Max-Age:相對(duì)過(guò)期時(shí)間,以秒為單位。如果該屬性的值不是數(shù)字,客戶(hù)端將不做處理。

If the first character of the attribute-value is not a DIGIT or a '-' character, ignore the cookie-av.
If the remainder of attribute-value contains a non-DIGIT character, ignore the cookie-av.
If delta-seconds is less than or equal to zero (0), let expiry-time be the earliest representable date and time. Otherwise, let the expiry-time be the current date and time plus delta-seconds seconds.

Max-age和expires這兩個(gè)屬性控制cookie生命周期。 如果兩個(gè)都設(shè)置了,以Max-Age為準(zhǔn)。 默認(rèn)情況下,cookie是暫時(shí)存在的,他們存儲(chǔ)的值只在瀏覽器會(huì)話(huà)期間存在。當(dāng)瀏覽器推出后,這些值也就丟失了.
If a cookie has neither the Max-Age nor the Expires attribute, the user agent will retain the cookie until 'the current session is over' (as defined by the user agent)。

2.3)path:指定了與cookie關(guān)聯(lián)在一起的網(wǎng)頁(yè),默認(rèn)情況下,cookie會(huì)和創(chuàng)建它的網(wǎng)頁(yè)以及與這個(gè)網(wǎng)頁(yè)處于同一個(gè)目錄下的網(wǎng)頁(yè)和處于該目錄的子目錄下的網(wǎng)頁(yè)關(guān)聯(lián),同時(shí)不能用這個(gè)屬性來(lái)確定安全性

The scope of each cookie is limited to a set of paths, controlled by the Path attribute. If the server omits the Path attribute, the user agent will use the 'directory' of the request-uri’s path component as the default value.
The user agent will include the cookie in an HTTP request only if the path portion of the request-uri matches (or is a subdirectory of) the cookie’s Path attribute, where the %x2F ('/') character is interpreted as a directory separator.
Although seemingly useful for isolating cookies between different paths within a given host,the Path attribute cannot be relied upon for security

2.4)domain:如果沒(méi)有設(shè)置cookie的domain值,該屬性的默認(rèn)值就是創(chuàng)建cookie的網(wǎng)頁(yè)所在的服務(wù)器的主機(jī)名

If the server omits the Domain attribute, the user agent will return the cookie only to the origin server。但不能將一個(gè)cookie的域設(shè)置成服務(wù)器所在的域之外的域 
The user agent will reject cookies unless the Domain attribute specifies a scope for the cookie that would include the origin server. For example, the user agent will accept a cookie with a Domain attribute of 'example.com' or of 'foo.example.com' from foo.example.com, but the user agent will not accept a cookie with a Domain attribute of 'bar.example.com' or of 'baz.foo.example.com'. NOTE: For security reasons, many user agents are configured to reject Domain attributes that correspond to 'public suffixes'. For example, some user agents will reject Domain attributes of 'com' or 'co.uk'.
When a user agent receives a Set-Cookie header field in an HTTP response, the user agent MAY ignore the Set-Cookie header field in its entirety. For example, the user agent might wish to block responses to 'third-party' requests from setting cookies。

2.5)secure:它指定了在網(wǎng)絡(luò)上如何傳輸cookie值。默認(rèn)情況下,cookie是不安全的,也就是說(shuō),他們是通過(guò)一個(gè)普通的、不安全的http鏈接傳輸?shù)?。但是如果將cookie標(biāo)記為安全的,那么它將只在瀏覽器和服務(wù)器通過(guò)https或其他安全協(xié)議鏈接是才被傳輸。這個(gè)屬性只能保證cookie是保密的。

The Secure attribute limits the scope of the cookie to 'secure' channels (where 'secure' is defined by the user agent). When a cookie has the Secure attribute, the user agent will include the cookie in an HTTP request only if the request is transmitted over a secure channel (typically HTTP over Transport Layer Security (TLS)

2.6)HttpOnly:設(shè)為true后,只能通過(guò)http訪(fǎng)問(wèn),不能通過(guò)documents.cookie獲取設(shè)定為httponly的鍵值,防止xss讀取cookie。

httpOnly屬性和secure是獨(dú)立的,一個(gè)cookie可以同時(shí)設(shè)置這兩個(gè)屬性。
The HttpOnly attribute limits the scope of the cookie to HTTP requests. In particular, the attribute instructs the user agent to omit the cookie when providing access to cookies via 'non-HTTP' APIs (such as a web browser API that exposes cookies to scripts). Note that the HttpOnly attribute is independent of the Secure attribute: a cookie can have both the HttpOnly and the Secure attribute.

2.7)cookie屬性其他相關(guān)內(nèi)容

User agents ignore unrecognized cookie attributes (but not the entire cookie).
To maximize compatibility with user agents, servers that wish to store arbitrary data in a cookie-value SHOULD encode that data, for example, using Base64 [RFC4648].
To maximize compatibility with user agents, servers SHOULD NOT produce two attributes with the same name in the same set-cookie-string.
If the user agent receives a new cookie with the same cookie-name, domain-value, and path-value as a cookie that it has already stored, the existing cookie is evicted and replaced with the new cookie. Notice that servers can delete cookies by sending the user agent a new cookie with an Expires attribute with a value in the past.

3.cookie值在何處設(shè)置

通常cookie值是在服務(wù)端設(shè)置,但也可以通過(guò)js在客戶(hù)端設(shè)置,另外
3.1)編碼方式(Java中的httpclient包)的http請(qǐng)求可以直接在請(qǐng)求頭上加入cookie;
3.2)iOS的UIWebview可以在loadRequest構(gòu)造帶cookie的reqeust;
3.3)Android的Webview可以通過(guò)CookieManager來(lái)設(shè)置cookie;

4.cookie如何傳輸及規(guī)則

4.1服務(wù)端—》客戶(hù)端

通過(guò)http的response頭,會(huì)將服務(wù)端設(shè)置的所有的cookie都發(fā)送到客戶(hù)端,發(fā)送的內(nèi)容是cookie的name、value及已設(shè)置的全部屬性

4.2cookie屬性其他相關(guān)內(nèi)容

通過(guò)http的request頭,瀏覽器也不是發(fā)送它所接收到的所有Cookie,它會(huì)檢查當(dāng)前要請(qǐng)求的域名以及目錄, 只要這二項(xiàng)目與Cookie對(duì)應(yīng)的Domain和Path匹配,才會(huì)發(fā)送。對(duì)于Domain則是按照尾部匹配的原則進(jìn)行的。發(fā)送的內(nèi)容只有name和value,其他的屬性是不發(fā)送的。
Each cookie-pair represents a cookie stored by the user agent. The cookie-pair contains the cookie-name and cookie-value the user agent received in the Set-Cookie header.
Notice that the cookie attributes are not returned.
因而當(dāng)客戶(hù)端發(fā)送兩個(gè)同名的cookie時(shí),服務(wù)端是無(wú)法區(qū)分這兩個(gè)cookie的歸屬。
Although cookies are serialized linearly in the Cookie header, servers SHOULD NOT rely upon the serialization order. In particular, if the Cookie header contains two cookies with the same name (e.g., that were set with different Path or Domain attributes), servers SHOULD NOT rely upon the order in which these cookies appear in the header.

5.cookie是否可以被截獲

有兩種方法可以截獲他人的cookie,
5.1). 通過(guò)XSS腳步攻擊, 獲取他人的cookie
5.2.) 想辦法獲取別人電腦上保存的cookie文件(這個(gè)比較難)

6.cookie是否可以被非法修改

可以通過(guò)一些插件(如edit this cookie)或者其他技術(shù)手段進(jìn)行修改。Secure屬性也有其局限性。
Although seemingly useful for protecting cookies from active network attackers, the Secure attribute protects only the cookie’s confidentiality. An active network attacker can overwrite Secure cookies from an insecure channel, disrupting their integrity

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
亚洲最新在线视频| 136福利精品导航| 五月婷婷激情在线| 欧美一区二视频| av激情综合网| 成人手机在线电影| 在线免费观看a级片| 884aa四虎免费影库4h| av免费看网址| 黑人精品无码一区二区三区AV| 国产精品久久久久久久久鸭| 日本一区二区三区高清不卡| 97在线视频精品| 国产一级特黄a大片免费| 国产精品香蕉一区二区三区| 成人黄色图片网站| 欧美激情欧美狂野欧美精品| 在线免费观看黄色片| 91久久精品www人人做人人爽| 成人短视频在线观看免费| 日韩美女一区二区三区| www.亚洲人| 国产一区二区三区的电影| 五月婷婷在线播放| 精品对白一区国产伦| 成人做爰69片免网站| 国产精品成人久久久久| 国产精品午夜一区二区| 亚洲av无一区二区三区| 国产精品视频久久久久久久| 亚洲精品高清在线观看| 亚洲国产综合一区| 色www亚洲国产阿娇yao| 久久久成人av毛片免费观看| 国产手机视频在线| 国产剧情麻豆剧果冻传媒视频免费| 日本一区二区三区免费乱视频| 亚洲第一区在线| 欧美日韩不卡合集视频| 日本a级片在线播放| 日韩熟女一区二区| 成人自拍爱视频| 亚洲free性xxxx护士hd| 97超碰人人爱| 天堂а√在线8种子蜜桃视频| 天堂tv亚洲tv日本tv欧美人tv| 人妻精品无码一区二区三区| 影音先锋成人资源网站| 久久草.com| 国产成人精品综合久久久久99| 亚洲综合图区| 美女视频黄的免费| 伊色综合久久之综合久久| 天堂av中文在线资源库| 3d动漫一区二区三区在线观看| 97精品在线观看| 亚洲欧洲一区二区福利| 人妻少妇精品视频一区二区三区| 女人18毛片毛片毛片毛片区二| 日韩在线一级片| 欧洲精品乱码久久久久蜜桃| 天堂网免费视频| 欧美一区二区视频免费观看| 国产精品探花在线观看| 午夜在线a亚洲v天堂网2018| 国产三级在线看| cao在线视频| 国产视频xxx| 国产第100页| 理论片鲁丝二区爱情网| 成人国产精品免费网站| 国产在线黄色片| 美女色狠狠久久| 色久欧美在线视频观看| av成人福利| 野外性满足hd| 成人在线观看免费| 欧美视频自拍偷拍| 亚洲精品高清无码视频| 僵尸再翻生在线观看免费国语| 男人天堂影院| 久久人人九九| 国产你懂的在线观看| 白白在线精品| 色综合亚洲图丝熟| 日韩欧美国产综合在线| 国产精品美腿一区在线看| 国产成人av免费看| 国产白浆在线观看| 外国成人在线视频| 亚洲日本一区二区三区在线不卡| 亚洲欧美一区二区久久| 高潮白浆女日韩av免费看| 久久久久99精品成人片| 91精品视频免费看| 国产精品国产国产aⅴ| 精品999成人| 在线视频观看亚洲| 亚洲欧洲久久| 在线免费观看污| 九九免费精品视频| 牛牛视频精品一区二区不卡| 亚洲无线码在线一区观看| 国产美女视频一区二区二三区| 在线精品亚洲欧美日韩国产| 亚洲第一二三四五区| 污片在线免费看| 黄视频在线观看网站| 国产高清视频在线播放| 久久久久亚洲av成人毛片韩| 国产婷婷在线视频| 中国女人久久久| 国产经典一区二区三区| 91亚洲va在线va天堂va国| 99re免费视频精品全部| 蜜臀av.com| 中文字幕一区二区三区四区| 一区二区三区在线免费观看| 天天天干夜夜夜操| 快色在线观看| 欧美精品一区在线播放| 国产欧美一区二区三区精品观看| 国产91网红主播在线观看| 亚洲天堂国产精品| 日韩 中文字幕| 日韩女优在线观看| 91久久夜色精品国产网站| 久久精品免费在线观看| 91手机视频在线| 亚洲综合免费观看高清完整版在线| 国产在线乱码一区二区三区| 亚洲一区日韩精品| 日韩在线不卡视频| 亚洲图片自拍偷拍| 欧美性猛交xxxx乱大交极品| 2024亚洲男人天堂| 91视频免费入口| 日韩理论片av| 国产在线观看成人| 男操女在线观看| 在线观看免费视频污| 欧美激情精品久久久久久久变态| 国产偷人爽久久久久久老妇app| 日韩综合另类| 国产精品久久久久av| 国产999精品| 99视频在线精品国自产拍免费观看| 超碰在线超碰在线| 欧美激情网友自拍| 国产精品国产三级国产传播| 日韩一区二区电影在线| 欧美午夜精品一区二区三区电影| 男人的天堂va免费视频| 一区二区三区国产在线观看| 狠狠色综合欧美激情| 国产视频福利在线| 亚洲 欧美 国产 另类| 2021国产精品久久精品| 久久人人99| 日韩va亚洲va欧美va清高| 国产在线播放91| 久久亚洲国产成人亚| 欧美国产乱子伦| 久久久久xxxx| 国产91精品视频在线观看| 天天操中文字幕| 亚洲最大激情中文字幕| 91免费看视频| 黄色网页网址在线免费| 国产一区二区三区亚洲综合| 99免费在线观看视频| 欧美久久综合网| 欧美三级午夜理伦三级中文幕| 六月丁香婷婷色狠狠久久| 中文有码在线播放| 男女啪啪a级毛片| 国产精品视频一区视频二区| 欧美激情在线观看视频免费| 97视频在线观看免费高清完整版在线观看| 国产免费嫩草影院| 色狮一区二区三区四区视频| 91丨九色丨海角社区| 国产精品乱码妇女bbbb| 日韩极品一区| 一本久道中文无码字幕av| 国产精品久久久久一区二区国产| 日韩高清国产一区在线观看| 毛片网站在线看| eeuss影院www免费视频| www.夜夜爱| 欧美精品国产精品日韩精品| 嫩草嫩草嫩草嫩草| gogogogo高清视频在线| 久久黄色级2电影| 日韩电影在线观看永久视频免费网站| 欧美一区欧美二区| 国产精品免费久久久久影院| 澳门黄色一级片| 色哟哟在线观看| 国产精品电影院| 一个人看的www片免费高清视频| 日韩欧美在线一区二区| 日本免费一区二区视频| 久久久视频在线| 男人天堂欧美日韩| 精品一区二区在线播放| 欧美a级在线| avtt天堂在线| 国产成人精品一区二区三区免费| 国产精品色一区二区三区| 水莓100国产免费av在线播放| 国产欧美精品在线播放| 亚洲综合色一区| 4444欧美成人kkkk| 午夜精品国产精品大乳美女| 亚洲第一成人在线| 伊人影院在线观看视频| 在线视频三级| 国产欧美精品一区二区三区介绍| 欧美知名女优| 日韩成人久久久| 亚洲综合色成人| 亚洲高清不卡| 欧美欧美黄在线二区| 日韩欧美亚洲天堂| 中文无码av一区二区三区| 1000精品久久久久久久久| 久久婷婷开心| 国产三级做爰高清在线| 日本综合视频| 国产成人精品视频在线观看| 96sao精品视频在线观看| 日韩一区二区视频| 91亚洲成人| 日本免费在线精品| 青青草免费在线| 亚洲欧洲在线视频| 粉嫩av一区二区三区粉嫩| 国产视频一二三四区| 无码av免费一区二区三区试看| 欧美日本三区| 一个色免费成人影院| 亚洲激情图片一区| 在线观看91久久久久久| 一区二区三区视频在线观看视频| 亚洲激情电影中文字幕| 欧美黑人疯狂性受xxxxx野外| 精品成人av| 日韩久久久久久久久久久久久| 无码人妻精品一区二区三应用大全| 国产日韩专区在线| 天天撸夜夜操| 国产真人做爰视频免费| 亚洲一区二区三区视频在线| 国产成人羞羞电影网站在线观看| 国产老妇另类xxxxx| 免费毛片小视频| 成人短视频软件网站大全app| 五月天婷亚洲天综合网鲁鲁鲁| 9i看片成人免费看片| 69p69国产精品| 久久久久国产精品嫩草影院| 成人美女av在线直播| 国产一区第一页| 中文字幕伦av一区二区邻居| 伊人久久精品视频| 亚洲精品美女久久7777777| 亚洲日本一区二区三区| 91在线精品一区二区三区| 中文av一区特黄| 日本国产在线| 一区二区欧美国产| 99久久精品国产精品久久| 欧美精品少妇videofree| 中文字幕一区二区三区在线视频| 国产成a人无v码亚洲福利| 77777少妇光屁股久久一区| 久久99国产综合精品女同| 亚洲欧美制服第一页| 亚洲av无日韩毛片久久| 日韩a级作爱片一二三区免费观看| 一区二区三区视频网| 99热只有这里有精品| www.17c.com喷水少妇| 国产麻豆成人传媒免费观看| 懂色av一区二区在线播放| 精品一区二区三区中文字幕老牛| 亚洲jizzjizz日本少妇| 久草视频手机在线观看| 超碰超碰人人人人精品| 日本大胆欧美人术艺术动态| 国精品人妻无码一区二区三区喝尿| 懂色av一区二区三区在线播放| 青青草视频成人| www.黄色在线观看| 亚洲一区二区在线免费观看| 91色.com| 日韩美女写真福利在线观看| 深夜福利影院在线观看| va中文字幕| 2025韩国大尺度电影| 欧美性极品videosbest| 日韩欧美美女在线观看| 国产aⅴ精品一区二区三区久久| 国产午夜精品一区二区三区嫩草| 欧美日韩中文精品| 亚洲色图欧洲色图婷婷| 99亚洲精品| 3d动漫精品啪啪一区二区竹菊| 性欧美在线视频| 日韩av免费看| 久久久久久久久久久网站| caopon在线免费视频| 国产成人在线观看免费网站| 天天操天天射天天插| 波多野结衣中文字幕在线| 亚洲二区三区四区| 免费毛片一区二区三区| 先锋影音一区二区| 欧美男男tv网站在线播放| 欧美在线不卡视频| 性感美女久久精品| 九七伦理97伦理| 国产精品porn| 色av男人的天堂免费在线| 亚洲我射av| 91麻豆精品91久久久久久清纯| 一区视频二区视频|