![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
tinyhttpd
麻花不好吃
这个作者很懒,什么都没留下…
展开
-
tinyhttp源码剖析(三) :accept_request() 和 getline()
概述 继startup之后,主函数进入无限循环,首先调用accept函数。 accept原型: #include<sys/socket.h> int accept(int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen); 返回:成功返回非负描述符,出错返回-1 如果accept成功,那么其返回值是由内核自动生成的一个全新描述...原创 2019-08-13 22:13:41 · 538 阅读 · 0 评论 -
tinyhttpd源码剖析(四):execute_cgi
execute_cgi() 函数 接上篇所述,如果cig = 1,将会调用execute_cgi,接下来解释其运作过程。源码如下: void execute_cgi(int client, const char *path, const char *method, const char *query_string) { char buf[1024]; int ...原创 2019-08-13 22:59:26 · 516 阅读 · 0 评论 -
tinyhttpd源码剖析(五):其他函数
本篇为tinyhttpd分析最后一篇,主要把剩下的函数作简要解释。 bad_request bad_request函数用于告知客户端请求不合法。 void bad_request(int client) { char buf[1024]; sprintf(buf, "HTTP/1.0 400 BAD REQUEST\r\n"); send(client, buf, sizeof(buf),...原创 2019-08-13 23:12:54 · 177 阅读 · 0 评论 -
tinyhttpd源码剖析(一)
https://www.cnblogs.com/qiyeboy/p/6296387.html https://blog.csdn.net/u010487568/article/details/51790935 http://armsword.com/2014/10/29/tinyhttpd-code-analyse/ https://blog.csdn.net/yzhang6_10/article...原创 2019-08-13 23:15:04 · 204 阅读 · 0 评论 -
tinyhttpd源码剖析(二):main() 和startup()
main函数 tinyhttp main函数源码如下: int main(void) { int server_sock = -1; u_short port = 0; int client_sock = -1; struct sockaddr_in client_name; /* 源于sockaddr sockaddr_in 在netinet/in.h中定义 struct soc...原创 2019-08-12 22:32:14 · 279 阅读 · 0 评论