7

《Unix/Linux编程实践教程》笔记(11)──连接和协议:编写Web服务器

 2 years ago
source link: https://houye.xyz/2018-10/uup11/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
《Unix/Linux编程实践教程》笔记(11)──连接和协议:编写Web服务器

《Unix/Linux编程实践教程》笔记(11)──连接和协议:编写Web服务器

Table of Contents

设计了一个简单的Web服务器,通过socket响应客户端的请求,在这里的客户端就是浏览器。按照http协议,响应GET请求。

书中给出的程序,对于每个请求都重新fork一个进程来进行处理,效率比较低,对于僵尸进程和错误都没有进行处理。

判断error 是否为EINTR,来决定是否重新调起accept

获取环境变量 PWDSHELL ,来设定程序运行目录和默认执行cgi的shell

Author: houye

Created: 2018-10-30 Tue 22:22

Emacs 24.5.1 (Org mode 8.2.10)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK