Exercise orderly and abrupt TLS shutdown in proxy integration
This commit is contained in:
1 parent
4da9d85545
commit
f0629ea679
3 files changed
+14
-4
No files matched your search
@@ -66,7 +66,7 @@ static const char* cfg_node_exit(void) {
|
||||
"tun_ifname=tun98\n"
|
||||
"[server: s1]\naddr=127.0.0.1:0\ntype=public\n"
|
||||
"[allowed_keys]\nallow_all=1\n"
|
||||
"[tcp_proxy_server]\nenabled=yes\n");
|
||||
"[tcp_proxy_server]\nconnect_timeout=2000\n");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,10 +173,20 @@ static int start_https_server(int* port, const char* dir, const char* cert, cons
|
||||
" self.send_header('Allow','GET,HEAD,POST,OPTIONS')\n"
|
||||
" self.send_header('Content-Length','0')\n"
|
||||
" self.end_headers()\n"
|
||||
"class S(HTTPServer):\n"
|
||||
" def shutdown_request(self,request):\n"
|
||||
" if os.environ.get('UTUN_TEST_TLS_ABRUPT'):\n"
|
||||
" return super().shutdown_request(request)\n"
|
||||
" try:\n"
|
||||
" request.settimeout(2.0)\n"
|
||||
" plain=request.unwrap();plain.close()\n"
|
||||
" except (ssl.SSLError,OSError) as e:\n"
|
||||
" sys.stderr.write(f'HTTPS_SHUTDOWN_ERR: {e}\\n')\n"
|
||||
" request.close()\n"
|
||||
"os.chdir(sys.argv[3])\n"
|
||||
"ctx=ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n"
|
||||
"ctx.load_cert_chain(sys.argv[1],sys.argv[2])\n"
|
||||
"httpd=HTTPServer(('127.0.0.1',int(sys.argv[4])),H)\n"
|
||||
"httpd=S(('127.0.0.1',int(sys.argv[4])),H)\n"
|
||||
"httpd.socket=ctx.wrap_socket(httpd.socket,server_side=True)\n"
|
||||
"httpd.timeout=None\n"
|
||||
"ready=int(sys.argv[5]);os.write(ready,httpd.server_port.to_bytes(2,'big'));os.close(ready)\n"
|
||||
@@ -223,7 +233,7 @@ static char* make_cfg_server(void) {
|
||||
"my_public_key=b3193173def895bd0fcea6f86af077c7d77216f10395275f627ac18242ec0f01\n"
|
||||
"[server: s1]\naddr=127.0.0.1:%d\ntype=public\n"
|
||||
"[allowed_keys]\nallow_all=1\n"
|
||||
"[tcp_proxy_server]\nenabled=yes\n", g_srv_port);
|
||||
"[tcp_proxy_server]\nconnect_timeout=2000\n", g_srv_port);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ static const char* cfg_node_exit(void) {
|
||||
"tun_ifname=tun98\n"
|
||||
"[server: s1]\naddr=127.0.0.1:0\ntype=public\n"
|
||||
"[allowed_keys]\nallow_all=1\n"
|
||||
"[tcp_proxy_server]\nenabled=yes\n");
|
||||
"[tcp_proxy_server]\nconnect_timeout=2000\n");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user