Mercurial
diff seobeo/s_web.c @ 36:84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sun, 09 Nov 2025 06:25:16 -0800 |
| parents | 6c322f9c2cb9 |
| children | ea9ef388ab97 |
line wrap: on
line diff
--- a/seobeo/s_web.c Thu Oct 30 09:53:22 2025 -0700 +++ b/seobeo/s_web.c Sun Nov 09 06:25:16 2025 -0800 @@ -58,6 +58,7 @@ void Seobeo_Web_HandleClientRequest(Seobeo_PHandle p_cli_handle, Dowa_PHashMap p_html_cache) { + printf("p_cli_handle: %p", p_cli_handle); Dowa_PHashEntry entry = NULL; Dowa_PHashMap p_current = p_html_cache; char *slash; @@ -80,9 +81,10 @@ (uint32)strlen(p_response_header)); Seobeo_Handle_Flush(p_cli_handle); goto clean_up; + return; } - Dowa_HashMap_Print(p_req_map); + // Dowa_HashMap_Print(p_req_map); // Extract method (GET, POST, etc.) const char *method = (const char*)Dowa_HashMap_Get(p_req_map, "HTTP_Method"); @@ -249,10 +251,12 @@ goto clean_up; clean_up: - if (p_cli_handle) - Seobeo_Handle_Destroy(p_cli_handle); - if (p_response_arena) - Dowa_Arena_Destroy(p_response_arena); + printf("clean up\n\n"); + return; +// if (p_cli_handle) +// Seobeo_Handle_Destroy(p_cli_handle); +// if (p_response_arena) +// Dowa_Arena_Destroy(p_response_arena); } @@ -400,12 +404,12 @@ Dowa_HashMap_Push_Value_With_Type(map, key, val, value_len + 1, DOWA_HASH_MAP_TYPE_STRING); - printf("Capacity: %d, Length: %d ", (int)map->p_arena->capacity, (int)map->p_arena->offset); - printf("value_len: %d, key: %s value %s position: %d\n\n", (int)value_len + 1, key, val, Dowa_HashMap_Get_Position(map, key)); - printf("Method: %s Position: %d Pointer %p\n\n", Dowa_HashMap_Get(map, "HTTP_Method"), Dowa_HashMap_Get_Position(map, "HTTP_Method"), map); + // printf("Capacity: %d, Length: %d ", (int)map->p_arena->capacity, (int)map->p_arena->offset); + // printf("value_len: %d, key: %s value %s position: %d\n\n", (int)value_len + 1, key, val, Dowa_HashMap_Get_Position(map, key)); + // printf("Method: %s Position: %d Pointer %p\n\n", Dowa_HashMap_Get(map, "HTTP_Method"), Dowa_HashMap_Get_Position(map, "HTTP_Method"), map); - free(key); - free(val); + Dowa_Free(key); + Dowa_Free(val); } line = next + 2; @@ -430,7 +434,7 @@ body[body_len] = '\0'; Dowa_HashMap_Push_Value(map, "Body", body, body_len + 1); - free(body); + Dowa_Free(body); Seobeo_Handle_Consume(p_handle, (uint32)body_len); } @@ -483,13 +487,13 @@ while (1) { - Seobeo_PHandle cli = + Seobeo_PHandle p_cli_handle = Seobeo_Stream_Handle_Server_Accept(p_server_handle); - if (!cli) continue; + if (!p_cli_handle) continue; if (fork() == 0) { - Seobeo_Web_HandleClientRequest(cli, + Seobeo_Web_HandleClientRequest(p_cli_handle, p_html_cache); _exit(0); } @@ -499,7 +503,8 @@ if (mode == SEOBEO_MODE_EDGE) { printf("EDGE MODE\n"); - Seobeo_Web_Edge(p_server_handle, thread_count, p_html_cache); + Seobeo_Web_Edge_2(p_server_handle, p_html_cache); + // Seobeo_Web_Edge(p_server_handle, thread_count, p_html_cache); } return -1;