Changeset 257 in Main for trunk/Server
- Timestamp:
- Oct 4, 2024, 2:34:27 PM (6 weeks ago)
- Location:
- trunk/Server
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/config.c
r255 r257 10 10 #include <stdlib.h> 11 11 #include <string.h> 12 #include <sys/stat.h> 12 13 13 14 #if !defined(_MSC_VER) && !defined(__BORLANDC__) … … 405 406 e->mime = cm_strdup(r[2]); 406 407 } 408 } else if(cm_strcaseequ(r[0], "MIMEFile")) { 409 if(r[1] == NULL) { 410 cm_log("Config", "Missing path at line %d", ln); 411 stop = 1; 412 } else { 413 FILE* mimefile = fopen(r[1], "r"); 414 if(mimefile == NULL) { 415 cm_log("Config", "Could not load the file at line %d", ln); 416 stop = 1; 417 } else { 418 char* line = malloc(1); 419 int i; 420 struct stat st; 421 char* buf; 422 int incr = 0; 423 stat(r[1], &st); 424 425 buf = malloc(st.st_size + 1); 426 fread(buf, st.st_size, 1, mimefile); 427 428 for(i = 0;; i++) { 429 if(buf[i] == '\n' || buf[i] == 0) { 430 char oldc = buf[i]; 431 char* line; 432 buf[i] = 0; 433 434 line = buf + incr; 435 436 if(strlen(line) > 0 && line[0] != '#') { 437 int j; 438 for(j = 0; line[j] != 0; j++) { 439 if(line[j] == ' ' || line[j] == '\t') { 440 line[j] = 0; 441 j++; 442 for(; line[j] != 0; j++) { 443 if(line[j] != ' ' && line[j] != '\t') { 444 char* name = line; 445 char* mimes = line + j; 446 int k = 0; 447 int incr2 = 0; 448 for(k = 0;; k++) { 449 if(mimes[k] == ' ' || mimes[k] == 0) { 450 char oldc2 = mimes[k]; 451 struct tw_mime_entry* e; 452 mimes[k] = 0; 453 454 e = ¤t->mimes[current->mime_count++]; 455 e->ext = cm_strcat(".", mimes + incr2); 456 e->mime = cm_strdup(name); 457 if(current->mime_count == MAX_MIME) { 458 cm_log("Config", "Too many MIME types, cannot handle"); 459 stop = 1; 460 break; 461 } 462 463 incr2 = k + 1; 464 if(oldc2 == 0) break; 465 } 466 } 467 break; 468 } 469 } 470 break; 471 } 472 if(stop) break; 473 } 474 } 475 476 incr = i + 1; 477 if(oldc == 0) break; 478 } 479 } 480 481 free(buf); 482 483 fclose(mimefile); 484 } 485 } 407 486 } else if(cm_strcaseequ(r[0], "Icon")) { 408 487 if(r[1] == NULL) { -
trunk/Server/gui.rc
r250 r257 14 14 LTEXT TW_VERSION_TEXT, GUI_TEWI_NAME, 42, 5, 192, 50 15 15 LTEXT "Original by Nishi <nishi@nishi.boats>", GUI_TEWI_ORIGINAL, 42, 5 + 8, 192, 50 16 LTEXT "Website: http://nishi.boats/tewi", GUI_TEWI_ORIGINAL, 42, 5 + 8 * 2, 192, 50 16 17 DEFPUSHBUTTON "&OK", IDOK, 75, 35, 50, 10 17 18 } -
trunk/Server/install.nsi
r217 r257 54 54 File /oname=pbtewi.gif "pbtewi.gif" 55 55 !cd .. 56 !cd Icons 56 57 SetOutPath "$INSTDIR\www\icons" 57 !cd Icons58 58 File "*.png" 59 59 !cd .. 60 60 !cd Server 61 61 SetOverWrite on 62 !cd .. 63 SetOutPath "$INSTDIR" 64 File "mime.types" 65 !cd Server 62 66 63 67 CreateDirectory "$SMPROGRAMS\Tewi HTTPd" -
trunk/Server/main.c
r255 r257 87 87 int startup(int argc, char** argv); 88 88 89 #if defined(__MINGW32__) || defined(_MSC_VER) 89 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) 90 90 char* get_registry(const char* main, const char* sub) { 91 91 DWORD bufsize = 512; … … 711 711 int i; 712 712 char* r; 713 #if defined(__MINGW32__) || defined(_MSC_VER) 713 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) 714 714 char* confpath = cm_strdup(PREFIX "/etc/tewi.conf"); 715 715 char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir"); -
trunk/Server/server.c
r255 r257 498 498 struct sockaddr* sa = (struct sockaddr*)&addr; 499 499 getnameinfo(sa, sizeof(addr), address, 512, NULL, 0, NI_NUMERICHOST); 500 #endif 501 addrstr = inet_ntoa(addr.sin_addr); 502 strcpy(address, addrstr); 503 address[strlen(addrstr)] = 0; 500 #else 501 addrstr = inet_ntoa(addr.sin_addr); 502 strcpy(address, addrstr); 503 address[strlen(addrstr)] = 0; 504 #endif 504 505 #ifdef FREE_PTR 505 506 free(ptr); -
trunk/Server/tw_config.h
r240 r257 42 42 #define MAX_MODULES 1024 43 43 #define MAX_DIRS 1024 44 #define MAX_MIME 102444 #define MAX_MIME 4096 45 45 #define MAX_ICON 1024 46 46 #define MAX_INDEX 1024 … … 85 85 struct tw_dir_entry dirs[MAX_DIRS]; 86 86 int dir_count; 87 struct tw_mime_entry mimes[MAX_ DIRS];87 struct tw_mime_entry mimes[MAX_MIME]; 88 88 int mime_count; 89 struct tw_icon_entry icons[MAX_ DIRS];89 struct tw_icon_entry icons[MAX_ICON]; 90 90 int icon_count; 91 91 char* indexes[MAX_INDEX]; -
trunk/Server/tw_version.h
r255 r257 8 8 #endif 9 9 10 #define TW_VERSION "2.0 3E\0"11 #define TW_VERSION_TEXT "Tewi HTTPd version 2.0 3E"10 #define TW_VERSION "2.04\0" 11 #define TW_VERSION_TEXT "Tewi HTTPd version 2.04" 12 12 13 13 const char* tw_get_version(void);
Note:
See TracChangeset
for help on using the changeset viewer.