mirror of
https://github.com/fumiama/simple-http-server.git
synced 2026-06-11 13:30:29 +08:00
增加一些log
This commit is contained in:
13
server.c
13
server.c
@@ -120,10 +120,8 @@ void accept_request(void *cli) {
|
|||||||
(st.st_mode & S_IXGRP) ||
|
(st.st_mode & S_IXGRP) ||
|
||||||
(st.st_mode & S_IXOTH))
|
(st.st_mode & S_IXOTH))
|
||||||
cgi = 1;
|
cgi = 1;
|
||||||
if (!cgi)
|
if (!cgi) serve_file(client, path);
|
||||||
serve_file(client, path);
|
else execute_cgi(client, path, method, query_string);
|
||||||
else
|
|
||||||
execute_cgi(client, path, method, query_string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(client);
|
close(client);
|
||||||
@@ -293,10 +291,11 @@ void execute_cgi(int client, const char *path, const char *method, const char *q
|
|||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
off_t get_file_size(const char *filepath) {
|
off_t get_file_size(const char *filepath) {
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
if (stat(filepath, &statbuf) == 0)
|
if (stat(filepath, &statbuf) == 0) {
|
||||||
|
printf("file size: %u\n", statbuf.st_size);
|
||||||
return statbuf.st_size;
|
return statbuf.st_size;
|
||||||
else
|
}
|
||||||
return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user