cookie原理入门概念介绍

使用 Restart Extension 继续解决 Ansys 机械分析 您正在执行复杂或大型的多步有限元分析,突然,您意识到经过数小时的求解后,您需要添加或修改边界条件。在本篇博文中,您将了解如何利用 Ansys Mechanical 中的 RestartAnalysis 扩展来扩展多步分析,方法是合并额外的时间步骤和边界条件,而不会丢失已计算的结果。幸运的是,在 Mechanical 中,有一种直接的方法可以实现这一点,而不会损害您之前的结果,而这在添加新边界条件和使用重新启动点时经常发生。得到的结果符合预期,您可以看到施加的力产生的这两个部分之间的相对位移。 阅读详情

转:http://eyesmore.javaeye.com/blog/332817

关键字: cookie

3. COOKIE FUNDAMENTALS

3.1 Introduction

Whether you're a programmer or just a web user looking for answers, a big part of understanding cookies is to go into the gory details. This section does just that.

3.2 How does a cookie really work?

Understanding how cookies really work requires an understanding of how HTTP works.

Cookies transport from Server to Client and back as an HTTP header.

(Cookies是从服务端传递给客户端的一些文本数据,在以后访问同一个站点时,浏览器会再把这些数据通过http请求包头发送给服务器。)

The specifications for this header are explicitly laid out in RFC 2109 .

When a cookie is sent from the server to the browser, an additional line is added to the HTTP headers (example):

Content-type: text/html
Set-Cookie: foo=bar; path=/; expires Mon, 09-Dec-2002 13:46:00 GMT

 

This header entry would result in a cookie named foo . The value of foo is bar . In addition, this cookie has a path of / , meaning that it is valid for the entire site , and it has an expiration date of Dec 9, 2002 at 1:46pm Greenwich Mean Time (or Universal Time) . Provided the browser can understand this header, the cookie will be set. (当浏览器接收到Set-Cookie的“命令”后,按照预定好的协议,浏览器会将这些保存起来,或文件或内存,这可能取决于cookie的有效期。)

When a cookie is sent from the browser to the server, the cookie header is changed slightly:


Content-type: text/html
Cookie: foo=bar

Here, the server is made aware of a cookie called foo , whose value is bar .

 

 

 

3.3 Breakdown of Cookie Parameters  (Cookie参数明细,主要讲解下Cookie的各个属性)

As we have just seen, a cookie contains more than simply a name and a value. In fact, a cookie has 6 parameters that can be passed to it:(一个CookieItem具有6方面的描述信息。)

    • The name of the cookie,(必选)
    • The value of the cookie,(必选)
    • The expiration date of the cookie,(可选,默认值-1,表示浏览器关闭则清除。)
    • The path the cookie is valid for,(一般用于浏览器管理cookie用 ,用于限定cookie的作用域)
    • The domain the cookie is valid for,(一般用于浏览器管理cookie用,这样,浏览器才知道访问某个url所属的域名时,会在本地cookie文件中找有没有有效的cookie信息要传递给服务端去。)

(注意:domain+path仅仅就是用来限制和匹配cookie的作用域的。因为用户通过浏览器会去访问许多的站点,也有很多站点都用了cookie技术,那么浏览器必须应该记住哪个cookie对应哪个站点呀,另外,即使在同一个站点内,还可以通过path来决定同一个站点的cookie,是否能作用于当前访问的path。比如,当前浏览器中保存了域为.google.com的一个cookie,那么当我们访问google时,浏览器先会看看cookie库中有没有该站点的cookie信息呀,如果有应该传给服务,当然还要通过path做进一步判定,文件中保存的cookie能不能使用于当前访问的path呢。path匹配一般是最大匹配原则,比如我们访问http://code.google.com时,域匹配到.google.com)

    • The need for a secure connection to exist to use the cookie.

Two of these are mandatory (its name and its value). The other four can be set manually or automatically. Each parameter is separated by a semicolon when set explicitly. Here is a detailed description of each.

Name, Value

The name of a cookie and its value are set simply by pairing them together:


... foo=bar ...

The value of a cookie can also be null, for the purpose of clearing the cookie value:

 

(之所以允许为null,是为了为服务器清空客户端的cookie留了后路,服务器可以重置cookie的值的。)

... foo= ...

 

Expires

The expires parameter lets you determine the lifetime of the cookie.


... expires=Mon, 01-Jan-2001 00:00:00 GMT ...

 

If Expires is not set explicitly, then it defaults to end-of-session. (注意:Servlet API提供的是setMaxAge(int seconds),其中当输入参数seconds为-1时,表示end-of-session,即当浏览器关闭时,浏览器把cookie信息从文件中删除。) The length of a session can vary depending on browsers and servers, but generally a session is the length of time that the browser is open for (even if the user is no longer at that site). (注意:其实server将cookie信息发送给浏览器,浏览器如果不遵守协议,不保存这些cookie信息,server是拿它没办法的。或者说用户把浏览器设置成“不接收第三方cookie”。这样,服务端一般只会用cookie来做些提高用户体验的东西,个性化什么的,也就是说如果用户不在意隐私的话,那么cookie只会给用户带来好处。这里值得一提的是tomcat的HttpSession的JSESSION_ID也是依靠cookie来保存的,严格来讲session机制也有一部分信息保存在客户端,当然服务端保存得更多。)

Path

The path parameter is potentially the most useful of the 4 optional cookie settings. (Path尽管是可选项,但是它是四个可选项中用的较多的一个。 原因很简单,cookie的发起是服务端的,服务端开发人员愿意使用Path,因为如果把Cookie看成是应用程序的变量,那么path就相当于是命名空间,用path可以限制cookie.name的作用访问。如果某个cookie的path="/",那么相当于定义了一个全局变量,因为浏览器会在访问该站点的任何资源时,带上这个cookie;如果path="/hello/",那么浏览器只会在访问"/hello/"目录及其子目录时,才会带上这个cookie;在访问/advaced/topics/cookie.do资源时,是不会带上这个cookie的。) It sets the URL path the cookie is valid within.

Pages outside of that path cannot read (read这个词用得有点幽默,因为cookies信息是依靠客户端传给服务端的;read好像是server端具备从客户端直接读取信息的权限。但是,如果客户端是个守规矩的家伙时,服务端的开发人员当然喜欢用read,很有主动感。)or use the cookie.

... path=/promo ...

 

If Path is not set explicitly, then it defaults to the URL path of the document creating the cookie.

(如果path不显式设置,那么path被设置成该资源所在的url path.)

Netscape has identified a bug for VERY old versions of Navigator where the path must be specified if an expiration is specified. Furthermore, this path must be set to "/". For more information, browse Netscape's Cookie Spec at:
http://www.netscape.com/newsref/std/cookie_spec.html

Domain

The domain parameter takes the flexibility of the path parameter one step further. If a site uses multiple servers within a domain the it is important to make the cookie accessible to pages on any of these servers.

... domain=www.myserver.com ...

 

Cookies can be assigned to individual machines, or to an entire Internet domain. The only restrictions on this value is that it must contain at least two dots (.myserver.com, not myserver.com) for the normal top-level domains, or three dots for the "extended" domains (.myserver.ny.us, not myserver.ny.us)

IMPORTANT: The server issuing the cookie must be a member of the domain that it tries to set in the cookie. (发布某个cookie的服务器必须也在这个domain里面,也就是说baidu的机器不可能想浏览器发送个google的cookie,尽管报文上是可以这样发,但是浏览器端会校验的。对于这种非法的cookie,浏览器端是不会接受并保存它的。) That is, a server called www.myserver.com cannot set a cookie for the domain www.yourserver.com. The security implications should be obvious.

If Domain is not set explicitly, then it defaults to the full domain of the document creating the cookie.

Secure

The secure parameter is a flag indicating that a cookie should only be used under a secure server condition, such as SSL. Since most sites do not require secure connections, this defaults to FALSE.

 

 

3.4 How do cookies end up on my hard drive?

After a cookie is transmitted through an HTTP header, it is stored in the memory of your browser . This way the information is quickly and readily available without re-transmission. As we have seen, however, it is possible for the lifetime of a cookie to greatly exceed the amount of time the browser will be open.

In such cases, the browser must have a way of saving the cookie when you are not browsing, or when your computer is shut off. The only way the browser can do this is to move the cookies from memory into the hard drive. This way, when you start your browser a few days later, you still have the cookies you had previously.

The browser is constantly performing maintenance on its cookies. (浏览器是要管理这些cookie的) Every time you open your browser, your cookies are read in from disk, and every time you close your browser, your cookies are re-saved to disk.(一般浏览器启动时,回去加载磁盘上的cookie信息。) As a cookie expires, it is discarded from memory and it is no longer saved to the hard drive.

3.5 What are all those entries in my cookies.txt file?

The layout of Netscape's cookies.txt file is such that each line contains one name-value pair . An example cookies.txt file may have an entry that looks like this:

.netscape.com 
    TRUE   / 
 FALSE  946684799   
NETSCAPE_ID  100103

Each line represents a single piece of stored information. A tab is inserted between each of the fields.

From left-to-right, here is what each field represents:

domain - The domain that created AND that can read the variable.
flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the browser, depending on the value you set for domain .
path - The path within the domain that the variable is valid for.
secure - A TRUE/FALSE value indicating if a secure connection with the domain is needed to access the variable.
expiration - The UNIX time that the variable will expire on. UNIX time is defined as the number of seconds since Jan 1, 1970 00:00:00 GMT. (就是java中的long,把这个long转化成时间即可。)
name - The name of the variable.
value - The value of the variable.

3.6 Where does MSIE keep its cookies?

Microsoft keeps its cookies in different locations, depending on the version of explorer and Windows you are using. The best way to find it is to use the Windows "Search" feature an look for the "Cookies" folder. More information can be found here .

Although the location may be different, the format is the same. Each individual domain's cookies are stored in their own file(每个domain是个单独的文件) , along with the username that accessed the site. For example, if I went to Yahoo.com, I would get a cookie that is stored in the file dwhalen@yahoo.txt .

Note that the username is not sent with the cookie(是用来表示使用本机器的用户的) . See Section 2.10 for more information.

3.7 Are cookies Year 2000 Compliant?

There is no date-specific restriction on the HTTP header used to transmit cookies. In fact, the only determining factor in whether a cookie will be accepted is the programming of the client receiving the cookie.

The major browsers do not have an issue with this. Cookies with expiration dates set with 2-digit or 4-digit years are understood properly. Naturally, it's always advisable to use 4-digit years when setting cookies.

 

原文 :  http://www.cookiecentral.com/faq/#3

Python 爬虫实战:爬取今日头条文章与阅读量数据 本文详细介绍了基于Python爬取今日头条文章与阅读量数据的完整方案。通过分析今日头条API接口,采用Requests+正则表达式技术实现数据抓取,重点解决加密参数构造、请求头模拟、反爬规避等核心问题。文章包含文章列表获取、详情数据提取、互动数据采集等完整流程,并提供数据存储与基础分析方法。同时强调合规使用爬虫技术,控制爬取频率,避免干扰平台运营。该方案可为内容传播分析、用户兴趣研究提供数据支持,但需注意接口参数更新和反爬机制变化,适时调整代码实现。 阅读详情

相关推荐

Star CCM+中的物性参数(定值、多项式、查表)

仿真过程中我们一定会遇到设置物性参数的问题,对于固定的物性参数还好说,直接输入一个固定的值即可。但是对于冷却液、气体、两相流等,物性参数是随着温度或温度和压力变化的。此时就涉及到多项式和查表。首先创建物理连续体,选择计算模型。

2201_75375391的博客 2957

浅谈cookie跨域的解决方案——document.domain

cookie的名/值对中的值不允许出现分号、逗号和空白符,因此在设置cookie前要用encodeURIComponent()编码,读取时再用decodeURIComponent()解码。 cookie默认的有效期是浏览器会话期间,作用域是整个浏览器而不仅仅局限于窗口或标签页。若要延长cookie的有效期,可以设置max-age属性。 cookie的domain和path属性: 1.

筱葭的博客 4万+

Sublime Text4代码配色自定义方案

关于Sublime Text对于我的使用体验,只能说内置的代码主题真的都太low了,一点都不好看。所以接下来我分享一下我自定义代码配色。当然,大家也可以通过我给的中文翻译注释来自定义自己喜欢的颜色。废话不多说,直接上代码直接将代码复制粘贴到:Preferences > Customize Color Scheme 即可。},"globals":"foreground": "var(white)", // 前景色。

