zouxiaohang / webserver Goto Github PK
View Code? Open in Web Editor NEW简易的http服务器
简易的http服务器
你好。
对于一个新的connection,就创建一个thread:tyhp_thread_func
然后对这个fd读,读到EAGAIN就break,接下来就调用tyhp_parse_http_request来处理这个http包,但是这个函数是假设http包已经完全读进来了。那么问题来了,如果网络有延迟或者其它原因,导致http包最后几个字节没有到达client,那么read也会返回EAGAIN,那么这次调tyhp_parse_http_request就不对了。这几个剩余的字节会伴随着下一次http请求的到来,那么下一次调tyhp_parse_http_request解析request line的时候也会出错。
所以有什么好的解决方案?可以把http包先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.