前几天在博问中,看到有人提到了有关session的问题,决定自己整理写一下有关session的原理!说起session,cookie必须是要谈的!

目录

  1. Cookie的介绍
  2. Cookie的使用
  3. Session的介绍
  4. Session的使用
  5. Session的原理

Cookie的介绍(参照计算机网络)

一、无形之中我们使用的cookie:

使用浏览器浏览网页时,当你要登陆时,网页上有一个记住密码或自动登陆的选项,当你选择时,你就使用了Cookie。那么在下次访问该网站时,你可能就已经自动地登陆了,而不需要从重输入用户名和密码

二、cookie技术的组成
  • 在HTTP响应报文中有一个cookie首部行;
  • 在HTTP请求报文中有一个cookie首部行;
  • 在用户端系统中保留有一个cookie文件,由用户浏览器管理;
  • 在Web站点有一个后端数据库;
三、cookie的工作原理
在了解了cookie技术的组成之后,我们来看看cookie是怎么工作的。下面就以主机A中的浏览器访问网站xxx作为例子来分析cookie的工作原理吧。
 
首 先主机A使用浏览器上网,当主机A第一次访问xxx网站时,当请求报文到达xxx的Web服务器时,该Web服务器将产生一个唯一识别码(例 如:12345),并以此作为索引在它的后端数据库中产生一个表项,并用Set-cookie:首部行和刚才产生的值为设置HTTP响应报文的首部。这样 在HTTP响应报文的首部,我们就可以看到这样的一个首部行——Set-cookie: 12345.
 
当主机A的浏览器收到该HTTP响应报文时,它会看到Set-cookie:首部,然后浏览器在它的本地cookie文件上加入一行,其中包括Set-cookie:首部行中的识别码。
 
由于主机A的cookie文件已经有了用于xxx网站的表项,因此当主机A的浏览器继续浏览xxx网站时,每请求一个Web页面,其浏览器就会 从它的cookie文件中获取到xxx网站的识别码,并放入HTTP请求报文中cookie首部行中,即加入了首部行Cookie: 12345。
 
当xxx网站的服务器收到该包含Cookie首部行的HTTP请求报文后,服务器通过查询后端服务器,确定cookie标识码对应的用户,从而可以直接知道用户的信息(即知道确实有一个这样的用户,不久前登陆过该网站)。
 
注意,在cookie的方式下,xxx网站的服务器可以跟踪主机A在该站点的活动,xxx Web站点并不需要知道主机A的用户是谁,但是,它确切地知道用户12345访问了哪些页面,按照什么顺序,在什么时间。
 
简单点来说,cookie用于标识用户,用户首次访问站点时,可能需要提供一个用户标识,但在后继的访问中,浏览器向服务器传递一个 cookie首部,供服务器识别该用户。因此cookie可以在无状态的HTTP上建立一个用户会话层,允许服务器通过用户与应用程序之间的会话对用户进 行验证。
 

Cookie的使用

java中的response响应中加入cookie:

Cookie cookie = new Cookie("JSESSIONID", "123456");
cookie.setPath("/test");
response.addCookie(cookie);

java中的request请求中得到cookie:

Cookie[] cookies = request.getCookies();
for (Cookie cookie : cookies) {
String cookieName = cookie.getName();
String cookieValue = cookie.getValue();
System.out.println(cookieName + ", " + cookieValue);
}

Session的介绍

1、Session的概念

使用Cookie和附加URL参数都可以将上次请求的状态信息传递到下一次请求中,但是如果传递的状态信息较多,将极大降低网络传输效率和增大服务器端程序处理的难度。Session技术是一种会话状态保存在服务器端的技术,它可以比喻成是医生发给病人的病历卡和医院为每个病人保留的病历档案的结合方式。客户端需要接收、记忆和回送Session的会话标示号,Session可以且通常是借助Cookie来传递会话标示号。

2、Session的跟踪会话机制

Servlet API规范中定义了一个HttpSession接口,HttpSession接口定义了各种管理和操作会话状态的方法。HttpSession对象是保持会话状态信息的存储结构,一个客户端在WEB服务器端对应一个各自的HttpSession对象。Web服务器并不会在客户端开始访问它时就创建HttpSession对象,只有客户端访问某个能与客户端开启会话的Servlet程序是,Web应用程序才会创建一个与该客户端对应的HttpSession对象。Web 服务器为HttpSession对象分配一个独一无二的会话标示号,然后在响应消息中将这个会话标示号传递给客户端。客户端需要记住会话标示 号,并在后续的每次访问请求中都把这个会话标示号传送给Web服务器,Web服务器程序依据回传的会话标示号就知道这次请求的客户端发出的,从而选择与之 对应的HttpSession对象。

3、Session的跟踪机制

Web 应用程序创建与某个客户端对应的HttpSession对象后,只要没有超出一个限定的空闲时段,HttpSession对象就驻留在Web 服务器内存之中,该客户端此后访问任意的servlet程序时,它们都使用与客户端对应的那个已存在的Httpsession对象。HttpSession 接口中专门定义了一个SetAttribute方法将对象存储到HttpSession对象中,还定义了一个 getAttribute方法来检索存储在Httpsession对象中的对象,存储进Httpsession对象中的对象可以被属于同一个会话的各个请 求的处理程序共享。Session是实现网上商城的购物车的最佳方案,存储在某个客户Session中的一个集合对象就可充当给客户的一个购物车。

4、Session的超时管理

Web服务器无法判断当前的客户端浏览器是否还会继续访问,也无法检测客户端浏览器是否关闭,所以,即使客户已经离开或关闭了浏览器,Web服务器还要保留与之对应的Httpsession对象。随着时间的推移而不断增加新的访问客户端,Web服务器内存中将会因此积累起大量的不断不在使用的Httpsession对象,并将最终导致服务器内存耗尽。Web服务器采用“超时限制”的办法来判断客户端是否还在继续访问,如果某个客户端在一定的时间之内没有发出后续请求,Web服务器则认为客户端已经停止了活动,结束与该客户端的会话并将与之对应的Httpsession对象变成垃圾。如果客户端浏览器超时后再发出访问请求,Web服务器则认为这是一个新的会话开始,将为之创新的HttpSession对象和分配新的会话标示号。

session的使用

session中存储数据:

String username = request.getParameter("username");
HttpSession session = request.getSession();
System.out.println(session.getId());
session.setAttribute("username", username);

session中得到数据:

HttpSession httpSession =  request.getSession();
String username = (String)httpSession.getAttribute("username");

session的原理

我们创建一个项目来分析session的原理:

一、创建一个主页index.jsp

<form action="ContractListServlet" method="get">
username: <input type="text" name="username"/><br>
<input type="submit" value="submit">
</form>

清除浏览器所有cookie,访问url:http://localhost:8080/SessionTest/

详细的请求头部:

GET /SessionTest/ HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
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
Connection: keep-alive

详细的响应头部:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=5973D26B6164CDDAFF190965C0B4677C; Path=/SessionTest/; HttpOnly
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 418
Date: Tue, 15 Mar 2016 10:25:12 GMT

保存在浏览器的cookie:

aa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Y5Gp4uuo6R/J+eu62f4j8bfgcXljRWzWtrK8OsczJ9kdVXV226NKj0dMEnnQXpgrIm7RkrMu6S/UhES8R3s92/B9H4dEn3JBaocLN74TOq3ODrk1JzMbuc9cx9+NIi2n4h7SIZJ2u8JuqNJ3fQZrA5qt+M0tM/o7ohMtIFRU10D2T2Y+s7hNXvdDN3U5sZTUG6yIPT6hiW/qk31k9Zg2DRovv27Uu/5SS+naQp85PSKqkqVbO2cfhd3IN0sP7BfcLJKmPlpmsiD/65T5cmlJ72QRZmki7YjQnvgaAXS36UNI148yNxcp+m9V2kNitqGtIlvIDKy09KXVm4fhrFFa2+ttX+whfWMAa/eavatTVvU2n3kHyh6T7Nvibq2u57xpJjqHHpGX4lJo8h6YLdsHAPSOMk8rigYUAz9csqPbtIbVZII9MF1eL/MzY5LhSm/h5oXrrMmdk6BmSbtXTJuOV2fddN5YVCKbu+B/bihtwLzUsXVG7W0mUvcKEw9fcA6YLSSJfJcaEw9fcA6YLSSJfJcaEw9fcA6YLSSJfJcaEw9fcA6YLSSJfJcaEw9fcA6YLSSJfJcaEw9fdA7dLF9/3z58/b2hqs297eHg6Hpm8pviKyryFmxHQ/LBZvcmvp8vLLLw+Hw9Ooq+FwePHiRYpvEtnXEDNiuh8Wize5tXQBACBGugAA7CNdAAD2kS4AAPtIFwCAfaQLAMA+0gUAYB/pAgCwj3QBANhHugAA7CNdAAD2kS4AAPtIFwCANePx+JlnnhmRLgAAi1588cVHH310RLoAAPYC6QIAmFTcIUbPGADAmrhDjJ4xAMAeIl0AALuU7hBLesZee+21io8OANBMcT/Y888/f/z4cXFO63/8r+9VfHQAgKnTuvEv7j5z5szrr79e9ZEAAKbB66+/fubMmf8PxFnO9YuJWdUAAAAASUVORK5CYII=" alt="" />

说明:

  • 当我们清除cookie,向tomcat服务器发送请求时,浏览器首先会检查是否存在cookie文件(因为我们已经清除了cookie,所以找不到cookie)。第一次访问,没有cookie,直接发送请求。
  • tomcat服务器发现请求中没有cookie头部,于是为用户创建一个sessionid,用作标识这个用户的会话,并且在返回给用户的响应中增加了cookie的头部信息,该cookie的path为该项目的上下文/SessionTest。
  • 浏览器接收响应,检查响应,发现cookie的头部,把cookie保存起来
  • 当cookie还存在时,(也就是人们常说的再次请求)浏览器检查自身保存的cookie,如果host与path都符合。那么在请求的头部增加该符合的cookie信息
  • tomcat服务器接收到该cookie,得到cookie中的JSESSIONID的值与先前保存的sessionid做比较,如果一致,则服务器视为是同一个会话

二、创建ContractListServlet,以响应index.jsp的提交

String username = request.getParameter("username");
HttpSession session = request.getSession();
System.out.println(session.getId());
session.setAttribute("username", username); Cookie cookie = new Cookie("JSESSIONID", "123456");
cookie.setPath("/test");
response.addCookie(cookie);
request.getRequestDispatcher("/list.jsp").forward(request, response);

填写内容linux,点击提交:url为http://localhost:8080/SessionTest/ContractListServlet?username=linux

详细的请求头部:

GET /SessionTest/ContractListServlet?username=linux HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
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
Referer: http://localhost:8080/SessionTest/
Cookie: JSESSIONID=5973D26B6164CDDAFF190965C0B4677C
Connection: keep-alive

详细的响应头部:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=123456; Path=/test
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 331
Date: Tue, 15 Mar 2016 10:29:25 GMT

