Skip to content
Snippets Groups Projects
Commit d009d027 authored by ChouTatsumi's avatar ChouTatsumi
Browse files

bug 13:12

parent 1d06a74c
Branches
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ typedef enum { GET, POST, UNKNOWN } METHOD; ...@@ -51,7 +51,7 @@ typedef enum { GET, POST, UNKNOWN } METHOD;
void run_server(const char* ip, const int port); void run_server(const char* ip, const int port);
int create_server_socket(const char* ip, const int port); int create_server_socket(const char* ip, const int port);
static bool handle_http_request(int sockfd); static bool handle_http_request(int sockfd);
void show_intro_page(int sockfd); bool show_intro_page(int sockfd);
int main(int argc, char** argv) { int main(int argc, char** argv) {
int port; int port;
...@@ -208,7 +208,7 @@ static bool handle_http_request(int sockfd) { ...@@ -208,7 +208,7 @@ static bool handle_http_request(int sockfd) {
// contents of each pages // contents of each pages
if (*curr == ' ') { if (*curr == ' ') {
if (method == GET) { if (method == GET) {
show_intro_page(sockfd); return show_intro_page(sockfd);
} else if (method == POST) { } else if (method == POST) {
char* username = strstr(buff, "user=") + 5; char* username = strstr(buff, "user=") + 5;
int username_length = strlen(username); int username_length = strlen(username);
...@@ -339,7 +339,7 @@ static bool handle_http_request(int sockfd) { ...@@ -339,7 +339,7 @@ static bool handle_http_request(int sockfd) {
return true; return true;
} }
void show_intro_page(int sockfd) { bool show_intro_page(int sockfd) {
char buff[2049]; char buff[2049];
int n; int n;
...@@ -363,4 +363,5 @@ void show_intro_page(int sockfd) { ...@@ -363,4 +363,5 @@ void show_intro_page(int sockfd) {
return false; return false;
} }
close(filefd); close(filefd);
return true;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment