Skip to content
Snippets Groups Projects
Commit 0520dd07 authored by Terence Denning's avatar Terence Denning
Browse files

trimmed keyword

parent 0096f30d
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -196,6 +196,11 @@ static bool handle_http_request(int sockfd) ...@@ -196,6 +196,11 @@ static bool handle_http_request(int sockfd)
n = sprintf(buff, HTTP_200_FORMAT, size); n = sprintf(buff, HTTP_200_FORMAT, size);
} }
else if(strstr(buff, "guess=Guess") != NULL) { else if(strstr(buff, "guess=Guess") != NULL) {
char *keyword = strstr(buff, "keyword=")+8;
int keyword_length = strlen(keyword);
keyword[keyword_length-12] = '\0';
printf("keyword is: %s\n", keyword);
if(sockfd == user1){ if(sockfd == user1){
if(user2_start == 1){ if(user2_start == 1){
webpage = "html/4_accepted.html"; webpage = "html/4_accepted.html";
...@@ -253,8 +258,11 @@ static bool handle_http_request(int sockfd) ...@@ -253,8 +258,11 @@ static bool handle_http_request(int sockfd)
return false; return false;
} }
} else { } else {
printf("%s\n", buff); if (write(sockfd, buff, st.st_size) < 0)
write(sockfd, buff, st.st_size); {
perror("write");
return false;
}
} }
} }
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment