comparison seobeo/s_web.c @ 34:6c322f9c2cb9

[Birthday] I didn't have nay time to buy birhtday present so w/e/
author MrJuneJune <me@mrjunejune.com>
date Sat, 11 Oct 2025 15:07:07 -0700
parents c0f6c8c7829f
children 84672efec192
comparison
equal deleted inserted replaced
33:c0f6c8c7829f 34:6c322f9c2cb9
84 84
85 Dowa_HashMap_Print(p_req_map); 85 Dowa_HashMap_Print(p_req_map);
86 86
87 // Extract method (GET, POST, etc.) 87 // Extract method (GET, POST, etc.)
88 const char *method = (const char*)Dowa_HashMap_Get(p_req_map, "HTTP_Method"); 88 const char *method = (const char*)Dowa_HashMap_Get(p_req_map, "HTTP_Method");
89 printf("Method: %s Pointer %p\n\n", method, p_req_map);
90 if (!method) 89 if (!method)
91 { 90 {
92 printf("?? wtf\n\n");
93 Seobeo_Web_Header_Generate(p_response_header, 91 Seobeo_Web_Header_Generate(p_response_header,
94 HTTP_BAD_REQUEST, 92 HTTP_BAD_REQUEST,
95 "text/plain", 0); 93 "text/plain", 0);
96 Seobeo_Handle_Queue(p_cli_handle, 94 Seobeo_Handle_Queue(p_cli_handle,
97 (const uint8*)p_response_header, 95 (const uint8*)p_response_header,
249 Seobeo_Handle_Flush(p_cli_handle); 247 Seobeo_Handle_Flush(p_cli_handle);
250 } 248 }
251 goto clean_up; 249 goto clean_up;
252 250
253 clean_up: 251 clean_up:
254 printf("CLEAN UP\n\n\n");
255 if (p_cli_handle) 252 if (p_cli_handle)
256 {
257 printf("CLEAN UP called on client handle\n\n\n");
258 Seobeo_Handle_Destroy(p_cli_handle); 253 Seobeo_Handle_Destroy(p_cli_handle);
259 }
260 if (p_response_arena) 254 if (p_response_arena)
261 Dowa_Arena_Destroy(p_response_arena); 255 Dowa_Arena_Destroy(p_response_arena);
262 } 256 }
263 257
264 258
485 sa.sa_handler = SigchildHandler; 479 sa.sa_handler = SigchildHandler;
486 sigemptyset(&sa.sa_mask); 480 sigemptyset(&sa.sa_mask);
487 sa.sa_flags = SA_RESTART; 481 sa.sa_flags = SA_RESTART;
488 sigaction(SIGCHLD, &sa, NULL); 482 sigaction(SIGCHLD, &sa, NULL);
489 483
490 while (1) { 484 while (1)
485 {
491 Seobeo_PHandle cli = 486 Seobeo_PHandle cli =
492 Seobeo_Stream_Handle_Server_Accept(p_server_handle); 487 Seobeo_Stream_Handle_Server_Accept(p_server_handle);
493 if (!cli) continue; 488 if (!cli) continue;
494 489
495 if (fork() == 0) 490 if (fork() == 0)
496 { 491 {
497 Seobeo_Web_HandleClientRequest(cli, 492 Seobeo_Web_HandleClientRequest(cli,
498 p_html_cache); 493 p_html_cache);
499 _exit(0); 494 _exit(0);
500 } 495 }
501 Seobeo_Handle_Destroy(cli);
502 } 496 }
503 } 497 }
504 498
505 if (mode == SEOBEO_MODE_EDGE) 499 if (mode == SEOBEO_MODE_EDGE)
506 { 500 {