Skip to content

Commit

Permalink
delete C++ version
Browse files Browse the repository at this point in the history
  • Loading branch information
forthespada committed Oct 15, 2021
1 parent 7b2a151 commit 4fe1b7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### 1、简介

#### 0、插入一条更新

给大家一个思路,我把基于C++版本的项目删除,只留下以前写的基于C的项目,如果能够在C的基础上将之改写为C++版本,就变成你的项目了。

按照 【2、编译】中的步骤还是可以顺利运行的,可以自行尝试~

#### 1、由来

该项目是基于C++ 实现的HTTP服务器,也就是那种烂大街的WebServe服务器,不过由于是自己动手做的,所以还是很有意义的就上传上来了。
Expand Down
7 changes: 4 additions & 3 deletions httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <sys/wait.h>
#include <stdlib.h>


#define ISspace(x) isspace((int)(x))


Expand Down Expand Up @@ -383,10 +384,10 @@ void headers(int client, const char *filename)
}


//返回404错误页面,组装信息
void not_found(int client)
{
char buf[1024];
//返回404
sprintf(buf, "HTTP/1.0 404 NOT FOUND\r\n");
send(client, buf, strlen(buf), 0);
sprintf(buf, SERVER_STRING);
Expand All @@ -408,7 +409,7 @@ void not_found(int client)
}


//如果不是CGI文件,也就是静态文件,直接读取文件返回给请求的http客户端
//如果不是CGI文件,也就是静态文件,直接读取文件返回给请求的http客户端即可
void serve_file(int client, const char *filename)
{
FILE *resource = NULL;
Expand Down Expand Up @@ -492,7 +493,7 @@ void unimplemented(int client)
send(client, buf, strlen(buf), 0);
}

/**********************************************************************/
/*****************************主函数,也就是函数入口*****************************************/

int main(void)
{
Expand Down

0 comments on commit 4fe1b7c

Please sign in to comment.