This commit is contained in:
2025-12-03 21:33:08 +00:00
parent e43a360189
commit 77176941b4
4 changed files with 5 additions and 4 deletions
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
+3 -4
View File
@@ -274,12 +274,11 @@ struct http_forward_info process_for_relay(struct req_http_message received_mess
// Replace Proxy-Connection with Connection: close
strcpy(forward_info.new_message.headers[new_header_count].field_name, "Connection");
strcpy(forward_info.new_message.headers[new_header_count].field_value, "Close");
new_header_count++;
} else {
// Keep the existing header
forward_info.new_message.headers[new_header_count] = forward_info.new_message.headers[i];
new_header_count++;
}
new_header_count++;
}
forward_info.new_message.header_count = new_header_count;
@@ -336,7 +335,7 @@ void res_http_message_to_string(struct res_http_message message, char *message_s
// Body
if (message.body_length > 0) {
strncat(message_str, message.body, message.body_length);
memcpy(message_str + strlen(message_str), message.body, message.body_length);
}
}
@@ -509,7 +508,7 @@ int main(int argc, char *argv[]) {
// Send Response Back to Client
char response_str[origin_response.body_length + MAX_MESSAGE_SIZE];
res_http_message_to_string(origin_response, response_str);
send(client_sock, response_str, strlen(response_str), 0);
send(client_sock, response_str, origin_response.body_length + MAX_MESSAGE_SIZE, 0);
printf("RESPONSE: Response Sent Back to Client\n");
// Close Client Socket