Tinyhttpd icon indicating copy to clipboard operation
Tinyhttpd copied to clipboard

Tinyhttpd 是J. David Blackstone在1999年写的一个不到 500 行的超轻量型 Http Server,用来学习非常不错,可以帮助我们真正理解服务器程序的本质。官网:http://tinyhttpd.sourceforge.net

Results 34 Tinyhttpd issues
Sort by recently updated
recently updated
newest added

path不是html文件的路径吗?并没有执行脚本的操作啊,我这里没有看懂,还有能给我举个测试实例吗?

sprintf(path, "htdocs%s", url); if (path[strlen(path) - 1] == '/') strcat(path, "index.html"); if (stat(path, &st) == -1) { while ((numchars > 0) && strcmp("\n", buf)) /* read & discard headers */...

安装了perl,并且也在两个cgi问件中更改了perl的路径,make之后运行文件,输入127.0.1.1:端口号,什么都不显示。可能是perl-cgi没安装好,哪位大佬知道perl-cgi怎么安装啊,我看了很多教程没装好。

自己在运行项目时遇到了一些问题,现在已经解决。 **问题** 成功运行`httpd`后,可以通过命令`curl -v localhost:4000/index.html`和`curl -v localhost:4000/color.cgi`从服务端获得回应,但无法通过windows浏览器访问服务端。 **解决** 1、设置防火墙开放相应端口`firewall-cmd --add-port=4000/tcp`。这里修改了代码,将端口固定为4000而不是让系统随机分配。 2、使用`whereis perl`命令获得perl程序的地址,然后`vim htdocs/color.cgi`,将第一行的perl地址改为自己查到的路径。 在windows浏览器中输入`(自己的虚拟机ip):4000`,可成功访问`index.html`界面,输入颜色可获得`color.cgi`的运行结果。

perl -Tw color.cgi Can't locate CGI.pm in @INC (you may need to install the CGI module) (@INC contains: /usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0 /usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0 /usr/local/lib/perl5/site_perl/5.34.0) at color.cgi line 4.perimeter81 persepolis-download-manager BEGIN failed--compilation...

Fix code error of excel excution

在execute_cgi()函数中,你在fork()之后 调用sprintf(buf, "HTTP/1.0 200 OK\r\n");send(client, buf, strlen(buf), 0);这会导致这个信息发了两次,发代码之前都不用一下的吗?

在mian()中的client_sock以指针形式传入accept_request()中,但在accept_request中(57行)将指针直接赋值给int型的client变量中导致后面recv失败。

main 函数中的 accept_request 应该传入 client_sock 的值而非地址