# simpleHttpServer **Repository Path**: onXoot/simpleHttpServer ## Basic Information - **Project Name**: simpleHttpServer - **Description**: this is a simple http server in cpp, referenced RFC2616 - **Primary Language**: C++ - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2014-05-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #simpleHttpServer 
这是一个简单的 http服务器程序,运行在linux环境下, 
可以回应200 和404 状态 ,主要用来学习socket编程和http协议

使用:
$ make
g++ -Wall -std=c++11 -c main.cpp http.h
g++ -Wall -std=c++11 -c http.cpp header.h body.h
g++ -Wall -std=c++11 -c header.cpp
g++ -Wall -std=c++11 -c body.cpp
g++ -pthread -o main main.o http.o header.o body.o

$ ./main
input a port:8888
now listen on port:8888  

现在 server 就运行起来了,使用浏览器访问 localhost:8888 就可以看到结果了

注:不要使用chrome访问,chrome会无限发送空包,导致程序崩溃,请使用firefox