//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);…
//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: 服务器SHTTPD请求方法解析 #include "lcw_shttpd.h" /****************************************************** 函数名: Method_DoGet(struct worker…
开始学习<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支持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: 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: SHTTPD内容类型的实现 #include "lcw_shttpd.h" //定义的内容类型格式如下 enum{ MINET_HTML, MINET_HTM, MINET_TXT, MINET_CSS, MINET_ICO, MINET_GIF, MI…
目标 实现一个简单的Web服务器,能够根据HTTP请求的URL响应对应的静态资源,如果静态资源不存在则响应404. HttpServer 使用ServerSocket实现的一个服务器,request根据socket.getInputStream()获取HTTP报文,response将响应写入socket.getOutputStream()中. public class HttpServer { public static final String WEB_ROOT = System.getPro…