keep-alive

HTTP server capable of Keep-Alive

喜欢而已 提交于 2019-12-06 11:03:10
问题 I'm trying to create a http server in Java which is capable of providing keep-alive connections. I'm using the com.sun.net.httpserver.HttpServer class. import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; public class httpHandler implements HttpHandler { private String resp = "<?xml

Keep-Alive socket with HTTP server under C# (.net) how to send several queries?

孤者浪人 提交于 2019-12-06 08:11:10
Noob question. So i try this code to call http server for resource many times on same socket: public void TryReuseSameSocket(){ var addr = Dns.GetHostAddresses("stackoverflow.com"); var socket = new Socket(SocketType.Stream, ProtocolType.Tcp); try { // i thought that i must to use this option socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1); socket.Connect(addr, 80); var bigbuff = new byte[10000]; for (var i = 0; i < 20; i++) { //now i try to call some URL many times without socket closing var buff = Encoding.ASCII.GetBytes("GET /help/badges HTTP/1.1\r\nHost:

跨站跟踪攻击(CST/XST)

廉价感情. 提交于 2019-12-06 03:17:59
XSS与httponly 正常情况下,客户端脚本(如JS脚本)是可以通过document.cookie函数获得,这样如果有XSS跨站漏洞,cookie很容易被盗取。浏览器有一个安全策略,通过设置cookie的httponly属性,这样客户端脚本就不能通过document.cookie访问该cookie,即使有XSS漏洞,也不能盗取用户cookie。这个时候就可以利用HTTP TRACE方法来获取到用户的cookie信息。 TRACE方法 TRACE作用:客户端发起一个请求时,这个请求可能要穿过防火墙、代理、网关或其他一些应用程序。每个中间节点都可能会修改原始的 HTTP 请求。TRACE 方法允许客户端在 最终将请求发送给服务器时,看看它变成了什么样子。 下面就来看下允许TRACE方法的服务器,TRACE方法是如何工作的。 请求包: TRACE http://10.20.40.95/bWAPP/bWAPP/xss_get.php?firstname=aaaa&lastname=aaa&form=submit HTTP/1.1 Host: 10.20.40.95 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)

NSURLConnection and keep-alive

↘锁芯ラ 提交于 2019-12-06 01:58:22
问题 I have a small bug in my client app that uses NSURLConnection. I have tracked it down to an unexpected connection keep-alive that seems to confuse the web server (probably a bug on the server side). The workaround would be to force-close all outstanding connections at a certain point. Can I do this somehow with NSURLConnection, i.e. something like [NSURLConnection closeAllIdleConnections]; 回答1: ASIHTTPRequest has an expirePersistentConnections method. It may do what you're looking for. It's

How to stay alive in HTTP/1.1 using python urllib

此生再无相见时 提交于 2019-12-05 18:07:38
For now I am doing this: (Python3, urllib) url = 'someurl' headers = '(('HOST', 'somehost'), / ('Connection', 'keep-alive'),/ ('Accept-Encoding' , 'gzip,deflate')) opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor()) for h in headers: opener.addheaders.append(x) data = 'some logging data' #username, pw etc. opener.open('somesite/login.php, data) res = opener.open(someurl) data = res.read() ... some stuff here... res1 = opener.open(someurl2) data = res1.read() etc. What is happening is this; I keep getting gzipped responses from server and I stayed logged in (I am fetching

nginx 图片文件压缩配置方法

非 Y 不嫁゛ 提交于 2019-12-05 07:54:06
查看ngix编译参考,是否启用了gzip模块,运行命令: 代码如下 复制代码 /path/to/binary/nginx -V (我的nginx在PATH目录里,故命令中可以省略nginx所在的目录),写为nginx -t 即可,下文从略写 注意其中是否 --with-http_gzip_static_module,如果没有,那就自己编译一次吧,下面是我的配置参数,供参考。最后的--add-module=../nginx-lib/nginx-upload-progress-module-v0.9.0/是nginx上传进度模块,nginx第三方模块,源码放置在../nginx-lib/nginx-upload-progress-module-v0.9.0目录,如果你没有下载过该模块,去掉它就可以了。 代码如下 复制代码 nginx version: nginx/1.2.0 configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/conf/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path

Android - VPN at the native layer

爱⌒轻易说出口 提交于 2019-12-05 07:10:54
Just a quick question as Google isn't throwing up much. Is it possible to create a VPN connection using native code in Android? And if so does the VPN offer support for keep alives? I believe it would be more of a permissions issue than of an exposed or not exposed issue. Most VPN connections would need you to modify and access the network filtering calls of your kernel. Since your app should really be operating in it's own sandbox this is something I would doubt is exposed by default (to apps at least) since you would essentially be modifying the way the entire OS routes network traffic. For

How do I prevent my .NET SOAP client from including “Connection: KeepAlive” in the HTTP headers. (using WSE3.0)

穿精又带淫゛_ 提交于 2019-12-05 05:45:26
In the HTTP Connection header, my web service client is including: Connection: Keep-Alive I want to disable this. After doing some research, it appears the way to do this is to set the KeepAlive member of the SoapHttpChannelOptions class to false. But, I do not see a way to access/modify SoapHttpChannelOptions in the webservice client class that was generated for me in Visual Studio using WSE3.0 (Web Service Enhancement. In my case, the generated stub class extends Microsoft.Web.Services3.WebServicesClientProtocol I've been unable to find any examples searching google and most members of the

vue实践推荐

萝らか妹 提交于 2019-12-05 05:15:45
1.vue (1)组件 每个组件单独分成文件,如A.vue文件实现A组件; 除index.vue之外文件名推荐大写开头如BaseHeader.vue或横线连接base-header.vue; 基础组件名可以共用相同的前缀,如BaseButton; 组件名应该倾向于完整单词而不是缩写; 组件名推荐多个单词,如TodoItem代替Todo;html模板中引用推荐todo-item prop定义尽量详细,如指定其类型,必填与否; props: {   status: {     type: String,     required: true,     validator: function (value) {     // 校验方法       return ***     }   } } 编辑器通常按照字母顺序组织文件,可以考虑将具有相关关系的组件的命名相关,如都是搜索相关的组件可带公共前缀Search,具有父子关系的组件,可以考虑将子组件命名带上父组件命名参数SearchSidebar.vue NavigationForSearchS idebar.vue; 自闭合组件引用; <!-- 在单文件组件、字符串模板和 JSX 中 --> <MyComponent /> <!-- 在 DOM 模板中 --> <my-component></my-component> <!-- 在所有地方

How to break connections TCP/IP by keepalive postgreSQL without changing anything in the register?

心已入冬 提交于 2019-12-04 20:47:12
I have a system working with the client-server structure and PostgreSQL 8.4. My problem is that if a client is editing a record and lose his connection to the server, the TCPIP connection is still considered! So, the record stay allocated for the client in my database. I need the records to be free for edit in a few minutes. Therefore I set the KEEPALIVE configuration in my "postgresql.conf": tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds; tcp_keepalives_interval = 60 # TCP_KEEPINTVL, in seconds; tcp_keepalives_count = 5 # TCP_KEEPCNT After making these settings and restart the server the