主函数: #include "lcw_shttpd.h" //初始化时服务器的默认配置 extern struct conf_opts conf_para= { "/usr/local/var/www/cgi-bin/",//CGI根目录 "index.html",//默认文件名称 "/usr/local/var/www/",//根文件目录 "/etc/SHTTPD.conf",//配置文件路径和名称 80…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: 服务器SHTTPD请求方法解析 #include "lcw_shttpd.h" /****************************************************** 函数名: Method_DoGet(struct worker…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: SHTTPD内容类型的实现 #include "lcw_shttpd.h" //定义的内容类型格式如下 enum{ MINET_HTML, MINET_HTM, MINET_TXT, MINET_CSS, MINET_ICO, MINET_GIF, MI…
开始学习<LInux网络编程>中的综合案例,虽然代码书上有,还是自己打一下加深理解和印象. 主要有两个函数,完成命令行的解析,另一个实现配置文件的解析,注释还是比较丰富的哦. //start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: 命令行解析代码和配置文件解析的实现 #include "lcw_shttpd…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: SHTTPD错误处理的实现 #include "lcw_shttpd.h" //错误代码定义如下 enum { ERROR301, ERROR302, ERROR303, ERROR304, ERROR305, ERROR307, ERROR400, E…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: SHTTPD支持CGI的实现 #include "lcw_shttpd.h" /****************************************************** 函数名: GenerateDirFile(struct work…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: SHTTPD多客户端支持的实现 #include "lcw_shttpd.h" static int workersnum = 0;//工作线程的数量 extern struct conf_opts conf_para; pthread_mutex_t…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief: URI分析 #include "lcw_shttpd.h" /****************************************************** 函数名:uri_decode(char *src, int src_len, ch…
//start from the very beginning,and to create greatness //@author: Chuangwei Lin //@E-mail:979951191@qq.com //@brief:客户端请求分析 #include "lcw_shttpd.h" extern void Error_400(struct worker_ctl* wctl); extern void Error_403(struct worker_ctl* wctl);…
开篇:每当我们将开发好的ASP.NET网站部署到IIS服务器中,在浏览器正常浏览页面时,可曾想过Web服务器是怎么工作的,其原理是什么?“纸上得来终觉浅,绝知此事要躬行”,于是我们自己模拟一个简单的Web服务器来体会一下. 一.请求-处理-响应模型 1.1 基本过程介绍 每一个HTTP请求都会经历三个步凑:请求-处理-响应:每当我们在浏览器中输入一个URL时都会被封装为一个HTTP请求报文发送到Web服务器,而Web服务器则接收并解析HTTP请求报文,然后针对请求进行处理(返回指定的HTML页面…