Vino 的过程中,还有许多需要考虑和权衡的地方。响应请求时,如果用户请求的是一个很大的文件,导致写缓冲区满,我们如何更好的设计响应缓冲区?如何更高效的设计底层数据结构(如字符串、链表、小顶堆等)?如何更优雅的解析命令行参数?如何对特定信号进行处理?如何更健壮的处理错误信息?当代码的数量达到一定程度后,如何更快的定位异常代码?
Vino 的开发 & 重构暂时告一段落,源码放在了 GitHub 上。当然,Vino 还有许多不足之处,以及未实现的特性。
- 仅支持 HTTP GET 方法,暂不支持其他 HTTP method。
- 暂不支持动态请求的处理。
- 支持的 HTTP/1.1 特性有限。
- …
写这篇文章,希望对初学者有所帮助。
参考
[1] Vino, https://github.com/tinylcy/vino.
[2] Computer Systems: A Programmer’s Perspective, http://csapp.cs.cmu.edu.
[3] Advanced Programming in the UNIX Environment (3rd Edition), https://www.amazon.ca/Advanced-Programming-UNIX-Environment-3rd/dp/0321637739.
[4] Unix Network Programming, Volume 1, https://www.amazon.ca/Unix-Network-Programming-Sockets-Networking/dp/0131411551.
[5] Nginx, https://github.com/nginx/nginx.
[6] Mongoose, https://github.com/cesanta/mongoose.
[7] Web Bench, http://home.tiscali.cz/~cz210552/webbench.html.
[8] Zaver, https://github.com/zyearn/zaver.
[9] RFC 2616, https://tools.ietf.org/html/rfc2616.
[10] How to use epoll? A complete example in C, https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c .