This commit is contained in:
2025-12-13 01:00:23 +00:00
parent 28ad19b63c
commit 940bcdc68f
2 changed files with 14 additions and 6 deletions
BIN
View File
Binary file not shown.
+14 -6
View File
@@ -507,8 +507,9 @@ void save_response_to_cache(struct req_http_message req_message, struct res_http
break;
}
}
printf("[Info] Caching object with Max-Age = %d, ETag = \"%s\"\n", new_entry->maxAge, new_entry->ETag);
if (DEBUG_MODE == DEBUG_ASSIGNMENT) {
printf("[Info] Caching object with Max-Age = %d, ETag = \"%s\"\n", new_entry->maxAge, new_entry->ETag);
}
// Add to cache
@@ -529,7 +530,7 @@ void save_response_to_cache(struct req_http_message req_message, struct res_http
if (!placed) {
cache[cacheCount] = new_entry;
}
cacheCount++;
}
@@ -563,7 +564,6 @@ void print_res_http_message(struct res_http_message message) {
// Main
int main(int argc, char *argv[]) {
// Setup TCP Socket
if (DEBUG_MODE >= DEBUG_EXTENDED) printf("SETUP: Setup Sockets\n");
int serv_sock, client_sock, read_size;
@@ -645,7 +645,9 @@ int main(int argc, char *argv[]) {
printf("[Info] Must revalidate with server using If-None-Match: \"%s\"\n", cache[cache_hit]->ETag);
} else {
// Cache Miss (Case 1)
printf("[Info] Object not in cache. Contacting server\n");
if (DEBUG_MODE == DEBUG_ASSIGNMENT) {
printf("[Info] Object not in cache. Contacting server\n");
}
}
// Process Message for Relay
@@ -740,7 +742,13 @@ int main(int argc, char *argv[]) {
// Close Client Socket
close(client_sock);
if (DEBUG_MODE >= DEBUG_INFO) {printf("DISCONNECT: Client Disconnected\n\n");}
if (DEBUG_MODE >= DEBUG_INFO) {
printf("DISCONNECT: Client Disconnected\n\n");
}
if (DEBUG_MODE == DEBUG_ASSIGNMENT) {
printf("===============================================================================================\n");
}
}
return 0;