保存的cookie:现在有两个了

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAh8AAAIbCAIAAADErmuQAAAgAElEQVR4nO3dX4wcx2Hn8bXsyGdLcC7O+U+UixPEQP4cEMPxJpcDEiDBPuQeDlnjoHkwFvACeckmLyevOJLuNrJvktiZWLZM06ONsGRWkRPrHyVR09aYTmCbImmK5JKcpseOKYqyxJUuEpeiFIYOCFCZBece+l9VdVVP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5PUxFkqTLm+99dbhw4f//d//PXh55cqV73//+ydOnDh58uTJkydPnDjx8ssvP/PMM3IX2YilC+GE7SVdqkKoVIPLTgqfkG7FTqMiZk+4WLh8O43KtHgte1U5rCqVipQXYbpIO5FPptOokDDjpjTpcu7cuTNnzgR/B/+PgbW1tZMnT546derUqVPHjx9//vnng/8KG5EumCjxpdppVDSXmiZdtCsmYaDMDVfVXMhCIAVLxdTKkS76s0OplSZdjhw58uqrr7766qtnzpw5duzYiRMnTgnW1tYOHTp09erVI0eOCBuJd4HYEBeuYWF2cv3LM5R08aItlO9uan+DvCPx8EQMtoe+7aJZnNCtKLVdxDWDmdpvSenvYMKec6UL8TJuSpMuBw8e7HQ6x44dO378eBAtQYdY4NixY+vr671e78CBA8JG8aUs3S7JC01zPO4HkDdOblnhG5ruRo5faG5B2i7YXmL9HH65ES9veagjY8VoTelyzU4XzeLk9sqXLtwgY6Y06XLo0KEgSI4ePXrkyJFnn3326NGjp0+fPn369NGjR+MOMX26qBdyON/wXUltzhh6xoSvaOItEa+dHtzk5sH20vY26Vrh2i1TY+vBJRxds4O2XXpJvtB2mUilSZfjx4+vra0F/WM//vGP/+3f/m1tbe2ll146derU0aNHX3311atXrwZPJwsbDZwu4mil2Ie9lXRJdpjRXQ1YpB9u0bTC9XQXqO7qzzPuIsyfrlYZd5lEpUmX559/PvjhZLfbDeZcuXLl1KlTwRjMsWPHTp8+ffjw4bNnzwob5ekZS75mNTylqzhf28XUM9YQvr/xQDMckC61pKLOShfdilJGmdskWc+MKV+3pFFNnhmbFKVJl+CJ5MOHD1+5ciWeub6+fuzYsbW1tRMnTvi+f/DgQfMTydqBd2G28lj/dLWRs+0ibaX9PYD6CwQiBpZFF5vuByum37uEs7UXb+puidfSrdKnAzj+oibtRHsyGCelSZder3fhwoUDBw5873vfi+d0u912u91ut8+cOfPss89euHDB6ocDANiiMqVLr9e7cOHCt7/97RdeeOHKlStvvvnmc8891263X3jhBcP/CQYAUIySpUuv17t27drZs2cPHz78r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6dpzbLpZTpgmLx/xkbHh8Uxv4aKF+6TJvZOgdkm7R0ybjktnzVjeUHhYFs+RrYjgtyO5QvXVC4SUuX7cAHhbG/BkgXDIx0GR4fFMb+GiBdMDDSZXh8UBj7a4B0wcBIl+HxQWHsrwHSBQMjXYbHB4WxvwZIFwyMdBkeHxTG/hoYuXTxff/ixYu29gbrNjY22u22aSnFl0f2Z4gJMd43i8WL3Fq6vPnmm+12+xBGVbvdfuONNyi+YWR/hpgQ432zWLzIraULAAAx0gUAYB/pAgCwj3QBANhHugAA7CNdAAD2kS4AAPtIFwCAfaQLAMA+0gUAYB/pAgCwj3QBANhHugAArOn1eqdPn+6SLgAAiy5cuPDUU091SRcAwHYgXQAAw4o7xOgZAwBYE3eI0TMGANhGpAsAYIvSHWJJz9i1a9cKPjsAQDnF/WCvvPLK3r17xTn/H6PLdUlM0VfJAAAAAElFTkSuQmCC" alt="" />

三、 只要我们访问的url是这样的形式http://localhost:8080/cookiePath/xxx/xx,浏览器都会携带cookie信息去发送请求的:

  • localhost是服务器的地 址,
  • 8080是服务器的端口,
  • cookiePath是cookie的path(图片见上),

由于上述我们已经有了两个cookie,它们的path分别为, /test和/SessionTest,于是测试访问url:http://localhost:8080/test/jjii

虽然报错404,但是cookie信息仍旧在请求当中:

GET /test/jjii HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
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
Cookie: JSESSIONID=123456
Connection: keep-alive

关闭浏览器,cookie被自动清除,所以用户再次的请求,浏览器没有找到cookie,会像上述第一次访问一样,请求中没有cookie的头部。

