- Timestamp:
- Oct 4, 2024, 2:34:27 PM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/dir.c
r255 r257 38 38 do { 39 39 if(strcmp(ffd.cFileName, ".") != 0 && strcmp(ffd.cFileName, "..") != 0) { 40 old = r;41 for(i = 0; old[i] != NULL; i++)42 ;43 r = malloc(sizeof(*r) * (i + 2));44 for(i = 0; old[i] != NULL; i++) r[i] = old[i];45 r[i] = cm_strcat(ffd.cFileName, (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? "/" : "");46 r[i + 1] = NULL;47 free(old);40 old = r; 41 for(i = 0; old[i] != NULL; i++) 42 ; 43 r = malloc(sizeof(*r) * (i + 2)); 44 for(i = 0; old[i] != NULL; i++) r[i] = old[i]; 45 r[i] = cm_strcat(ffd.cFileName, (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? "/" : ""); 46 r[i + 1] = NULL; 47 free(old); 48 48 } 49 49 } while(FindNextFile(hfind, &ffd) != 0); -
trunk/README
r255 r257 1 1 2 Tewi HTTPd version 2.0 3D2 Tewi HTTPd version 2.04 3 3 4 4 Original by Nishi <nishi@nishi.boats> -
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); -
trunk/Tool/genconf.c
r176 r257 29 29 printf("\n"); 30 30 printf("MIMEType all application/octet-stream\n"); 31 printf("MIMEType .html text/html\n"); 32 printf("MIMEType .txt text/plain\n"); 33 printf("MIMEType .png image/png\n"); 31 printf("MIMEFile mime.types\n"); 34 32 printf("\n"); 35 33 printf("Icon all /icons/unknown.png\n"); -
trunk/Tool/itworks.c
r168 r257 15 15 printf(" <h1 align=\"center\">It works! - Tewi HTTPd is installed on this website!</h1>\n"); 16 16 printf(" <p>\n"); 17 printf(" If you can see this page, then the people who own this domain have just installed <a href=\"http://nishi.boats/tewi\">Tewi HTTPd</a> successfully. They now have to add content to this directory tand replace this placeholder page, or else point the server at their real content.\n");17 printf(" If you can see this page, then the people who own this domain have just installed <a href=\"http://nishi.boats/tewi\">Tewi HTTPd</a> successfully. They now have to add content to this directory and replace this placeholder page, or else point the server at their real content.\n"); 18 18 printf(" </p>\n"); 19 19 printf(" <hr>\n"); -
trunk/example.conf
r176 r257 7 7 #LoadModule Module/mod_proxy.so 8 8 9 Listen 80 10 ListenSSL 4439 Listen 8080 10 #ListenSSL 443 11 11 12 SSLKey key.pem13 SSLCertificate cert.pem12 #SSLKey key.pem 13 #SSLCertificate cert.pem 14 14 15 15 MIMEType all application/octet-stream 16 MIMEType .html text/html 17 MIMEType .txt text/plain 18 MIMEType .png image/png 16 MIMEFile /etc/mime.types 19 17 20 18 Icon all /icons/unknown.png … … 28 26 ReadmeFile README 29 27 30 DocumentRoot /var/www 28 DocumentRoot /var/www/html 31 29 32 30 Define test … … 39 37 ForceLog "not defined" 40 38 EndIf 39 BeginDirectory / 40 Allow all 41 EndDirectory
Note:
See TracChangeset
for help on using the changeset viewer.