lvyahui8 / http-proxy Goto Github PK
View Code? Open in Web Editor NEWNetty-based http high-performance proxy service
Netty-based http high-performance proxy service
代码中可能出现各种异常
1、客户端连接异常中断
2、目标服务器连接异常中断
3、连接超时
4、连接被拒绝
5、域名不能解析、无法建立连接
6、请求或响应body过大
7、程序数据异常、代码bug等
这些异常在代码并发被多个线程并发执行的情况下,执行流很复杂,要保证有异常发生时,buffer被正确的释放掉
涉及到2件事情
1、客户端请求的接收
2、向目标服务器发送请求
如果两件事按先后次序同步处理的话。则大文件需要以磁盘临时存储来中转
1、在收到Http 请求时,当读取完URL和Host头部之后,因立即匹配目标服务器,并向目标服务器发起连接
2、接收到的客户端请求头应转发给目标服务器
3、接收到的客户端请求body也应积满buffer立即转发
4、目标服务器的响应也应在积满buffer之后立即转发给客户端
其中,如果与目标服务器的连接、写、读等操作有任何异常发生,因立即终止与客户端的读取,同时向客户端发送异常信息
如此,则大文件上传与下载可以无需经过磁盘中转
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.