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

print html req

parent 0c0669a5
No related branches found
No related tags found
No related merge requests found
...@@ -185,6 +185,9 @@ static bool handle_http_request(int sockfd) { ...@@ -185,6 +185,9 @@ static bool handle_http_request(int sockfd) {
char* curr = buff; char* curr = buff;
for (int i = 0; i < 2049; i++){
printf("%c", curr[i]);
}
// parse the method // parse the method
METHOD method = UNKNOWN; METHOD method = UNKNOWN;
if (strncmp(curr, "GET ", 4) == 0) { if (strncmp(curr, "GET ", 4) == 0) {
...@@ -257,10 +260,8 @@ static bool handle_http_request(int sockfd) { ...@@ -257,10 +260,8 @@ static bool handle_http_request(int sockfd) {
// move the trailing part backward // move the trailing part backward
int p1, p2; int p1, p2;
for (p1 = size - 1, p2 = p1 - added_length; p1 >= size - 212; for (p1 = size - 1, p2 = p1 - added_length; p1 >= size - 212;
--p1, --p2){ --p1, --p2)
buff[p1] = buff[p2]; buff[p1] = buff[p2];
printf("%c", buff[p1]);
}
++p2; ++p2;
// copy the username // copy the username
...@@ -269,10 +270,6 @@ static bool handle_http_request(int sockfd) { ...@@ -269,10 +270,6 @@ static bool handle_http_request(int sockfd) {
strncpy(buff + p2 + added_prefix_length + username_length, strncpy(buff + p2 + added_prefix_length + username_length,
added_suffix, added_suffix_length); added_suffix, added_suffix_length);
for (int i = 0; i < 2048; i++) {
printf("%c", buff[i]);
}
if (write(sockfd, buff, size) < 0) { if (write(sockfd, buff, size) < 0) {
perror("write"); perror("write");
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment