Final
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user