日期:2014-05-17 浏览次数:20840 次
<% dim str str = "Cache-Control: no-store, no-cache, must-revalidate,post-check=0, pre-check=0,private Pragma: no-cache Content-Length: 32609 Content-Type: text/html Expires: Sat, 18 Jan 1997 18:36:16 GMT Set-Cookie: bhCookieSaveSess=1; path=/ Set-Cookie: bhCookieSess=1; path=/ X-XSS-Protection: 0 Date: Sun, 15 Apr 2012 12:54:21 GMT Set-Cookie: TSac8f66=cf69bf0e0f7faebafba0edada47b6bd4b0e5d8818c9eed6f4f8ac4fd; Path=/" ' str 是一个http响应头,内含有很多回车 %>
<script language="JavaScript"> var str = 'Cache-Control: no-store, no-cache, must-revalidate,post-check=0, pre-check=0,private\r\nPragma: no-cache\r\nContent-Length: 32609\r\nContent-Type: text/html\r\nExpires: Sat, 18 Jan \r\n997 18:36:16 GMT\r\nSet-Cookie: bhCookieSaveSess=1; path=/\r\nSet-Cookie: bhCookieSess=1; path=/\r\nX-XSS-Protection: 0\r\nDate: Sun, 15 Apr 2012 12:54:21 GMT\r\nSet-Cookie: TSac8f66=cf69bf0e0f7faebafba0edada47b6bd4b0e5d8818c9eed6f4f8ac4fd; Path=/'; var reg = /Set-Cookie:\s?(.+?)path=\//gi; var r = ''; str.replace(reg, function($){ reg.exec(str); r += RegExp.$1; }) r += 'Path=/'; alert(r); </script>
------解决方案--------------------
Set-Cookie:.+/s/Spath=
------解决方案--------------------