Giter VIP home page Giter VIP logo

http-proxy's People

Contributors

lvyahui8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lgtm-migrator

http-proxy's Issues

检查各种异常情况下,是否会有buffer未释放造成内存泄露

代码中可能出现各种异常
1、客户端连接异常中断
2、目标服务器连接异常中断
3、连接超时
4、连接被拒绝
5、域名不能解析、无法建立连接
6、请求或响应body过大
7、程序数据异常、代码bug等

这些异常在代码并发被多个线程并发执行的情况下,执行流很复杂,要保证有异常发生时,buffer被正确的释放掉

大文件上传,以磁盘做临时存储

涉及到2件事情
1、客户端请求的接收
2、向目标服务器发送请求

如果两件事按先后次序同步处理的话。则大文件需要以磁盘临时存储来中转

请求接收与请求发送、响应接收与响应发送并行执行,大文件上传与下载可以无需经过磁盘中转

1、在收到Http 请求时,当读取完URL和Host头部之后,因立即匹配目标服务器,并向目标服务器发起连接
2、接收到的客户端请求头应转发给目标服务器
3、接收到的客户端请求body也应积满buffer立即转发
4、目标服务器的响应也应在积满buffer之后立即转发给客户端

其中,如果与目标服务器的连接、写、读等操作有任何异常发生,因立即终止与客户端的读取,同时向客户端发送异常信息

如此,则大文件上传与下载可以无需经过磁盘中转

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.