四、 我们改动ContractListServlet的代码,在response中另外再增加两个cookie2:以下是加了之后的代码

Cookie cookie = new Cookie("JSESSIONID", "123456");
cookie.setPath("/test");
Cookie cookie3 = new Cookie("JSESSIONID", "123456");
cookie3.setPath("/SessionTest/");
Cookie cookie2 = new Cookie("df", "456789");
cookie2.setPath("/");

response.addCookie(cookie);
response.addCookie(cookie2);
response.addCookie(cookie3);

再次访问到从头开始访问到url:http://localhost:8080/SessionTest/ContractDetailServlet

详细的请求头部:

GET /SessionTest/ContractListServlet?username=linux HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
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
Referer: http://localhost:8080/SessionTest/
Cookie: JSESSIONID=3EF72ED7EC55DA676714F773E9110DB9
Connection: keep-alive

详细的响应头部:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=123456; Path=/test
df=456789; Path=/
JSESSIONID=123456; Path=/SessionTest/
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 321
Date: Tue, 15 Mar 2016 12:04:00 GMT

浏览器中的cookie有三条:

  • name: JSESSIONID, content: 123456, path: /test
  • name: df, content: 456789, path: /
  • name: JSESSIONID, content: 123456, path: /SessionTest/

结果分析:

  • 首先浏览器请求时,会携带cookie头部的:JSESSIONID=5DA63C198B1BBF3930A3CE7EC8613207
  • 然后在返回的时候,在响应头部加了三个cookie信息,由于cookie3的名字与路径都与tomcat服务器默认返回的cookie一致,所以导致了该cookie被代码中的cookie3覆盖

五、接着上面的程序,我们添加list.jsp到ContractDetailServlet的请求:http://localhost:8080/SessionTest/ContractDetailServlet

详细的头部请求:

GET /SessionTest/ContractDetailServlet HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
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
Referer: http://localhost:8080/SessionTest/ContractListServlet?username=linux
Cookie: JSESSIONID=123456; df=456789
Connection: keep-alive

详细的头部响应:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=D0ECF2D2EF3946CBBB34BC7E4A426D94; Path=/SessionTest/; HttpOnly
Content-Length: 0
Date: Tue, 15 Mar 2016 12:06:19 GMT

浏览器中的cookie有三条:

  • name: JSESSIONID, content: 123456, path: /test
  • name: df, content: 456789, path: /
  • name: JSESSIONID, content: D0ECF2D2EF3946CBBB34BC7E4A426D94, path: /SessionTest/

结果分析:

  • 首先浏览器找到匹配/SessionTest的cookie,找到了cookie2(path /)与cokie3(path /SessionTest/ ),在请求中加入这两个cookie
  • tomcat服务器接收到请求,发现cookie的sessionid与自身保存的不一致,于是为用户创建了一个sessionid,并把cookie加入到返回的头部
  • 浏览器接收到响应的报文,把cookie保存起来,tomcat服务器发送的cookie覆盖了浏览器原来的cookie3

以上是我个人对了session的理解,不正确的地方,还望大家斧正!