追求细节,成就完美 6026

cookie详解

cookie是一种最原始也最简单的客户端存储方式,几乎所有的网站的都有使用cookie,各有各的用途,看到这篇文章的不少人也是都是使用过cookie的人同学吧,但是我们反问下自己,我们真的懂cookie了吗? 我自己创建了一个网站,网址为http://ppsc.sankuai.com。在这个网页中我设置了几个cookie:JSSESSIONID,PA_VTIME,skmtutc,test。 在 chrome 浏览器中打开这个网站,进入开发者模式,点击Resources栏 -> 选择cookies,

renxingzhadan的专栏 457

小智AI MCP协议实战:从语音指令到设备响应的完整链路拆解

本文深入拆解了小智AI MCP协议在智能语音交互中的完整工作流程。通过一个“调节音量”的真实场景,详细阐述了从语音采集、云端AI意图理解与决策,到MCP协议下的工具调用、设备端执行,最终完成语音反馈的每一个技术环节。文章重点分析了MCP协议如何通过标准化的交互模型,解决AI意图与设备控制间的“最后一公里”通信难题,实现高效可靠的设备响应。

defi6farmer的博客 248

智警杯1.4---excel可视化

知识点

lulu001128的博客 949

关于Cookie中的Path和domain

关于Cookie中的Path和domainPath – 路径。指定与cookie关联的WEB页。值可以是一个目录,或者是一个路径。 如果http://www.china.com/test/index.html 建立了一个cookie,那么在http://www.china.com/test/目录里的所有页面,以及该目录下面任何子目录里的页面都可以访问这个cookie。这就是说,

WYZSC的专栏 1万+

simulink中无迹卡尔曼(UKF)模块使用

simulink的UKF模块简单说明

qq_41059950的博客 2819

HTTP代理如何正确处理Cookie

大多数的 Web应用程序都要求维护某种会话状态,如用户购物车的内容。这种会话状态的保持很多情况下需要借助于Cookie或者Session的帮助。本文结合在线页面翻译 (Machine TranslationSystem)项目中对于Cookie的处理方法,探讨一下如何在HTTP应用代理中正确处理Cookie的传递和管理问题。读者定位为具有Java和Web开发经验的开发和设计人员。

在水一方 1513

NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.解决方案

本文主要介绍了NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.解决方案,希望能对使用jupyter notebook的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 11万+

4、机器人建模、规划与控制及运动学知识解析

本博客深入解析了机器人建模、规划与控制的核心内容,涵盖运动学与动力学的基本原理,并结合典型应用场景探讨了移动机器人与操作器的控制策略。同时,博客还介绍了机器人技术的发展趋势及其在工业和服务领域的广泛应用。

desk3的博客 122

Cookie--Session 自用解析

Cookie 一: 概念 * 客户端会话技术,将数据保存到客户端 二: 基础入门 * 使用步骤 1. 创建Cookie对象,绑定数据 * new Cookie(String name, String value) 2. 发送Cookie对象 * response.addCookie(Cookie cookie) 3. ...

cq724165616的博客 163

RNA-seq分析:Step4(比对)

预处理之后的fastq文件,可以使用HISAT2软件将reads比对至参考基因组上。HISAT2软件将reads比对至参考基因组上的步骤如下:1. 对参考基因组进行建索引。对参考基因组进行预处理,生成索引文件,包括基因组序列的FM索引和SA索引。2. 将原始的reads进行预处理。包括去除接头序列、去除低质量的碱基,以及进行过滤,得到质量较高的、可靠的reads。3. 利用建立的FM索引和SA索引,将处理后的reads与参考基因组进行比对。首先,通过FM索引,快速找到与reads匹配的可能位置;

沉香best的博客 2599

Cookie

1. 创建Cookie对象,绑定数据 * new Cookie(String name, String value) 2. 发送Cookie对象 * response.addCookie(Cookie cookie) 3. 获取Cookie,拿到数据 * Cookie[] request.getCookies()

金蒂 1677

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

快速入门Cookie及案例

会话技术 1.会话:一次会话中包含多次请求和响应 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止 2.功能:在一次会话的范围内的多次请求间,共享数据 3.方式: 客户端会话技术:Cookie 服务器端会话技术:Session Cookie~~ 1.概念:客户端会话技术,将数据保存到客户端 2.快速入门: 使用步骤: 1.创建Cookie对象,绑定数据 new ...

狗凡的博客 340

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

【大数据笔记】Cookie 和 Session

【大数据笔记】Cookie 和 Session会话技术1. 会话:一次会话中包含多次请求和响应。2. 功能:在一次会话的范围内的多次请求间,共享数据3. 方式:Cookie1. 概念:客户端会话技术,将数据保存到客户端2. 快速入门:3. 实现原理4. cookie的细节5. Cookie的特点和作用JSP:入门学习1. 概念:2. 原理3. JSP的脚本:JSP定义Java代码的方式4. JSP的内置对象:Session:主菜1. 概念:服务器端会话技术,在一次会话的多次请求间共享数据,将数据保存在服务器

Wu__Code的博客 639

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Java Cookie与Session 讲解

Java Cookie与Session 讲解 一、Cookie与Session讲解: 概念:一次会话中包含多次请求和响应; 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止; 功能:再一次会话的范围内的多次请求间,共享数据; 方式: 客户端会话技术:Cookie; 服务器端会话技术:Session; 1.Cookie: 概念:客户端会话技术,将数据保存到客户端; ...

Fe_cow的博客 423

会话技术_Cookie和Session的应用

目录会话技术Cookie:1. 概念2. 快速入门3. 实现原理4. cookie的细节5. Cookie的特点和作用6. 案例:Session:主菜1. 概念2. 快速入门:3. 原理4. 细节 会话技术 会话:一次会话中包含多次请求和响应。 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 1. 客户端会话技术:Cookie 2. 服务器端会话技术:Session Cookie: 1. 概念 客户端会话技术,将数据保存到

david2000999的博客 199

javaWeb(十二)----- 会话技术:Cookie

会话技术 ✔ 会话:一次会话中包含多次请求和响应 * 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止 ✔ 功能:在一次会话的范围内的多次请求间共享数据 ✔ 方式: 1. 客户端会话技术:Cookie 2. 服务器端会话技术:Session Cookie ✔ 概念:客户端会话技术,将数据保存到客户端 ✔ 快速入门 --- 使用步骤: 1. 创建Cookie对象,绑定数据 * new Cook...

Learning_xzj的博客 330

JavaWeb:Cookie和Session(1)

***///1.创建Cookie对象//2.发送Cookiedemo2/**Cookie快速入门*///3. 获取Cookie//获取数据,遍历Cookiesif(cs!= null){cookie的细节一次可不可以发送多个cookie?可以,可以创建多个Cookie对象,使用response调用多次addCookie方法发送cookie即可。/**Cookie快速入门*///1.创建Cookie对象。

2401_87029710的博客 974

【JavaWeb】会话 cookie

setDomain(“.baidu.com”),那么tieba.baidu.comfflnews.baidu.com中cookie可以共享。2 .浏览器对于单个cookie的大小有限制(4kb)以及 对同一个域名下的总cookie数量也有限制(20个)1 .假设在一个tomcat服务器中,部署了多个web项目,那么在这些web项目中cookie能不能共享?2 .在不登录的情况下,完成服务器对客户端的身份识别(如百度,在不登录的情况下,记录用户自定义设置)功能:在一次会话的范围内的多次请求间,共享数据。

follow your heart 438

cookie session jsp

cookie session jspcookiejspsession cookie cookie:客户端会话技术,将数据保存到客户端 tomcat8之后,cookie中才可以保存中文数据,但是对于特殊字符还不支持(例如空格),需要进行URL进行编码和解码。 jsp jsp中既可以定义HTML标签,又可以写Java代码。用于简化书写。 (本质上是一个servlet) jsp运行原理:1、服务器解析请求信息,找到对应jsp资源 2、若找到,将jsp转换为.java文件 3、编译.java文件,产生.class字

weixin_43423541的博客 112

会话技术——Cookie&Session&JSP入门

文章目录会话技术Cookie:JSP:入门学习Session:主菜案例:验证码 会话技术 会话:一次会话中包含多次请求和响应。 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 客户端会话技术:Cookie 服务器端会话技术:Session Cookie: 概念:客户端会话技术,将数据保存到客户端 快速入门: 使用步骤: 创建Cookie对象,绑定数据 new Cookie(String name,

一路向北 152

JAVA 基础会话技术 Cookie和 Session 详解(二)(小白必学)

JAVA 基础会话技术 Cookie和 Session 详解(二一级目录二级目录三级目录 一级目录 二级目录 三级目录

qq_39654399的博客 426
上一篇: EL表达式和JSTL标签
下一篇: 在java程序里读取Struts资源文件里的KEY
cg_program
博客等级 码龄19年 245粉丝 147原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值