Mercurial
comparison seobeo/s_web.c @ 76:35b1abc37969
Updating my website to use seobeo library.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 31 Dec 2025 14:11:21 -0800 |
| parents | 4532ce6d9eb8 |
| children | c348ac875294 |
comparison
equal
deleted
inserted
replaced
| 75:ae6a88e6e484 | 76:35b1abc37969 |
|---|---|
| 27 "\r\n", | 27 "\r\n", |
| 28 path, host | 28 path, host |
| 29 ); | 29 ); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Load file from disk and cache it | |
| 33 static char* Seobeo_Web_LoadFile(const char *file_path, size_t *p_file_size) | 32 static char* Seobeo_Web_LoadFile(const char *file_path, size_t *p_file_size) |
| 34 { | 33 { |
| 34 printf("file_path: %s\n", file_path); | |
| 35 char full_path[1024]; | 35 char full_path[1024]; |
| 36 snprintf(full_path, sizeof(full_path), "%s/%s", g_folder_path, file_path); | 36 snprintf(full_path, sizeof(full_path), "%s/%s", g_folder_path, file_path); |
| 37 | 37 |
| 38 FILE *p_file = fopen(full_path, "rb"); | 38 FILE *p_file = fopen(full_path, "rb"); |
| 39 if (!p_file) | 39 if (!p_file) |
| 58 *p_file_size = file_size; | 58 *p_file_size = file_size; |
| 59 | 59 |
| 60 return p_content; | 60 return p_content; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void Seobeo_Web_Header_Generate(void *buffer, int status, | 63 void Seobeo_Web_Header_Generate( |
| 64 const char *content_type, const int content_length) | 64 void *buffer, int status, |
| 65 const char *content_type, const int content_length) | |
| 65 { | 66 { |
| 66 const char *status_text; | 67 const char *status_text; |
| 67 switch(status) | 68 switch(status) |
| 68 { | 69 { |
| 69 case HTTP_OK: status_text = "OK"; break; | 70 case HTTP_OK: status_text = "OK"; break; |