web基础---->session的使用的更多相关文章

  1. 20155318 《网络攻防》 Exp9 Web基础

    20155318 <网络攻防> Exp9 Web基础 基础问题 SQL注入攻击原理,如何防御 就是通过把SQL命令插入到"Web表单递交"或"输入域名&quo ...

  2. 20145312袁心《网络对抗》Web基础实践

    20145312袁心<网络对抗>Web基础实践 问题回答 1.什么是表单: 表单在网页中主要负责数据采集功能. 一个表单有三个基本组成部分: 表单标签:这里面包含了处理表单数据所用CGI程 ...

  3. 20145226夏艺华 网络对抗技术EXP8 WEB基础实践

    20145226夏艺华 网络对抗技术EXP8 WEB基础实践 实验问题回答 1.什么是表单? 表单在网页中主要负责数据采集功能.一个表单有三个基本组成部分: 表单标签:这里面包含了处理表单数据所用CG ...

  4. Web基础之Servlet

    Servlet Servlet : server applet,直译服务小程序.那Servlet到底是什么呢? Servlet说白了其实就是一个接口,接口的作用是什么?规范呗,这个接口规定了下面三个问 ...

  5. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(五)

    SpringSecurity(2) 好久没有写了,之前只写了一半,我是一边开发一边写Blog一边上班,所以真心没有那么多时间来维护Blog,项目已经开发到编写逻辑及页面部分了,框架基本上已经搭建好不会 ...

  6. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(四)

    SpringSecurity(1) 其实啊,这部分我是最不想写的,因为最麻烦的也是这部分,真的是非常非常的麻烦.关于SpringSecurity的配置,让我折腾了好半天,网上的配置方式一大把,但总有一 ...

  7. Golang友团无闻Go语言Web基础视频教程

    教程内容:GO语言资料Golang友团无闻Go语言编程基础Golang友团无闻Go语言Web基础教程 Go语言Web基础教程列表:[Go Web基础]12Go Web 扩展学习.mp4[Go Web基 ...

  8. HT for Web基础动画介绍

    在上一篇<基于HT for Web矢量实现3D叶轮旋转>一文中,我略微提了下HT for Web基础动画的相关用法,但是讲得不深入,今天就来和大家分享下HT for Web基础动画的相关介 ...

  9. Web基础开发最核心要解决的问题

    Web基础开发要解决的问题,往往也就是那些框架出现的目的 - 要解决问题. 1. 便捷的Db操作: 2. 高效的表单处理: 3. 灵活的Url路由: 4. 合理的代码组织结构: 5. 架构延伸 缓存. ...

随机推荐

  1. eclipse正常启动,debug无法启动,解决办法

  2. 项目Alpha冲刺--7/10

    项目Alpha冲刺--7/10 作业要求 这个作业属于哪个课程 软件工程1916-W(福州大学) 这个作业要求在哪里 项目Alpha冲刺 团队名称 基于云的胜利冲锋队 项目名称 云评:高校学生成绩综合 ...

  3. scala 中的匹配模式

    unapply 仅作匹配,不作其它输出.返回 Boolean 值 object UpperCase { def unapply(s: String): Boolean = s.toUpperCase ...

  4. 【pathon基础】初识python

    一.python的起源 作者:Guido van Rossum(龟叔) 设计原则:优雅,简单,明确 二.解释型语言VS编译型语言 1.解释型语言:C#.python step1:程序员写代码: ste ...

  5. IGC(Interleaved Group Convolutions)

    深度学习被引起关注是在2012年,用神经网络训练的一个分类模型在ImagNet上取得了第一名,而且其分类精度比第二名高出10多个点,当时所使用的模型为AlexNet,现在看来其为一个比较简单的网络,而 ...

  6. cors劫持用户凭证任意登陆

    漏洞作者:rcoil 挖洞过程无意中看到一个数据包,响应包中包含有Access-Control-Allow-Origin这个字段,然后就随手尝试看看有没有CORS漏洞!结果如图 再尝试 发现如下图! ...

  7. windbg在加载模块时下断点

    假设我们希望在加载特定的dll时中断调试器,例如,我想启用一些SOS命令,而clr还没有加载,当您遇到程序中过早发生的异常,并且您不能依赖手动尝试在正确的时间中断时,这尤其有用.例如,在将调试器附加到 ...

  8. pgloader 学习(八) pg 2 pg 简单demo

    pg 数据到pg 数据的迁移,同时支持名称的变更 环境准备 docker-compose文件 内容偏多可以忽略部分 version: "3" services: pgloader- ...

  9. Xshell6和Xftp6初步使用

    Xshell6和Xftp6初步使用 一.Xshell6和Xftp6介绍: Xshell6:可以在Windows界面下用来访问远端不同系统下的服务器,从而比较好的达到远程控制终端的目的. Xftp6:是 ...

  10. 认识Nodejs

    一.概念 ①JavaScript运行环境:Node.js不是一门语言,不是库也不是框架,是一个JavaScript运行环境,简单点来讲就是Node.js可以解析执行JavaScript代码,也就是说J ...