开源项目的源码分析
qiyeboy / sourceanalysis Goto Github PK
View Code? Open in Web Editor NEW开源项目的源码分析
License: GNU General Public License v3.0
开源项目的源码分析
License: GNU General Public License v3.0
qiyeboy,你好,tinyhttpd-0.1.0_for_linux/httpd.c中:
(1)大概第128行,根据需求,如果URL是个以'/'结尾的目录(不管存不存在)都返回默认页,建议将strcat(path,'index.html')改为strcpy(path,'htdocs/index.html');
(2)用if(st.st_mode & S_IFMT==S_IFDIR)判断URL为存在的目录便导向默认页,同样建议用strcpy替换strcat;同时,值得注意的是,目录的权限默认为可执行,可能在判断是否为CGI程序时会导致变量cgi置为1,所以建议把目录的判断代码if(st.st_mode & S_IFMT==S_IFDIR)放在判断可执行代码之后,并cgi归0。即修改为如下:
if(st.st_mode & SIXUSR)||(...)||(...))
cgi=1;
if(st.st_mode & S_IFMT==S_IFDIR){
cgi=0;
strcat(path,"htdocs/index.html");
}
你好,我是一个初学者,我有个疑惑:为什么httpd.c开头说的需要注释的内容你不注释也可以过编译,而我看到
EZLippi的Tinyhttpd不注释这些内容无法过编译?
/* This program compiles for Sparc Solaris 2.6.
* To compile for Linux:
* 1) Comment out the #include <pthread.h> line.
* 2) Comment out the line that defines the variable newthread.
* 3) Comment out the two lines that run pthread_create().
* 4) Uncomment the line that runs accept_request().
* 5) Remove -lsocket from the Makefile.
*/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.