--- Server/server.c 2024/10/17 10:18:01 1.2 +++ Server/server.c 2024/10/27 23:53:55 1.6 @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.2 2024/10/17 10:18:01 nishi Exp $ */ +/* $Id: server.c,v 1.6 2024/10/27 23:53:55 nishi Exp $ */ #define SOURCE @@ -343,15 +343,15 @@ void _tw_process_page(SSL* ssl, int sock incr = 0; while(1) { if(f != NULL) { - char buffer[128]; - fread(buffer, size < 128 ? size : 128, 1, f); - tw_write(ssl, sock, buffer, size < 128 ? size : 128); + char buffer[512]; + fread(buffer, size < 512 ? size : 512, 1, f); + tw_write(ssl, sock, buffer, size < 512 ? size : 512); } else { - tw_write(ssl, sock, (unsigned char*)doc + incr, size < 128 ? size : 128); + tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512); } - incr += 128; - if(size <= 128) break; - size -= 128; + incr += 512; + if(size <= 512) break; + size -= 512; } } @@ -640,6 +640,8 @@ int tw_server_pass(void* ptr) { host[i] = 0; port = atoi(host + i + 1); break; + }else if(vhost[i] == '['){ + for(; vhost[i] != 0 && vhost[i] != ']'; i++); } } name = host; @@ -791,6 +793,7 @@ int tw_server_pass(void* ptr) { addstring(&str, " \n"); addstring(&str, " \n"); addstring(&str, " Filename\n"); + addstring(&str, " Last-modified\n"); addstring(&str, " MIME\n"); addstring(&str, " Size\n"); addstring(&str, " \n"); @@ -808,10 +811,14 @@ int tw_server_pass(void* ptr) { char* fpth = cm_strcat3(path, "/", items[i]); struct stat s; char size[512]; + char date[512]; char* showmime; char* mime; + struct tm* tm; size[0] = 0; stat(fpth, &s); + tm = localtime(&s.st_mtime); + strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm); if(phase == 0 && !S_ISDIR(s.st_mode)) { free(fpth); continue; @@ -885,6 +892,7 @@ int tw_server_pass(void* ptr) { addstring(&str, "\n"); addstring(&str, " \"icon\"\n", icon); addstring(&str, " %h\n", items[i], itm); + addstring(&str, " %h \n", date); addstring(&str, " %h \n", showmime); addstring(&str, " %s \n", size); addstring(&str, "\n"); @@ -1013,7 +1021,7 @@ void tw_server_loop(void) { fd_set fdset; struct timeval tv; #endif -#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__)) +#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__) && !defined(__DOS__)) struct thread_entry threads[2048]; for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) { threads[i].used = false;